summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pam-module.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pam-module.c b/src/pam-module.c
index eba59f65f2..1658348e28 100644
--- a/src/pam-module.c
+++ b/src/pam-module.c
@@ -382,6 +382,16 @@ _public_ PAM_EXTERN int pam_sm_open_session(
remote_host = strempty(remote_host);
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 */
+
+ if (isempty(display))
+ display = tty;
+ tty = NULL;
+ }
+
type = !isempty(display) ? "x11" :
!isempty(tty) ? "tty" : "other";