diff options
-rw-r--r-- | source3/rpc_server/srv_svcctl.c | 18 | ||||
-rw-r--r-- | source3/rpc_server/srv_svcctl_nt.c | 57 |
2 files changed, 36 insertions, 39 deletions
diff --git a/source3/rpc_server/srv_svcctl.c b/source3/rpc_server/srv_svcctl.c index ed122912b9..275a2f62b2 100644 --- a/source3/rpc_server/srv_svcctl.c +++ b/source3/rpc_server/srv_svcctl.c @@ -149,23 +149,7 @@ static bool api_svcctl_query_service_config(pipes_struct *p) static bool api_svcctl_query_service_config2(pipes_struct *p) { - SVCCTL_Q_QUERY_SERVICE_CONFIG2 q_u; - SVCCTL_R_QUERY_SERVICE_CONFIG2 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_config2("", &q_u, data, 0)) - return False; - - r_u.status = _svcctl_query_service_config2(p, &q_u, &r_u); - - if(!svcctl_io_r_query_service_config2("", &r_u, rdata, 0)) - return False; - - return True; + return proxy_svcctl_call(p, NDR_SVCCTL_QUERYSERVICECONFIG2W); } /******************************************************************* diff --git a/source3/rpc_server/srv_svcctl_nt.c b/source3/rpc_server/srv_svcctl_nt.c index 2e50d312d6..457e44a2df 100644 --- a/source3/rpc_server/srv_svcctl_nt.c +++ b/source3/rpc_server/srv_svcctl_nt.c @@ -711,11 +711,13 @@ WERROR _svcctl_QueryServiceConfigW(pipes_struct *p, } /******************************************************************** + _svcctl_QueryServiceConfig2W ********************************************************************/ -WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u ) +WERROR _svcctl_QueryServiceConfig2W(pipes_struct *p, + struct svcctl_QueryServiceConfig2W *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; /* perform access checks */ @@ -729,36 +731,53 @@ WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CO /* we have to set the outgoing buffer size to the same as the incoming buffer size (even in the case of failure */ - rpcbuf_init( &r_u->buffer, q_u->buffer_size, p->mem_ctx ); - r_u->needed = q_u->buffer_size; + *r->out.bytes_needed = r->in.buf_size; - switch ( q_u->level ) { + switch ( r->in.info_level ) { case SERVICE_CONFIG_DESCRIPTION: { - SERVICE_DESCRIPTION desc_buf; + struct SERVICE_DESCRIPTION desc_buf; const char *description; + enum ndr_err_code ndr_err; + DATA_BLOB blob; description = svcctl_lookup_description( p->mem_ctx, info->name, p->server_info->ptok); - ZERO_STRUCTP( &desc_buf ); + desc_buf.description = description; + + ndr_err = ndr_push_struct_blob(&blob, p->mem_ctx, NULL, + &desc_buf, + (ndr_push_flags_fn_t)ndr_push_SERVICE_DESCRIPTION); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return WERR_INVALID_PARAM; + } - init_service_description_buffer( &desc_buf, description ? description : ""); - svcctl_io_service_description( "", &desc_buf, &r_u->buffer, 0 ); - buffer_size = svcctl_sizeof_service_description( &desc_buf ); + buffer_size = ndr_size_SERVICE_DESCRIPTION(&desc_buf, NULL, 0); + r->out.buffer = blob.data; break; } break; case SERVICE_CONFIG_FAILURE_ACTIONS: { - SERVICE_FAILURE_ACTIONS actions; + struct SERVICE_FAILURE_ACTIONS actions; + enum ndr_err_code ndr_err; + DATA_BLOB blob; /* nothing to say...just service the request */ - ZERO_STRUCTP( &actions ); - svcctl_io_service_fa( "", &actions, &r_u->buffer, 0 ); - buffer_size = svcctl_sizeof_service_fa( &actions ); + ZERO_STRUCT( actions ); + + ndr_err = ndr_push_struct_blob(&blob, p->mem_ctx, NULL, + &actions, + (ndr_push_flags_fn_t)ndr_push_SERVICE_FAILURE_ACTIONS); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return WERR_INVALID_PARAM; + } + + buffer_size = ndr_size_SERVICE_FAILURE_ACTIONS(&actions, NULL, 0); + r->out.buffer = blob.data; break; } @@ -769,9 +788,9 @@ WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CO } buffer_size += buffer_size % 4; - r_u->needed = (buffer_size > q_u->buffer_size) ? buffer_size : q_u->buffer_size; + *r->out.bytes_needed = (buffer_size > r->in.buf_size) ? buffer_size : r->in.buf_size; - if (buffer_size > q_u->buffer_size ) + if (buffer_size > r->in.buf_size ) return WERR_INSUFFICIENT_BUFFER; return WERR_OK; @@ -1083,12 +1102,6 @@ WERROR _svcctl_QueryServiceConfig2A(pipes_struct *p, struct svcctl_QueryServiceC return WERR_NOT_SUPPORTED; } -WERROR _svcctl_QueryServiceConfig2W(pipes_struct *p, struct svcctl_QueryServiceConfig2W *r) -{ - p->rng_fault_state = True; - return WERR_NOT_SUPPORTED; -} - WERROR _EnumServicesStatusExA(pipes_struct *p, struct EnumServicesStatusExA *r) { p->rng_fault_state = True; |