summaryrefslogtreecommitdiff
path: root/src/shared/clean-ipc.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-08-01 19:24:40 +0200
committerSven Eden <yamakuzure@gmx.net>2017-07-05 08:50:49 +0200
commit67ace99e48cdf843aa0d1cd80a4e080f5c6eb320 (patch)
tree328bcb2bd85261296c17bcc92df1ce750781a6e8 /src/shared/clean-ipc.h
parent1968f82f3d0a48bcd978b17ef48df906ecdf8074 (diff)
core: add RemoveIPC= setting
This adds the boolean RemoveIPC= setting to service, socket, mount and swap units (i.e. all unit types that may invoke processes). if turned on, and the unit's user/group is not root, all IPC objects of the user/group are removed when the service is shut down. The life-cycle of the IPC objects is hence bound to the unit life-cycle. This is particularly relevant for units with dynamic users, as it is essential that no objects owned by the dynamic users survive the service exiting. In fact, this patch adds code to imply RemoveIPC= if DynamicUser= is set. In order to communicate the UID/GID of an executed process back to PID 1 this adds a new "user lookup" socket pair, that is inherited into the forked processes, and closed before the exec(). This is needed since we cannot do NSS from PID 1 due to deadlock risks, However need to know the used UID/GID in order to clean up IPC owned by it if the unit shuts down.
Diffstat (limited to 'src/shared/clean-ipc.h')
-rw-r--r--src/shared/clean-ipc.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/shared/clean-ipc.h b/src/shared/clean-ipc.h
index 44a83afcf..6ca57f44f 100644
--- a/src/shared/clean-ipc.h
+++ b/src/shared/clean-ipc.h
@@ -21,4 +21,6 @@
#include <sys/types.h>
-int clean_ipc(uid_t uid);
+int clean_ipc(uid_t uid, gid_t gid);
+int clean_ipc_by_uid(uid_t uid);
+int clean_ipc_by_gid(gid_t gid);