X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Fpam-module.c;h=702095e5e677aec9ab3352ec0f808c3c461222bd;hb=c784c5ce777f16ee56086a072dc1466639bc9eff;hp=e6764a197affbb34cf1cc03eb9eb140f943400d0;hpb=0ad1271f564b9c956685938167f7ea8c301e835e;p=elogind.git diff --git a/src/login/pam-module.c b/src/login/pam-module.c index e6764a197..702095e5e 100644 --- a/src/login/pam-module.c +++ b/src/login/pam-module.c @@ -41,6 +41,7 @@ #include "dbus-common.h" #include "def.h" #include "socket-util.h" +#include "fileio.h" static int parse_argv(pam_handle_t *handle, int argc, const char **argv, @@ -49,6 +50,7 @@ static int parse_argv(pam_handle_t *handle, bool *kill_processes, char ***kill_only_users, char ***kill_exclude_users, + const char **class, bool *debug) { unsigned i; @@ -135,6 +137,11 @@ static int parse_argv(pam_handle_t *handle, *kill_exclude_users = l; } + } else if (startswith(argv[i], "class=")) { + + if (class) + *class = argv[i] + 6; + } else if (startswith(argv[i], "debug=")) { if ((k = parse_boolean(argv[i] + 6)) < 0) { pam_syslog(handle, LOG_ERR, "Failed to parse debug= argument."); @@ -322,7 +329,7 @@ _public_ PAM_EXTERN int pam_sm_open_session( struct passwd *pw; bool kill_processes = false, debug = false; - const char *username, *id, *object_path, *runtime_path, *service = NULL, *tty = NULL, *display = NULL, *remote_user = NULL, *remote_host = NULL, *seat = NULL, *type = NULL, *class, *cvtnr = NULL; + const char *username, *id, *object_path, *runtime_path, *service = NULL, *tty = NULL, *display = NULL, *remote_user = NULL, *remote_host = NULL, *seat = NULL, *type = NULL, *class = NULL, *class_pam = NULL, *cvtnr = NULL; char **controllers = NULL, **reset_controllers = NULL, **kill_only_users = NULL, **kill_exclude_users = NULL; DBusError error; uint32_t uid, pid; @@ -349,7 +356,7 @@ _public_ PAM_EXTERN int pam_sm_open_session( argc, argv, &controllers, &reset_controllers, &kill_processes, &kill_only_users, &kill_exclude_users, - &debug) < 0) { + &class_pam, &debug) < 0) { r = PAM_SESSION_ERR; goto finish; } @@ -484,6 +491,8 @@ _public_ PAM_EXTERN int pam_sm_open_session( class = pam_getenv(handle, "XDG_SESSION_CLASS"); if (isempty(class)) class = getenv("XDG_SESSION_CLASS"); + if (isempty(class)) + class = class_pam; if (isempty(class)) class = "user";