1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-10 00:58:20 +03:00

pam_systemd: new option for the session class

This commit is contained in:
Matthew Monaco 2012-12-24 06:25:58 -07:00 committed by Lennart Poettering
parent a78a8c4337
commit 485507b8c0
2 changed files with 19 additions and 2 deletions

View File

@ -193,6 +193,15 @@
group.</para></listitem> group.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><option>class=</option></term>
<listitem><para>Takes a string
argument which sets the session class.
The XDG_SESSION_CLASS environmental variable
takes precedence.</para></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option>debug=</option></term> <term><option>debug=</option></term>

View File

@ -49,6 +49,7 @@ static int parse_argv(pam_handle_t *handle,
bool *kill_processes, bool *kill_processes,
char ***kill_only_users, char ***kill_only_users,
char ***kill_exclude_users, char ***kill_exclude_users,
const char **class,
bool *debug) { bool *debug) {
unsigned i; unsigned i;
@ -135,6 +136,11 @@ static int parse_argv(pam_handle_t *handle,
*kill_exclude_users = l; *kill_exclude_users = l;
} }
} else if (startswith(argv[i], "class=")) {
if (class)
*class = argv[i] + 6;
} else if (startswith(argv[i], "debug=")) { } else if (startswith(argv[i], "debug=")) {
if ((k = parse_boolean(argv[i] + 6)) < 0) { if ((k = parse_boolean(argv[i] + 6)) < 0) {
pam_syslog(handle, LOG_ERR, "Failed to parse debug= argument."); pam_syslog(handle, LOG_ERR, "Failed to parse debug= argument.");
@ -322,7 +328,7 @@ _public_ PAM_EXTERN int pam_sm_open_session(
struct passwd *pw; struct passwd *pw;
bool kill_processes = false, debug = false; 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; char **controllers = NULL, **reset_controllers = NULL, **kill_only_users = NULL, **kill_exclude_users = NULL;
DBusError error; DBusError error;
uint32_t uid, pid; uint32_t uid, pid;
@ -349,7 +355,7 @@ _public_ PAM_EXTERN int pam_sm_open_session(
argc, argv, argc, argv,
&controllers, &reset_controllers, &controllers, &reset_controllers,
&kill_processes, &kill_only_users, &kill_exclude_users, &kill_processes, &kill_only_users, &kill_exclude_users,
&debug) < 0) { &class_pam, &debug) < 0) {
r = PAM_SESSION_ERR; r = PAM_SESSION_ERR;
goto finish; goto finish;
} }
@ -484,6 +490,8 @@ _public_ PAM_EXTERN int pam_sm_open_session(
class = pam_getenv(handle, "XDG_SESSION_CLASS"); class = pam_getenv(handle, "XDG_SESSION_CLASS");
if (isempty(class)) if (isempty(class))
class = getenv("XDG_SESSION_CLASS"); class = getenv("XDG_SESSION_CLASS");
if (isempty(class))
class = class_pam;
if (isempty(class)) if (isempty(class))
class = "user"; class = "user";