From 5cc0ba8ec8c988d0068b07e4f67839d42b357537 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Mon, 5 Mar 2007 20:36:59 -0500 Subject: try to parse the real meaning of PAM_TTY --- pam-ck-connector/pam-ck-connector.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'pam-ck-connector/pam-ck-connector.c') diff --git a/pam-ck-connector/pam-ck-connector.c b/pam-ck-connector/pam-ck-connector.c index 66591c6..9ddf426 100644 --- a/pam-ck-connector/pam-ck-connector.c +++ b/pam-ck-connector/pam-ck-connector.c @@ -148,6 +148,7 @@ pam_sm_open_session (pam_handle_t *pamh, const char *s; uid_t uid; char buf[256]; + char ttybuf[PATH_MAX]; DBusError error; ret = PAM_IGNORE; @@ -180,6 +181,15 @@ pam_sm_open_session (pam_handle_t *pamh, goto out; } + /* interpret any tty with a colon as a DISPLAY */ + if (strchr (display_device, ':') != NULL) { + x11_display = display_device; + display_device = ""; + } else if (strncmp ("/dev/", display_device, 5) != 0) { + snprintf (ttybuf, sizeof (ttybuf), "/dev/%s", display_device); + display_device = ttybuf; + } + if (pam_get_item (pamh, PAM_RHOST, (const void **) &s) == PAM_SUCCESS && s != NULL) { remote_host_name = s; if (opt_debug) { -- cgit