diff options
author | Volker Lendecke <vl@samba.org> | 2018-01-15 11:42:29 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2018-01-16 02:43:03 +0100 |
commit | a63aafb05d4d975aa9898b8a2dcbbf5d4f41938d (patch) | |
tree | 6c885cdb0d3f68af9dd3f8347d94c6111accf833 /source3/rpc_server | |
parent | 6aa0cc2570f9c86e76086bebf16234988107384e (diff) | |
download | samba-a63aafb05d4d975aa9898b8a2dcbbf5d4f41938d.tar.gz |
srcctl3: Improve debug messages
A customer's syslog was filled with
_svcctl_OpenServiceW: Failed to get a valid security descriptor
messages. This improves the messages to give info about which service failed
with which error code. Also, it makes OpenServiceW fail with the same error
message Windows fails with for unknown services.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jan 16 02:43:03 CET 2018 on sn-devel-144
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/svcctl/srv_svcctl_nt.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/source3/rpc_server/svcctl/srv_svcctl_nt.c b/source3/rpc_server/svcctl/srv_svcctl_nt.c index d4bf2e70e35..8eaedfb764d 100644 --- a/source3/rpc_server/svcctl/srv_svcctl_nt.c +++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c @@ -301,6 +301,7 @@ WERROR _svcctl_OpenServiceW(struct pipes_struct *p, uint32_t access_granted = 0; NTSTATUS status; const char *service = NULL; + WERROR err; service = r->in.ServiceName; if (!service) { @@ -317,14 +318,19 @@ WERROR _svcctl_OpenServiceW(struct pipes_struct *p, * Perform access checks. Use the system session_info in order to ensure * that we retrieve the security descriptor */ - sec_desc = svcctl_get_secdesc(p->mem_ctx, - p->msg_ctx, - get_session_info_system(), - service); - if (sec_desc == NULL) { - DEBUG(0, ("_svcctl_OpenServiceW: Failed to get a valid security " - "descriptor")); - return WERR_NOT_ENOUGH_MEMORY; + err = svcctl_get_secdesc(p->msg_ctx, + get_session_info_system(), + service, + p->mem_ctx, + &sec_desc); + if (W_ERROR_EQUAL(err, WERR_FILE_NOT_FOUND)) { + DBG_NOTICE("service %s does not exist\n", service); + return WERR_SERVICE_DOES_NOT_EXIST; + } + if (!W_ERROR_IS_OK(err)) { + DBG_NOTICE("Failed to get a valid secdesc for %s: %s\n", + service, win_errstr(err)); + return err; } se_map_generic( &r->in.access_mask, &svc_generic_map ); @@ -899,6 +905,7 @@ WERROR _svcctl_QueryServiceObjectSecurity(struct pipes_struct *p, NTSTATUS status; uint8_t *buffer = NULL; size_t len = 0; + WERROR err; /* only support the SCM and individual services */ @@ -917,12 +924,19 @@ WERROR _svcctl_QueryServiceObjectSecurity(struct pipes_struct *p, return WERR_INVALID_PARAMETER; /* Lookup the security descriptor and marshall it up for a reply */ - sec_desc = svcctl_get_secdesc(p->mem_ctx, - p->msg_ctx, - get_session_info_system(), - info->name); - if (sec_desc == NULL) { - return WERR_NOT_ENOUGH_MEMORY; + err = svcctl_get_secdesc(p->msg_ctx, + get_session_info_system(), + info->name, + p->mem_ctx, + &sec_desc); + if (W_ERROR_EQUAL(err, WERR_FILE_NOT_FOUND)) { + DBG_NOTICE("service %s does not exist\n", info->name); + return WERR_SERVICE_DOES_NOT_EXIST; + } + if (!W_ERROR_IS_OK(err)) { + DBG_NOTICE("Failed to get a valid secdesc for %s: %s\n", + info->name, win_errstr(err)); + return err; } *r->out.needed = ndr_size_security_descriptor(sec_desc, 0); |