From a00c329d81be8691e13915ed36f5053bd0f820f3 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 11 Feb 2009 16:30:34 -0500 Subject: add "nox11" option to the PAM module Ignores PAM sessions where PAM_TTY is an X11 display. This allows adding pam_ck_connector to PAM's "common-session" without interfering with the already existing ConsoleKit operations in gdm, the Xsession script, etc. https://bugs.freedesktop.org/show_bug.cgi?id=16746 --- pam-ck-connector/pam-ck-connector.c | 7 +++++++ 1 file changed, 7 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 4203651..091f4b2 100644 --- a/pam-ck-connector/pam-ck-connector.c +++ b/pam-ck-connector/pam-ck-connector.c @@ -63,6 +63,7 @@ #include "ck-connector.h" static int opt_debug = FALSE; +static int opt_nox11 = FALSE; #ifndef HAVE_PAM_SYSLOG @@ -145,6 +146,8 @@ _parse_pam_args (const pam_handle_t *pamh, for (i = 0; i < argc && argv[i] != NULL; i++) { if (strcmp (argv[i] , "debug") == 0) { opt_debug = TRUE; + } else if (strcmp (argv[i] , "nox11") == 0) { + opt_nox11 = TRUE; } else { ck_pam_syslog (pamh, LOG_ERR, "unknown option: %s", argv[i]); } @@ -276,6 +279,10 @@ pam_sm_open_session (pam_handle_t *pamh, x11_display = NULL; /* interpret any tty with a colon as a DISPLAY */ if (strchr (display_device, ':') != NULL) { + if (opt_nox11) { + ck_pam_syslog (pamh, LOG_WARNING, "nox11 mode, ignoring PAM_TTY %s", display_device); + goto out; + } x11_display = display_device; display_device = ""; } else if (strncmp (_PATH_DEV, display_device, 5) != 0) { -- cgit