From: Pavel Filipenský Date: Thu, 5 Aug 2021 13:17:57 +0000 (+0200) Subject: s3:winbind: Improve logging in winbindd_getusersids.c X-Git-Tag: tevent-0.13.0~153 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8e372e1e2477d7fea5335d43a8b44fe9bdd5d8d;p=thirdparty%2Fsamba.git s3:winbind: Improve logging in winbindd_getusersids.c Test scenario: $ bin/wbinfo --user-sids `bin/wbinfo -n ADDOMAIN/alice | awk '{print $1}'` S-1-5-21-2018381343-4210792308-1157936888-1107 S-1-5-21-2018381343-4210792308-1157936888-513 S-1-5-32-545 Signed-off-by: Pavel Filipenský Reviewed-by: Andreas Schneider --- diff --git a/source3/winbindd/winbindd_getusersids.c b/source3/winbindd/winbindd_getusersids.c index c2347473f5f..6a839ab9c9b 100644 --- a/source3/winbindd/winbindd_getusersids.c +++ b/source3/winbindd/winbindd_getusersids.c @@ -46,14 +46,16 @@ struct tevent_req *winbindd_getusersids_send(TALLOC_CTX *mem_ctx, /* Ensure null termination */ request->data.sid[sizeof(request->data.sid)-1]='\0'; - DBG_NOTICE("[%s (%u)] getusersids %s\n", - cli->client_name, - (unsigned int)cli->pid, - request->data.sid); + D_NOTICE("[%s (%u)] Winbind external command GETUSERSIDS start.\n" + "sid=%s\n", + cli->client_name, + (unsigned int)cli->pid, + request->data.sid); if (!string_to_sid(&state->sid, request->data.sid)) { - DEBUG(1, ("Could not get convert sid %s from string\n", - request->data.sid)); + D_WARNING("Returning NT_STATUS_INVALID_PARAMETER.\n" + "Could not get convert sid %s from string\n", + request->data.sid); tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); return tevent_req_post(req, ev); } @@ -78,6 +80,8 @@ static void winbindd_getusersids_done(struct tevent_req *subreq) &state->sids); TALLOC_FREE(subreq); if (tevent_req_nterror(req, status)) { + D_WARNING("wb_gettoken_recv failed with %s.\n", + nt_errstr(status)); return; } tevent_req_done(req); @@ -90,13 +94,13 @@ NTSTATUS winbindd_getusersids_recv(struct tevent_req *req, req, struct winbindd_getusersids_state); struct dom_sid_buf sidbuf; NTSTATUS status; - int i; + uint32_t i; char *result; if (tevent_req_is_nterror(req, &status)) { - DEBUG(5, ("Could not convert sid %s: %s\n", + D_WARNING("Could not convert sid %s: %s\n", dom_sid_str_buf(&state->sid, &sidbuf), - nt_errstr(status))); + nt_errstr(status)); return status; } @@ -105,14 +109,16 @@ NTSTATUS winbindd_getusersids_recv(struct tevent_req *req, return NT_STATUS_NO_MEMORY; } + D_NOTICE("Winbind external command GETUSERSIDS end.\n" + "Got %u SID(s).\n", state->num_sids); for (i=0; inum_sids; i++) { + D_NOTICE("%u: %s\n", i, dom_sid_str_buf(&state->sids[i], &sidbuf)); talloc_asprintf_addbuf( &result, "%s\n", dom_sid_str_buf(&state->sids[i], &sidbuf)); } - response->data.num_entries = state->num_sids; response->extra_data.data = result; response->length += talloc_get_size(result);