1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-28 03:25:27 +03:00

pam: rename 'no-session' to 'user' cgroup

This commit is contained in:
Lennart Poettering 2010-11-14 21:59:25 +01:00
parent 57339f47f1
commit 824a1d590a
2 changed files with 12 additions and 12 deletions

View File

@ -92,7 +92,7 @@
<listitem><para>If <listitem><para>If
<option>create-session=0</option> is set, a new <option>create-session=0</option> is set, a new
control group control group
<filename>/user/$USER/no-session</filename> <filename>/user/$USER/user</filename>
is created and the login process moved into is created and the login process moved into
it.</para></listitem> it.</para></listitem>
@ -115,7 +115,7 @@
remaining processes in the remaining processes in the
<filename>/user/$USER/$XDG_SESSION_ID</filename> <filename>/user/$USER/$XDG_SESSION_ID</filename>
control group are migrated to control group are migrated to
<filename>/user/$USER/no-session</filename> and <filename>/user/$USER/user</filename> and
the original control group is the original control group is
removed.</para></listitem> removed.</para></listitem>
@ -123,7 +123,7 @@
<option>kill-user=1</option> is specified, and <option>kill-user=1</option> is specified, and
no other user session control group remains, no other user session control group remains,
except except
<filename>/user/$USER/no-session</filename>, <filename>/user/$USER/user</filename>,
all remaining processes in the all remaining processes in the
<filename>/user/$USER</filename> hierarchy <filename>/user/$USER</filename> hierarchy
are killed and the control group is removed.</para></listitem> are killed and the control group is removed.</para></listitem>

View File

@ -335,7 +335,7 @@ _public_ PAM_EXTERN int pam_sm_open_session(
r = asprintf(&buf, "/user/%s/%s", username, id); r = asprintf(&buf, "/user/%s/%s", username, id);
} else } else
r = asprintf(&buf, "/user/%s/no-session", username); r = asprintf(&buf, "/user/%s/user", username);
if (r < 0) { if (r < 0) {
r = PAM_BUF_ERR; r = PAM_BUF_ERR;
@ -369,7 +369,7 @@ static int session_remains(pam_handle_t *handle, const char *user_path) {
while ((r = cg_read_subgroup(d, &subgroup)) > 0) { while ((r = cg_read_subgroup(d, &subgroup)) > 0) {
remains = !streq(subgroup, "no-session"); remains = !streq(subgroup, "user");
free(subgroup); free(subgroup);
if (remains) if (remains)
@ -416,7 +416,7 @@ _public_ PAM_EXTERN int pam_sm_close_session(
goto finish; goto finish;
} }
/* We are probably still in some session/no-session dir. Move ourselves out of the way as first step */ /* We are probably still in some session/user dir. Move ourselves out of the way as first step */
if ((r = cg_attach(SYSTEMD_CGROUP_CONTROLLER, "/user", 0)) < 0) if ((r = cg_attach(SYSTEMD_CGROUP_CONTROLLER, "/user", 0)) < 0)
pam_syslog(handle, LOG_ERR, "Failed to move us away: %s", strerror(-r)); pam_syslog(handle, LOG_ERR, "Failed to move us away: %s", strerror(-r));
@ -430,7 +430,7 @@ _public_ PAM_EXTERN int pam_sm_close_session(
if ((id = pam_getenv(handle, "XDG_SESSION_ID")) && created) { if ((id = pam_getenv(handle, "XDG_SESSION_ID")) && created) {
if (asprintf(&session_path, "/user/%s/%s", username, id) < 0 || if (asprintf(&session_path, "/user/%s/%s", username, id) < 0 ||
asprintf(&nosession_path, "/user/%s/no-session", username) < 0) { asprintf(&nosession_path, "/user/%s/user", username) < 0) {
r = PAM_BUF_ERR; r = PAM_BUF_ERR;
goto finish; goto finish;
} }
@ -444,10 +444,10 @@ _public_ PAM_EXTERN int pam_sm_close_session(
} else { } else {
pam_syslog(handle, LOG_INFO, "Moving remaining processes of user session %s of %s into control group %s.", id, username, nosession_path); pam_syslog(handle, LOG_INFO, "Moving remaining processes of user session %s of %s into control group %s.", id, username, nosession_path);
/* Migrate processes from session to /* Migrate processes from session to user
* no-session cgroup. First, try to create the * cgroup. First, try to create the user group
* no-session group in case it doesn't exist * in case it doesn't exist yet. Also, delete
* yet. Also, delete the session group. */ * the session group. */
create_user_group(handle, nosession_path, pw, false, false); create_user_group(handle, nosession_path, pw, false, false);
if ((r = cg_migrate_recursive(SYSTEMD_CGROUP_CONTROLLER, session_path, nosession_path, false, true)) < 0) if ((r = cg_migrate_recursive(SYSTEMD_CGROUP_CONTROLLER, session_path, nosession_path, false, true)) < 0)
@ -464,7 +464,7 @@ _public_ PAM_EXTERN int pam_sm_close_session(
/* Kill user processes not attached to any session */ /* Kill user processes not attached to any session */
if (kill_user && r == 0) { if (kill_user && r == 0) {
/* Kill no-session cgroup */ /* Kill user cgroup */
if ((r = cg_kill_recursive_and_wait(SYSTEMD_CGROUP_CONTROLLER, user_path, true)) < 0) if ((r = cg_kill_recursive_and_wait(SYSTEMD_CGROUP_CONTROLLER, user_path, true)) < 0)
pam_syslog(handle, LOG_ERR, "Failed to kill user cgroup: %s", strerror(-r)); pam_syslog(handle, LOG_ERR, "Failed to kill user cgroup: %s", strerror(-r));
} else { } else {