chiark / gitweb /
logind: add support for /run/nologin and /run/systemd/shutdown/scheduled
[elogind.git] / src / login / logind-user.c
index 539c316ad665cc8f6ec164872cb0c7773498d3ef..3e1c75ef832e63114cd84c49f92ecdd6c6b3d659 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "util.h"
 #include "mkdir.h"
+#include "rm-rf.h"
 #include "hashmap.h"
 #include "fileio.h"
 #include "path-util.h"
@@ -37,6 +38,7 @@
 #include "clean-ipc.h"
 #include "logind-user.h"
 #include "smack-util.h"
+#include "formats-util.h"
 
 User* user_new(Manager *m, uid_t uid, gid_t gid, const char *name) {
         User *u;
@@ -374,7 +376,7 @@ static int user_remove_runtime_path(User *u) {
         if (!u->runtime_path)
                 return 0;
 
-        r = rm_rf(u->runtime_path, false, false, false);
+        r = rm_rf(u->runtime_path, 0);
         if (r < 0)
                 log_error_errno(r, "Failed to remove runtime directory %s: %m", u->runtime_path);
 
@@ -385,7 +387,7 @@ static int user_remove_runtime_path(User *u) {
         if (r < 0 && errno != EINVAL && errno != ENOENT)
                 log_error_errno(errno, "Failed to unmount user runtime directory %s: %m", u->runtime_path);
 
-        r = rm_rf(u->runtime_path, false, true, false);
+        r = rm_rf(u->runtime_path, REMOVE_ROOT);
         if (r < 0)
                 log_error_errno(r, "Failed to remove runtime directory %s: %m", u->runtime_path);
 
@@ -562,10 +564,18 @@ UserState user_get_state(User *u) {
 }
 
 int user_kill(User *u, int signo) {
+        Session *s;
+        int res = 0;
+
         assert(u);
 
-        /* FIXME: No way to kill a user without systemd.  */
-        return -ESRCH;
+        LIST_FOREACH(sessions_by_user, s, u->sessions) {
+                int r = session_kill(s, KILL_ALL, signo);
+                if (res == 0 && r < 0)
+                        res = r;
+        }
+
+        return res;
 }
 
 void user_elect_display(User *u) {