diff options
author | Fabrice Ménard <menard.fabrice@orange.fr> | 2015-10-20 18:28:07 +0200 |
---|---|---|
committer | Eric Koegel <eric.koegel@gmail.com> | 2015-10-21 19:13:18 +0300 |
commit | ac39c4ea6bc0b5649c2389548fb27bc32668199b (patch) | |
tree | a027a5b117f419883fad094a14da9fb366f02ac1 | |
parent | 324b5e9eef9e4a50d634bc6403d8b7ceeba211b0 (diff) | |
download | ConsoleKit2-ac39c4ea6bc0b5649c2389548fb27bc32668199b.tar.gz |
XDG_VTNR support
XDG_VTNR is another way to obtain the X11 display device. As SDDM sets
this environment variable, it is now much simpler to use it with pam_ck_connector.
Signed-off-by: Eric Koegel <eric.koegel@gmail.com>
-rw-r--r-- | pam-ck-connector/pam-ck-connector.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pam-ck-connector/pam-ck-connector.c b/pam-ck-connector/pam-ck-connector.c index 65c08d6..77af7c2 100644 --- a/pam-ck-connector/pam-ck-connector.c +++ b/pam-ck-connector/pam-ck-connector.c @@ -248,11 +248,13 @@ pam_sm_open_session (pam_handle_t *pamh, uid_t uid; char buf[256]; char *ttybuf; + char *xdd; DBusError error; dbus_bool_t is_local; ret = PAM_IGNORE; ttybuf = NULL; + xdd = NULL; is_local = TRUE; _parse_pam_args (pamh, flags, argc, argv); @@ -339,6 +341,14 @@ pam_sm_open_session (pam_handle_t *pamh, if (opt_debug) { ck_pam_syslog (pamh, LOG_INFO, "using '%s' as X11 display device (from CKCON_X11_DISPLAY_DEVICE)", x11_display_device); } + } else if ((s = pam_getenv (pamh, "XDG_VTNR")) != NULL) { + int len = strlen (s) + 9; /* room for "/dev/ttyX\0" */ + xdd = malloc (len); + snprintf (xdd, len, "/dev/tty%s", s); + x11_display_device = xdd; + if (opt_debug) { + ck_pam_syslog (pamh, LOG_INFO, "using '%s' as X11 display device (from XDG_VTNR)", x11_display_device); + } } uid = _util_name_to_uid (user, NULL); @@ -421,6 +431,7 @@ pam_sm_open_session (pam_handle_t *pamh, out: free (ttybuf); + free (xdd); return ret; } |