summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorSven Eden <yamakuzure@gmx.net>2018-08-29 08:33:39 +0200
committerSven Eden <yamakuzure@gmx.net>2018-08-29 08:33:39 +0200
commit40f140beb3f640c0fa6674478f990d57d10704b4 (patch)
tree38ef8b6aa953a7af15a30bc3d58a9939a0074f89 /src/login
parent9d94b159df3dd88e2dde006d5d240ce80df068e6 (diff)
Prep v239: Utilize new user_runtime_dir() function
Diffstat (limited to 'src/login')
-rw-r--r--src/login/logind-user.c54
-rw-r--r--src/login/logind.c2
2 files changed, 38 insertions, 18 deletions
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index 2d27dc8dc..38a15b224 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -1,34 +1,36 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
+//#include <errno.h>
+//#include <string.h>
+//#include <unistd.h>
#include <stdio_ext.h>
#include "alloc-util.h"
-#include "bus-common-errors.h"
-#include "bus-error.h"
-#include "bus-util.h"
-#include "cgroup-util.h"
+//#include "bus-common-errors.h"
+//#include "bus-error.h"
+//#include "bus-util.h"
+//#include "cgroup-util.h"
#include "clean-ipc.h"
#include "escape.h"
#include "fd-util.h"
#include "fileio.h"
-#include "format-util.h"
-#include "fs-util.h"
-#include "hashmap.h"
-#include "label.h"
-#include "logind-user.h"
+//#include "format-util.h"
+//#include "fs-util.h"
+//#include "hashmap.h"
+//#include "label.h"
+//#include "logind-user.h"
#include "mkdir.h"
-#include "parse-util.h"
-#include "path-util.h"
-#include "rm-rf.h"
+//#include "parse-util.h"
+//#include "path-util.h"
+//#include "rm-rf.h"
#include "special.h"
#include "stdio-util.h"
#include "string-table.h"
#include "unit-name.h"
#include "user-util.h"
-#include "util.h"
+//#include "util.h"
+/// Additional includes needed by elogind
+#include "user-runtime-dir.h"
int user_new(User **out, Manager *m, uid_t uid, gid_t gid, const char *name) {
_cleanup_(user_freep) User *u = NULL;
@@ -368,8 +370,17 @@ int user_start(User *u) {
*/
u->stopping = false;
+#if 0 /// elogind has to prepare the XDG_RUNTIME_DIR by itself
if (!u->started)
log_debug("Starting services for new user %s.", u->name);
+#else
+ if (!u->started) {
+ log_debug("Starting services for new user %s.", u->name);
+ r = user_runtime_dir("start", u);
+ if (r < 0)
+ return r;
+ }
+#endif // 1
/* Save the user data so far, because pam_systemd will read the
* XDG_RUNTIME_DIR out of it while starting up systemd --user.
@@ -441,6 +452,9 @@ int user_stop(User *u, bool force) {
/* Stop jobs have already been queued */
if (u->stopping) {
user_save(u);
+#if 1 /// elogind must queue this user again
+ user_add_to_gc_queue(u);
+#endif // 1
return r;
}
@@ -469,6 +483,7 @@ int user_stop(User *u, bool force) {
#if 1 /// elogind must queue this user again
user_add_to_gc_queue(u);
#endif // 1
+
return r;
}
@@ -487,6 +502,13 @@ int user_finalize(User *u) {
r = k;
}
+#if 1 /// elogind has to remove the XDG_RUNTIME_DIR by itself
+ /* Kill XDG_RUNTIME_DIR */
+ k = user_runtime_dir("stop", u);
+ if (k < 0)
+ r = k;
+#endif // 1
+
/* Clean SysV + POSIX IPC objects, but only if this is not a system user. Background: in many setups cronjobs
* are run in full PAM and thus logind sessions, even if the code run doesn't belong to actual users but to
* system components. Since enable RemoveIPC= globally for all users, we need to be a bit careful with such
diff --git a/src/login/logind.c b/src/login/logind.c
index d87c38181..db26701dd 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -39,8 +39,6 @@
static Manager* manager_unref(Manager *m);
DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_unref);
-#if 0 /// elogind does not support autospawning of vts
-#endif // 0
static int manager_new(Manager **ret) {
_cleanup_(manager_unrefp) Manager *m = NULL;
int r;