From: Pavel Filipenský Date: Thu, 5 Aug 2021 12:21:23 +0000 (+0200) Subject: s3:winbind: Improve logging in winbindd_getpwsid.c X-Git-Tag: tevent-0.13.0~142 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=980f8092c6d67375de457a553148730e33ec616d;p=thirdparty%2Fsamba.git s3:winbind: Improve logging in winbindd_getpwsid.c Test scenario: $ bin/wbinfo --name-to-sid ADDOMAIN/alice S-1-5-21-4248687961-4152985382-2800071106-1107 SID_USER (1) $ bin/wbinfo --user-sidinfo S-1-5-21-4248687961-4152985382-2800071106-1107 ADDOMAIN/alice:*:2001107:2000513::/home/ADDOMAIN/alice:/bin/false Signed-off-by: Pavel Filipenský Reviewed-by: Andreas Schneider --- diff --git a/source3/winbindd/winbindd_getpwsid.c b/source3/winbindd/winbindd_getpwsid.c index adf287fb478..8e0a3e3b7f3 100644 --- a/source3/winbindd/winbindd_getpwsid.c +++ b/source3/winbindd/winbindd_getpwsid.c @@ -45,14 +45,15 @@ struct tevent_req *winbindd_getpwsid_send(TALLOC_CTX *mem_ctx, /* Ensure null termination */ request->data.sid[sizeof(request->data.sid)-1]='\0'; - DBG_NOTICE("[%s (%u)] getpwsid %s\n", - cli->client_name, - (unsigned int)cli->pid, - request->data.sid); + D_NOTICE("[%s (%u)] Winbind external command GETPWSID 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("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); } @@ -87,12 +88,22 @@ NTSTATUS winbindd_getpwsid_recv(struct tevent_req *req, NTSTATUS status; if (tevent_req_is_nterror(req, &status)) { - struct dom_sid_buf buf; - DEBUG(5, ("Could not convert sid %s: %s\n", - dom_sid_str_buf(&state->sid, &buf), - nt_errstr(status))); + D_WARNING("Failed with %s.\n", nt_errstr(status)); return status; } response->data.pw = state->pw; + + D_NOTICE("Winbind external command GETPWSID end.\n" + "(name:passwd:uid:gid:gecos:dir:shell)\n" + "%s:%s:%u:%u:%s:%s:%s\n", + state->pw.pw_name, + state->pw.pw_passwd, + (unsigned int)state->pw.pw_uid, + (unsigned int)state->pw.pw_gid, + state->pw.pw_gecos, + state->pw.pw_dir, + state->pw.pw_shell + ); + return NT_STATUS_OK; }