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