]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pam: quiet a spurious debug message
authorRonan Pigott <ronan@rjp.ie>
Sat, 2 Nov 2024 02:44:18 +0000 (19:44 -0700)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 2 Nov 2024 13:47:17 +0000 (22:47 +0900)
This singular debug message gets printed even if debug is not enabled.
Quiet this message when debug is not enabled for consistency.

src/home/pam_systemd_home.c
src/login/pam_systemd.c
src/shared/pam-util.c
src/shared/pam-util.h

index 372d79cc85c788f1d3244ad4e2bf6fa39e6511b3..624f1ced88507fe6238183ffdb0fe3979c181198 100644 (file)
@@ -149,7 +149,7 @@ static int acquire_user_record(
                 _cleanup_free_ char *generic_field = NULL, *json_copy = NULL;
                 _cleanup_(sd_bus_unrefp) sd_bus *bus = NULL;
 
-                r = pam_acquire_bus_connection(handle, "pam-systemd-home", &bus, bus_data);
+                r = pam_acquire_bus_connection(handle, "pam-systemd-home", debug, &bus, bus_data);
                 if (r != PAM_SUCCESS)
                         return r;
 
@@ -563,7 +563,7 @@ static int acquire_home(
          * request to collect one more password and pass the new and all previously used passwords again. */
 
         _cleanup_(sd_bus_unrefp) sd_bus *bus = NULL;
-        r = pam_acquire_bus_connection(handle, "pam-systemd-home", &bus, bus_data);
+        r = pam_acquire_bus_connection(handle, "pam-systemd-home", debug, &bus, bus_data);
         if (r != PAM_SUCCESS)
                 return r;
 
@@ -892,7 +892,7 @@ _public_ PAM_EXTERN int pam_sm_close_session(
                 return r;
 
         _cleanup_(sd_bus_unrefp) sd_bus *bus = NULL;
-        r = pam_acquire_bus_connection(handle, "pam-systemd-home", &bus, NULL);
+        r = pam_acquire_bus_connection(handle, "pam-systemd-home", debug, &bus, NULL);
         if (r != PAM_SUCCESS)
                 return r;
 
@@ -1114,7 +1114,7 @@ _public_ PAM_EXTERN int pam_sm_chauthtok(
                 return pam_syslog_errno(handle, LOG_ERR, r, "Failed to store new password: %m");
 
         _cleanup_(sd_bus_unrefp) sd_bus *bus = NULL;
-        r = pam_acquire_bus_connection(handle, "pam-systemd-home", &bus, NULL);
+        r = pam_acquire_bus_connection(handle, "pam-systemd-home", debug, &bus, NULL);
         if (r != PAM_SUCCESS)
                 return r;
 
index 77b23d54dbd1122f83103be2a31e629cd32623d4..7cc64144ebbc9d3b1a99df7af1331f749c129e44 100644 (file)
@@ -1087,7 +1087,7 @@ _public_ PAM_EXTERN int pam_sm_open_session(
                 return pam_syslog_pam_error(handle, LOG_ERR, r, "Failed to get PAM systemd.runtime_max_sec data: @PAMERR@");
 
         /* Talk to logind over the message bus */
-        r = pam_acquire_bus_connection(handle, "pam-systemd", &bus, &d);
+        r = pam_acquire_bus_connection(handle, "pam-systemd", debug, &bus, &d);
         if (r != PAM_SUCCESS)
                 return r;
 
@@ -1303,7 +1303,7 @@ _public_ PAM_EXTERN int pam_sm_close_session(
                 /* Before we go and close the FIFO we need to tell logind that this is a clean session
                  * shutdown, so that it doesn't just go and slaughter us immediately after closing the fd */
 
-                r = pam_acquire_bus_connection(handle, "pam-systemd", &bus, NULL);
+                r = pam_acquire_bus_connection(handle, "pam-systemd", debug, &bus, NULL);
                 if (r != PAM_SUCCESS)
                         return r;
 
index 3cbe431531c1b7834032b035f87e9264cccaa87a..af97adb2d0832aa2c5e7f793a66365f1f3f1191a 100644 (file)
@@ -148,6 +148,7 @@ void pam_bus_data_disconnectp(PamBusData **_d) {
 int pam_acquire_bus_connection(
                 pam_handle_t *handle,
                 const char *module_name,
+                bool debug,
                 sd_bus **ret_bus,
                 PamBusData **ret_pam_bus_data) {
 
@@ -187,7 +188,7 @@ int pam_acquire_bus_connection(
         if (r != PAM_SUCCESS)
                 return pam_syslog_pam_error(handle, LOG_ERR, r, "Failed to set PAM bus data: @PAMERR@");
 
-        pam_syslog(handle, LOG_DEBUG, "New sd-bus connection (%s) opened.", d->cache_id);
+        pam_debug_syslog(handle, debug, "New sd-bus connection (%s) opened.", d->cache_id);
 
 success:
         *ret_bus = sd_bus_ref(d->bus);
index d627eb733fcf086fab95fe3dd6fdaad59878b04c..34a83294b0984b691a228b6b973bf889520a7084 100644 (file)
@@ -37,7 +37,7 @@ void pam_bus_data_disconnectp(PamBusData **d);
 
 /* Use a different module name per different PAM module. They are all loaded in the same namespace, and this
  * helps avoid a clash in the internal data structures of sd-bus. It will be used as key for cache items. */
-int pam_acquire_bus_connection(pam_handle_t *handle, const char *module_name, sd_bus **ret_bus, PamBusData **ret_bus_data);
+int pam_acquire_bus_connection(pam_handle_t *handle, const char *module_name, bool debug, sd_bus **ret_bus, PamBusData **ret_bus_data);
 int pam_release_bus_connection(pam_handle_t *handle, const char *module_name);
 int pam_get_bus_data(pam_handle_t *handle, const char *module_name, PamBusData **ret);