chiark / gitweb /
logind: get rid of X11 display socket symlink
[elogind.git] / src / login / pam-module.c
index c67e677384b11e0ce4b37c5ec099786924838dfb..7400734fdc975f0c83eeb3dbc240c87cb66f7166 100644 (file)
@@ -173,7 +173,11 @@ static int export_legacy_dbus_address(
         _cleanup_free_ char *s = NULL;
         int r;
 
-        if (asprintf(&s, "kernel:path=/dev/kdbus/%lu-user/bus;unix:path=%s/bus",
+        /* skip export if kdbus is not active */
+        if (access("/dev/kdbus", F_OK) < 0)
+                return PAM_SUCCESS;
+
+        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;