From b42cb4944a6c4c1509e175553c25b52f765bb3bb Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 6 Jan 2009 18:59:44 +0100 Subject: s3-svcctl: use pidl for _svcctl_QueryServiceStatusEx. Guenther --- source3/rpc_server/srv_svcctl.c | 19 ++----------------- source3/rpc_server/srv_svcctl_nt.c | 32 ++++++++++++++++++-------------- 2 files changed, 20 insertions(+), 31 deletions(-) (limited to 'source3') diff --git a/source3/rpc_server/srv_svcctl.c b/source3/rpc_server/srv_svcctl.c index a570d262f5..ed122912b9 100644 --- a/source3/rpc_server/srv_svcctl.c +++ b/source3/rpc_server/srv_svcctl.c @@ -109,24 +109,9 @@ static bool api_svcctl_enum_services_status(pipes_struct *p) static bool api_svcctl_query_service_status_ex(pipes_struct *p) { - SVCCTL_Q_QUERY_SERVICE_STATUSEX q_u; - SVCCTL_R_QUERY_SERVICE_STATUSEX 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_status_ex("", &q_u, data, 0)) - return False; - - r_u.status = _svcctl_query_service_status_ex(p, &q_u, &r_u); - - if(!svcctl_io_r_query_service_status_ex("", &r_u, rdata, 0)) - return False; - - return True; + return proxy_svcctl_call(p, NDR_SVCCTL_QUERYSERVICESTATUSEX); } + /******************************************************************* ********************************************************************/ diff --git a/source3/rpc_server/srv_svcctl_nt.c b/source3/rpc_server/srv_svcctl_nt.c index 187fb368e2..3bbe368a18 100644 --- a/source3/rpc_server/srv_svcctl_nt.c +++ b/source3/rpc_server/srv_svcctl_nt.c @@ -555,11 +555,13 @@ WERROR _svcctl_EnumDependentServicesW(pipes_struct *p, } /******************************************************************** + _svcctl_QueryServiceStatusEx ********************************************************************/ -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_QueryServiceStatusEx(pipes_struct *p, + struct svcctl_QueryServiceStatusEx *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 */ @@ -573,20 +575,28 @@ WERROR _svcctl_query_service_status_ex( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_ /* 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 SVC_STATUS_PROCESS_INFO: { SERVICE_STATUS_PROCESS svc_stat_proc; + enum ndr_err_code ndr_err; + DATA_BLOB blob; /* Get the status of the service.. */ info->ops->service_status( info->name, &svc_stat_proc.status ); svc_stat_proc.process_id = sys_getpid(); svc_stat_proc.service_flags = 0x0; - svcctl_io_service_status_process( "", &svc_stat_proc, &r_u->buffer, 0 ); + ndr_err = ndr_push_struct_blob(&blob, p->mem_ctx, NULL, + &svc_stat_proc, + (ndr_push_flags_fn_t)ndr_push_SERVICE_STATUS_PROCESS); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + return WERR_INVALID_PARAM; + } + + r->out.buffer = blob.data; buffer_size = sizeof(SERVICE_STATUS_PROCESS); break; } @@ -597,9 +607,9 @@ WERROR _svcctl_query_service_status_ex( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_ 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_MORE_DATA; return WERR_OK; @@ -1078,12 +1088,6 @@ WERROR _svcctl_QueryServiceConfig2W(pipes_struct *p, struct svcctl_QueryServiceC return WERR_NOT_SUPPORTED; } -WERROR _svcctl_QueryServiceStatusEx(pipes_struct *p, struct svcctl_QueryServiceStatusEx *r) -{ - p->rng_fault_state = True; - return WERR_NOT_SUPPORTED; -} - WERROR _EnumServicesStatusExA(pipes_struct *p, struct EnumServicesStatusExA *r) { p->rng_fault_state = True; -- cgit