chiark / gitweb /
pam-module: treat "cron" in PAM_TTY as empty tty
authorMichal Schmidt <mschmidt@redhat.com>
Sat, 19 Nov 2011 00:17:46 +0000 (01:17 +0100)
committerMichal Schmidt <mschmidt@redhat.com>
Sat, 19 Nov 2011 00:17:53 +0000 (01:17 +0100)
cron sets PAM_TTY to "cron" and it has been doing it for a long time.
It cannot be changed because user configurations may depend on it.

https://bugzilla.redhat.com/show_bug.cgi?id=727315

src/logind-session.c
src/pam-module.c

index b0a09e3d37ea0e3537da7902c128de129ff3c237..63ee75808b546f9ef668b380ebde57907c89d797 100644 (file)
@@ -536,7 +536,7 @@ int session_start(Session *s) {
         if (r < 0)
                 return r;
 
-        log_full(s->display || s->tty ? LOG_INFO : LOG_DEBUG,
+        log_full(s->type == SESSION_TTY || s->type == SESSION_X11 ? LOG_INFO : LOG_DEBUG,
                  "New session %s of user %s.", s->id, s->user->name);
 
         /* Create cgroup */
@@ -659,7 +659,7 @@ int session_stop(Session *s) {
         assert(s);
 
         if (s->started)
-                log_full(s->display || s->tty ? LOG_INFO : LOG_DEBUG,
+                log_full(s->type == SESSION_TTY || s->type == SESSION_X11 ? LOG_INFO : LOG_DEBUG,
                          "Removed session %s.", s->id);
 
         /* Kill cgroup */
index e65088638b6de4d99683f9252a8776f8f28ac916..46b7becc5d04480d7ea5ef79f5e61dc975620fb7 100644 (file)
@@ -463,6 +463,10 @@ _public_ PAM_EXTERN int pam_sm_open_session(
                 if (isempty(display))
                         display = tty;
                 tty = "";
+        } else if (streq(tty, "cron")) {
+                /* cron has been setting PAM_TTY to "cron" for a very long time
+                 * and it cannot stop doing that for compatibility reasons. */
+                tty = "";
         }
 
         if (!isempty(cvtnr))