From: Lennart Poettering Date: Fri, 24 Jun 2011 21:51:49 +0000 (+0200) Subject: pam: fix up tty if it is actually a display X-Git-Tag: v30~150 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=ee8545b06c2325e5dca7afd9ea8dbc35342a7768 pam: fix up tty if it is actually a display --- diff --git a/src/pam-module.c b/src/pam-module.c index eba59f65f..1658348e2 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";