ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
6f381c
From ea3910e561f043f5a131a846862955c77169da1b Mon Sep 17 00:00:00 2001
6f381c
From: Lennart Poettering <lennart@poettering.net>
6f381c
Date: Mon, 19 Nov 2018 11:39:45 +0100
6f381c
Subject: [PATCH] pam_systemd: suppress LOG_DEBUG log messages if debugging is
6f381c
 off
6f381c
6f381c
In the PAM module we need to suppress LOG_DEBUG messages manually, if
6f381c
debug logging is not on, as PAM won't do this for us. We did this
6f381c
correctly for most log messages already, but two were missing. Let's fix
6f381c
those too.
6f381c
6f381c
Fixes: #10822
6f381c
(cherry picked from commit 2675747f3cdd6f1e6236bbb2f79abfa53fb307f1)
6f381c
6f381c
Resolves: #2170084
6f381c
---
6f381c
 src/login/pam_systemd.c | 6 ++++--
6f381c
 1 file changed, 4 insertions(+), 2 deletions(-)
6f381c
6f381c
diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
6f381c
index 64e1b4d1bf..c87e980b18 100644
6f381c
--- a/src/login/pam_systemd.c
6f381c
+++ b/src/login/pam_systemd.c
6f381c
@@ -476,7 +476,8 @@ _public_ PAM_EXTERN int pam_sm_open_session(
6f381c
         }
6f381c
 
6f381c
         if (seat && !streq(seat, "seat0") && vtnr != 0) {
6f381c
-                pam_syslog(handle, LOG_DEBUG, "Ignoring vtnr %"PRIu32" for %s which is not seat0", vtnr, seat);
6f381c
+                if (debug)
6f381c
+                        pam_syslog(handle, LOG_DEBUG, "Ignoring vtnr %"PRIu32" for %s which is not seat0", vtnr, seat);
6f381c
                 vtnr = 0;
6f381c
         }
6f381c
 
6f381c
@@ -577,7 +578,8 @@ _public_ PAM_EXTERN int pam_sm_open_session(
6f381c
         r = sd_bus_call(bus, m, 0, &error, &reply);
6f381c
         if (r < 0) {
6f381c
                 if (sd_bus_error_has_name(&error, BUS_ERROR_SESSION_BUSY)) {
6f381c
-                        pam_syslog(handle, LOG_DEBUG, "Cannot create session: %s", bus_error_message(&error, r));
6f381c
+                        if (debug)
6f381c
+                                pam_syslog(handle, LOG_DEBUG, "Cannot create session: %s", bus_error_message(&error, r));
6f381c
                         return PAM_SUCCESS;
6f381c
                 } else {
6f381c
                         pam_syslog(handle, LOG_ERR, "Failed to create session: %s", bus_error_message(&error, r));