chiark / gitweb /
pam_systemd: Ignore vtnr when seat != seat0
[elogind.git] / src / login / pam-module.c
index e76fef8001586cc02d7673b08d4ae752be3f2011..18dd4e2e2136482e3a73f1356502ecef269d4bac 100644 (file)
@@ -173,6 +173,10 @@ static int export_legacy_dbus_address(
         _cleanup_free_ char *s = NULL;
         int r;
 
+        /* 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.");
@@ -317,6 +321,12 @@ _public_ PAM_EXTERN int pam_sm_open_session(
                         get_seat_from_display(display, NULL, &vtnr);
         }
 
+        if (seat && !streq(seat, "seat0")) {
+                pam_syslog(handle, LOG_DEBUG,
+                      "Ignoring vtnr %d for %s which is not seat0", vtnr, seat);
+                vtnr = 0;
+        }
+
         if (!type)
                 type = !isempty(display) ? "x11" :
                         !isempty(tty) ? "tty" : "unspecified";