# Description: Add "nox11" option to the PAM module, which 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. # Upstream: https://bugs.freedesktop.org/show_bug.cgi?id=16746 Index: consolekit-0.2.10/pam-ck-connector/pam-ck-connector.c =================================================================== --- consolekit-0.2.10.orig/pam-ck-connector/pam-ck-connector.c 2008-08-04 18:23:37.000000000 +0200 +++ consolekit-0.2.10/pam-ck-connector/pam-ck-connector.c 2008-08-04 18:23:49.000000000 +0200 @@ -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 @@ 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 @@ 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) { Index: consolekit-0.2.10/pam-ck-connector/pam_ck_connector.8 =================================================================== --- consolekit-0.2.10.orig/pam-ck-connector/pam_ck_connector.8 2008-08-04 18:23:44.000000000 +0200 +++ consolekit-0.2.10/pam-ck-connector/pam_ck_connector.8 2008-08-04 18:23:49.000000000 +0200 @@ -66,6 +66,10 @@ .TP 3n \fBdebug\fR Print debug information. +.TP 3n +\fBnox11\fR +Do not create a session if PAM specifies an X11 display instead of a +/dev/tty terminal. .fi .RE .sp