summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-11-12 13:41:59 +0100
committerLennart Poettering <lennart@poettering.net>2021-11-12 16:02:26 +0100
commit875afa02fabe1dad5aa3d1e9bff89d493a369fd0 (patch)
treedc8a3150af01a5917739b5a758d3148309b6fc46
parentnamespace: make tmp dir handling code independent of umask too (diff)
downloadsystemd-875afa02fabe1dad5aa3d1e9bff89d493a369fd0.tar.xz
systemd-875afa02fabe1dad5aa3d1e9bff89d493a369fd0.zip
tests: add test case for UMask=+BindPaths= combination
Inspired by the test case described in #19899
-rw-r--r--src/test/test-execute.c5
-rw-r--r--test/test-execute/exec-umask-namespace.service12
2 files changed, 17 insertions, 0 deletions
diff --git a/src/test/test-execute.c b/src/test/test-execute.c
index c81842a0d0..5818adbb55 100644
--- a/src/test/test-execute.c
+++ b/src/test/test-execute.c
@@ -1109,6 +1109,10 @@ static void test_exec_condition(Manager *m) {
test_service(m, "exec-condition-skip.service", SERVICE_SKIP_CONDITION);
}
+static void test_exec_umask_namespace(Manager *m) {
+ test(m, "exec-umask-namespace.service", can_unshare ? 0 : EXIT_NAMESPACE, CLD_EXITED);
+}
+
typedef struct test_entry {
test_function_t f;
const char *name;
@@ -1191,6 +1195,7 @@ int main(int argc, char *argv[]) {
entry(test_exec_specifier),
entry(test_exec_execsearchpath_specifier),
entry(test_exec_systemcallfilter_system),
+ entry(test_exec_umask_namespace),
{},
};
int r;
diff --git a/test/test-execute/exec-umask-namespace.service b/test/test-execute/exec-umask-namespace.service
new file mode 100644
index 0000000000..8419c86c9a
--- /dev/null
+++ b/test/test-execute/exec-umask-namespace.service
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Unit]
+Description=Test for UMask= + namespacing
+
+[Service]
+ExecStart=/bin/ls -lahd /tmp/subdir
+Type=oneshot
+User=65534
+Group=65534
+TemporaryFileSystem=/tmp:ro
+BindPaths=/etc:/tmp/subdir/subsub
+UMask=0007