1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00

s3: use IDL generated rpc for _svcctl_QueryServiceConfigW.

Guenther
This commit is contained in:
Günther Deschner 2008-10-16 02:00:22 +02:00
parent d2b836e19a
commit 6a97b4147c
3 changed files with 19 additions and 40 deletions

View File

@ -9094,7 +9094,6 @@ WERROR _svcctl_ControlService(pipes_struct *p,
WERROR _svcctl_EnumDependentServicesW(pipes_struct *p,
struct svcctl_EnumDependentServicesW *r);
WERROR _svcctl_query_service_status_ex( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u );
WERROR _svcctl_query_service_config( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CONFIG *q_u, SVCCTL_R_QUERY_SERVICE_CONFIG *r_u );
WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u );
WERROR _svcctl_LockServiceDatabase(pipes_struct *p,
struct svcctl_LockServiceDatabase *r);

View File

@ -155,23 +155,7 @@ static bool api_svcctl_control_service(pipes_struct *p)
static bool api_svcctl_query_service_config(pipes_struct *p)
{
SVCCTL_Q_QUERY_SERVICE_CONFIG q_u;
SVCCTL_R_QUERY_SERVICE_CONFIG r_u;
prs_struct *data = &p->in_data.data;
prs_struct *rdata = &p->out_data.rdata;
ZERO_STRUCT(q_u);
ZERO_STRUCT(r_u);
if(!svcctl_io_q_query_service_config("", &q_u, data, 0))
return False;
r_u.status = _svcctl_query_service_config(p, &q_u, &r_u);
if(!svcctl_io_r_query_service_config("", &r_u, rdata, 0))
return False;
return True;
return proxy_svcctl_call(p, SVCCTL_QUERY_SERVICE_CONFIG_W);
}
/*******************************************************************

View File

@ -6,6 +6,7 @@
*
* Largely Rewritten (Again) by:
* Copyright (C) Gerald (Jerry) Carter 2005.
* Copyright (C) Guenther Deschner 2008.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -610,7 +611,9 @@ WERROR _svcctl_query_service_status_ex( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_
/********************************************************************
********************************************************************/
static WERROR fill_svc_config( TALLOC_CTX *ctx, const char *name, SERVICE_CONFIG *config, NT_USER_TOKEN *token )
static WERROR fill_svc_config( TALLOC_CTX *ctx, const char *name,
struct QUERY_SERVICE_CONFIG *config,
NT_USER_TOKEN *token )
{
REGVAL_CTR *values;
REGISTRY_VALUE *val;
@ -622,20 +625,17 @@ static WERROR fill_svc_config( TALLOC_CTX *ctx, const char *name, SERVICE_CONFIG
/* now fill in the individual values */
config->displayname = TALLOC_ZERO_P( ctx, UNISTR2 );
if ( (val = regval_ctr_getvalue( values, "DisplayName" )) != NULL )
init_unistr2( config->displayname, regval_sz( val ), UNI_STR_TERMINATE );
config->displayname = regval_sz(val);
else
init_unistr2( config->displayname, name, UNI_STR_TERMINATE );
config->displayname = name;
if ( (val = regval_ctr_getvalue( values, "ObjectName" )) != NULL ) {
config->startname = TALLOC_ZERO_P( ctx, UNISTR2 );
init_unistr2( config->startname, regval_sz( val ), UNI_STR_TERMINATE );
config->startname = regval_sz(val);
}
if ( (val = regval_ctr_getvalue( values, "ImagePath" )) != NULL ) {
config->executablepath = TALLOC_ZERO_P( ctx, UNISTR2 );
init_unistr2( config->executablepath, regval_sz( val ), UNI_STR_TERMINATE );
config->executablepath = regval_sz(val);
}
/* a few hard coded values */
@ -663,11 +663,13 @@ static WERROR fill_svc_config( TALLOC_CTX *ctx, const char *name, SERVICE_CONFIG
}
/********************************************************************
_svcctl_QueryServiceConfigW
********************************************************************/
WERROR _svcctl_query_service_config( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CONFIG *q_u, SVCCTL_R_QUERY_SERVICE_CONFIG *r_u )
WERROR _svcctl_QueryServiceConfigW(pipes_struct *p,
struct svcctl_QueryServiceConfigW *r)
{
SERVICE_INFO *info = find_service_info_by_hnd( p, &q_u->handle );
SERVICE_INFO *info = find_service_info_by_hnd( p, r->in.handle );
uint32 buffer_size;
WERROR wresult;
@ -682,17 +684,17 @@ WERROR _svcctl_query_service_config( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CON
/* we have to set the outgoing buffer size to the same as the
incoming buffer size (even in the case of failure */
r_u->needed = q_u->buffer_size;
*r->out.bytes_needed = r->in.buf_size;
wresult = fill_svc_config( p->mem_ctx, info->name, &r_u->config, p->pipe_user.nt_user_token );
wresult = fill_svc_config( p->mem_ctx, info->name, r->out.query, p->pipe_user.nt_user_token );
if ( !W_ERROR_IS_OK(wresult) )
return wresult;
buffer_size = svcctl_sizeof_service_config( &r_u->config );
r_u->needed = (buffer_size > q_u->buffer_size) ? buffer_size : q_u->buffer_size;
buffer_size = ndr_size_QUERY_SERVICE_CONFIG(r->out.query, 0);
*r->out.bytes_needed = (buffer_size > r->in.buf_size) ? buffer_size : r->in.buf_size;
if (buffer_size > q_u->buffer_size ) {
ZERO_STRUCTP( &r_u->config );
if (buffer_size > r->in.buf_size ) {
TALLOC_FREE(r->out.query);
return WERR_INSUFFICIENT_BUFFER;
}
@ -956,12 +958,6 @@ WERROR _svcctl_EnumServicesStatusW(pipes_struct *p, struct svcctl_EnumServicesSt
return WERR_NOT_SUPPORTED;
}
WERROR _svcctl_QueryServiceConfigW(pipes_struct *p, struct svcctl_QueryServiceConfigW *r)
{
p->rng_fault_state = True;
return WERR_NOT_SUPPORTED;
}
WERROR _svcctl_QueryServiceLockStatusW(pipes_struct *p, struct svcctl_QueryServiceLockStatusW *r)
{
p->rng_fault_state = True;