From 53d9cf7692e68bfc7db0b00703e2c8a9e58a439c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pavel=20Filipensk=C3=BD?= Date: Fri, 24 Jun 2022 14:51:07 +0200 Subject: [PATCH] s3:winbind: Improve logging in winbindd_pam_logoff.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Test scenario: $ bin/wbinfo --logoff Signed-off-by: Pavel Filipenský Reviewed-by: Andreas Schneider --- source3/winbindd/winbindd_pam_logoff.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/source3/winbindd/winbindd_pam_logoff.c b/source3/winbindd/winbindd_pam_logoff.c index 5578f887dcc..7a3b1b68343 100644 --- a/source3/winbindd/winbindd_pam_logoff.c +++ b/source3/winbindd/winbindd_pam_logoff.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "util/debug.h" #include "winbindd.h" #include "lib/global_contexts.h" #include "librpc/gen_ndr/ndr_winbind_c.h" @@ -47,16 +48,17 @@ struct tevent_req *winbindd_pam_logoff_send(TALLOC_CTX *mem_ctx, if (req == NULL) { return NULL; } - + D_NOTICE("[%s (%u)] Winbind external command PAM_LOGOFF start.\n" + "Username '%s' is used during logoff.\n", + cli->client_name, + (unsigned int)cli->pid, + request->data.auth.user); /* Ensure null termination */ /* Ensure null termination */ request->data.logoff.user[sizeof(request->data.logoff.user)-1]='\0'; request->data.logoff.krb5ccname[ sizeof(request->data.logoff.krb5ccname)-1]='\0'; - DEBUG(3, ("[%5lu]: pam auth %s\n", (unsigned long)cli->pid, - request->data.auth.user)); - if (request->data.logoff.uid == (uid_t)-1) { goto failed; } @@ -78,8 +80,8 @@ struct tevent_req *winbindd_pam_logoff_send(TALLOC_CTX *mem_ctx, res = getpeereid(cli->sock, &caller_uid, &caller_gid); if (res != 0) { - DEBUG(1,("winbindd_pam_logoff: failed to check peerid: %s\n", - strerror(errno))); + D_WARNING("winbindd_pam_logoff: failed to check peerid: %s\n", + strerror(errno)); goto failed; } @@ -91,8 +93,7 @@ struct tevent_req *winbindd_pam_logoff_send(TALLOC_CTX *mem_ctx, break; default: if (caller_uid != request->data.logoff.uid) { - DEBUG(1,("winbindd_pam_logoff: caller requested " - "invalid uid\n")); + D_WARNING("caller requested invalid uid\n"); goto failed; } break; @@ -155,6 +156,7 @@ NTSTATUS winbindd_pam_logoff_recv(struct tevent_req *req, req, struct winbindd_pam_logoff_state); NTSTATUS status = NT_STATUS_OK; + D_NOTICE("Winbind external command PAM_LOGOFF end.\n"); if (tevent_req_is_nterror(req, &status)) { set_auth_errors(response, status); return status; -- 2.47.3