diff options
author | Jan Synacek <jan.synacek@gmail.com> | 2018-04-17 16:42:44 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-08-24 16:47:08 +0200 |
commit | 8fcb4101a9f969bcfc188a787ad86a0e252c5b9f (patch) | |
tree | 6027e10984d850cc470aabc9226303c5f1b76e77 /src/login/logind-dbus.c | |
parent | a37ab83d0da89ef55905edfe838a5c05891a989f (diff) |
logind: enable limiting of user session scopes using pam context objects (#8397)
Diffstat (limited to 'src/login/logind-dbus.c')
-rw-r--r-- | src/login/logind-dbus.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 6bc76464c..e185c26ff 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -3,19 +3,6 @@ This file is part of systemd. Copyright 2011 Lennart Poettering - - elogind is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - elogind is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with elogind; If not, see <http://www.gnu.org/licenses/>. ***/ #include <errno.h> @@ -760,10 +747,6 @@ static int method_create_session(sd_bus_message *message, void *userdata, sd_bus } } - r = sd_bus_message_enter_container(message, 'a', "(sv)"); - if (r < 0) - return r; - if (t == _SESSION_TYPE_INVALID) { if (!isempty(display)) t = SESSION_X11; @@ -919,7 +902,15 @@ static int method_create_session(sd_bus_message *message, void *userdata, sd_bus goto fail; } - r = session_start(session); + r = sd_bus_message_enter_container(message, 'a', "(sv)"); + if (r < 0) + return r; + + r = session_start(session, message); + if (r < 0) + goto fail; + + r = sd_bus_message_exit_container(message); if (r < 0) goto fail; @@ -3228,7 +3219,7 @@ int manager_start_scope( const char *description, const char *after, const char *after2, - uint64_t tasks_max, + sd_bus_message *more_properties, sd_bus_error *error, char **job) { @@ -3292,9 +3283,17 @@ int manager_start_scope( if (r < 0) return r; - r = sd_bus_message_append(m, "(sv)", "TasksMax", "t", tasks_max); + /* disable TasksMax= for the session scope, rely on the slice setting for it */ + r = sd_bus_message_append(m, "(sv)", "TasksMax", "t", (uint64_t)-1); if (r < 0) - return r; + return bus_log_create_error(r); + + if (more_properties) { + /* If TasksMax also appears here, it will overwrite the default value set above */ + r = sd_bus_message_copy(m, more_properties, true); + if (r < 0) + return r; + } r = sd_bus_message_close_container(m); if (r < 0) |