[systemd-devel] [PATCH 2/2] bus: export bus address also when compiled without kdbus

Mantas Mikulėnas grawity at gmail.com
Wed Jan 8 04:08:34 PST 2014


It was removed from user at .service, so it should be added here.
---
 src/login/pam-module.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/login/pam-module.c b/src/login/pam-module.c
index e76fef8..ea606b7 100644
--- a/src/login/pam-module.c
+++ b/src/login/pam-module.c
@@ -169,22 +169,28 @@ static int export_legacy_dbus_address(
                 uid_t uid,
                 const char *runtime) {
 
-#ifdef ENABLE_KDBUS
         _cleanup_free_ char *s = NULL;
         int r;
 
+#ifdef ENABLE_KDBUS
         if (asprintf(&s, KERNEL_USER_BUS_FMT ";" UNIX_USER_BUS_FMT,
                      (unsigned long) uid, runtime) < 0) {
                 pam_syslog(handle, LOG_ERR, "Failed to set bus variable.");
                 return PAM_BUF_ERR;
         }
+#else
+        if (asprintf(&s, UNIX_USER_BUS_FMT, runtime) < 0) {
+                pam_syslog(handle, LOG_ERR, "Failed to set bus variable.");
+                return PAM_BUF_ERR;
+        }
+#endif
 
         r = pam_misc_setenv(handle, "DBUS_SESSION_BUS_ADDRESS", s, 0);
         if (r != PAM_SUCCESS) {
                 pam_syslog(handle, LOG_ERR, "Failed to set bus variable.");
                 return r;
         }
-#endif
+
         return PAM_SUCCESS;
 }
 
-- 
1.8.5.1.277.g0e0d235



More information about the systemd-devel mailing list