summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_svcctl_nt.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_server/srv_svcctl_nt.c')
-rw-r--r--source3/rpc_server/srv_svcctl_nt.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/source3/rpc_server/srv_svcctl_nt.c b/source3/rpc_server/srv_svcctl_nt.c
index 3ca85aa755..0b0ef83bee 100644
--- a/source3/rpc_server/srv_svcctl_nt.c
+++ b/source3/rpc_server/srv_svcctl_nt.c
@@ -32,8 +32,6 @@ struct service_control_op {
SERVICE_CONTROL_OPS *ops;
};
-#define SVCCTL_NUM_INTERNAL_SERVICES 4
-
/* handle external services */
extern SERVICE_CONTROL_OPS rcinit_svc_ops;
@@ -446,7 +444,7 @@ WERROR _svcctl_EnumServicesStatusW(pipes_struct *p,
buffer_size += buffer_size % 4;
- if (buffer_size > r->in.buf_size ) {
+ if (buffer_size > r->in.offered) {
num_services = 0;
result = WERR_MORE_DATA;
}
@@ -468,10 +466,10 @@ WERROR _svcctl_EnumServicesStatusW(pipes_struct *p,
}
blob = ndr_push_blob(ndr);
+ memcpy(r->out.service, blob.data, r->in.offered);
}
- r->out.service = blob.data;
- *r->out.bytes_needed = (buffer_size > r->in.buf_size) ? buffer_size : r->in.buf_size;
+ *r->out.needed = (buffer_size > r->in.offered) ? buffer_size : r->in.offered;
*r->out.services_returned = (uint32)num_services;
*r->out.resume_handle = 0x0;
@@ -548,11 +546,20 @@ WERROR _svcctl_EnumDependentServicesW(pipes_struct *p,
if ( !(info->access_granted & SC_RIGHT_SVC_ENUMERATE_DEPENDENTS) )
return WERR_ACCESS_DENIED;
+ switch (r->in.state) {
+ case SERVICE_STATE_ACTIVE:
+ case SERVICE_STATE_INACTIVE:
+ case SERVICE_STATE_ALL:
+ break;
+ default:
+ return WERR_INVALID_PARAM;
+ }
+
/* we have to set the outgoing buffer size to the same as the
incoming buffer size (even in the case of failure */
/* this is done in the autogenerated server already - gd */
- *r->out.bytes_needed = r->in.buf_size;
+ *r->out.needed = r->in.offered;
/* no dependent services...basically a stub function */
*r->out.services_returned = 0;
@@ -580,7 +587,7 @@ WERROR _svcctl_QueryServiceStatusEx(pipes_struct *p,
/* we have to set the outgoing buffer size to the same as the
incoming buffer size (even in the case of failure) */
- *r->out.bytes_needed = r->in.buf_size;
+ *r->out.needed = r->in.offered;
switch ( r->in.info_level ) {
case SVC_STATUS_PROCESS_INFO:
@@ -612,9 +619,9 @@ WERROR _svcctl_QueryServiceStatusEx(pipes_struct *p,
buffer_size += buffer_size % 4;
- *r->out.bytes_needed = (buffer_size > r->in.buf_size) ? buffer_size : r->in.buf_size;
+ *r->out.needed = (buffer_size > r->in.offered) ? buffer_size : r->in.offered;
- if (buffer_size > r->in.buf_size ) {
+ if (buffer_size > r->in.offered ) {
return WERR_INSUFFICIENT_BUFFER;
}
@@ -697,7 +704,7 @@ WERROR _svcctl_QueryServiceConfigW(pipes_struct *p,
/* we have to set the outgoing buffer size to the same as the
incoming buffer size (even in the case of failure */
- *r->out.bytes_needed = r->in.buf_size;
+ *r->out.needed = r->in.offered;
wresult = fill_svc_config( p->mem_ctx, info->name, r->out.query,
p->server_info->ptok);
@@ -705,9 +712,9 @@ WERROR _svcctl_QueryServiceConfigW(pipes_struct *p,
return wresult;
buffer_size = ndr_size_QUERY_SERVICE_CONFIG(r->out.query, NULL, 0);
- *r->out.bytes_needed = (buffer_size > r->in.buf_size) ? buffer_size : r->in.buf_size;
+ *r->out.needed = (buffer_size > r->in.offered) ? buffer_size : r->in.offered;
- if (buffer_size > r->in.buf_size ) {
+ if (buffer_size > r->in.offered ) {
ZERO_STRUCTP(r->out.query);
return WERR_INSUFFICIENT_BUFFER;
}
@@ -735,7 +742,7 @@ WERROR _svcctl_QueryServiceConfig2W(pipes_struct *p,
/* we have to set the outgoing buffer size to the same as the
incoming buffer size (even in the case of failure */
- *r->out.bytes_needed = r->in.buf_size;
+ *r->out.needed = r->in.offered;
switch ( r->in.info_level ) {
case SERVICE_CONFIG_DESCRIPTION:
@@ -792,9 +799,9 @@ WERROR _svcctl_QueryServiceConfig2W(pipes_struct *p,
}
buffer_size += buffer_size % 4;
- *r->out.bytes_needed = (buffer_size > r->in.buf_size) ? buffer_size : r->in.buf_size;
+ *r->out.needed = (buffer_size > r->in.offered) ? buffer_size : r->in.offered;
- if (buffer_size > r->in.buf_size )
+ if (buffer_size > r->in.offered)
return WERR_INSUFFICIENT_BUFFER;
return WERR_OK;
@@ -874,8 +881,7 @@ WERROR _svcctl_QueryServiceObjectSecurity(pipes_struct *p,
*r->out.needed = ndr_size_security_descriptor( sec_desc, NULL, 0 );
- if ( *r->out.needed > r->in.buffer_size ) {
- ZERO_STRUCTP( &r->out.buffer );
+ if ( *r->out.needed > r->in.offered) {
return WERR_INSUFFICIENT_BUFFER;
}
@@ -934,7 +940,8 @@ WERROR _svcctl_SetServiceObjectSecurity(pipes_struct *p,
/* read the security descfriptor */
status = unmarshall_sec_desc(p->mem_ctx,
- r->in.buffer, r->in.buffer_size,
+ r->in.buffer,
+ r->in.offered,
&sec_desc);
if (!NT_STATUS_IS_OK(status)) {
return ntstatus_to_werror(status);