chiark / gitweb /
logind: introduce an explicit session class for cronjobs and similar
[elogind.git] / src / login / pam-module.c
index c8f4dae77e1c9f25b46e2d86ad70a373091653bd..609317e9dd8f705e51ca048d6964eac3b1316167 100644 (file)
@@ -440,9 +440,10 @@ _public_ PAM_EXTERN int pam_sm_open_session(
         seat = strempty(seat);
 
         if (strchr(tty, ':')) {
-                /* A tty with a colon is usually an X11 display, place
-                 * there to show up in utmp. We rearrange things and
-                 * don't pretend that an X display was a tty */
+                /* A tty with a colon is usually an X11 display,
+                 * placed there to show up in utmp. We rearrange
+                 * things and don't pretend that an X display was a
+                 * tty. */
 
                 if (isempty(display))
                         display = tty;
@@ -482,7 +483,7 @@ _public_ PAM_EXTERN int pam_sm_open_session(
         if (isempty(class))
                 class = class_pam;
         if (isempty(class))
-                class = "user";
+                class = streq(type, "unspecified") ? "background" : "user";
 
         remote = !isempty(remote_host) &&
                 !streq(remote_host, "localhost") &&