summaryrefslogtreecommitdiffstats
path: root/test/units/testsuite-22.16.sh
blob: 555e07fec7532243af332eb1dfd92b639fc59781 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# Test for conditionalized execute bit ('X' bit)
set -eux
set -o pipefail

# shellcheck source=test/units/util.sh
. "$(dirname "$0")"/util.sh

rm -f /tmp/acl_exec
touch /tmp/acl_exec

# No ACL set yet
systemd-tmpfiles --create - <<EOF
a /tmp/acl_exec - - - - u:root:rwX
EOF
assert_in 'user:root:rw-' "$(getfacl -Ec /tmp/acl_exec)"

# Set another ACL and append
setfacl -m g:root:x /tmp/acl_exec

systemd-tmpfiles --create - <<EOF
a+ /tmp/acl_exec - - - - u:root:rwX
EOF
acl="$(getfacl -Ec /tmp/acl_exec)"
assert_in 'user:root:rwx' "$acl"
assert_in 'group:root:--x' "$acl"

# Reset ACL (no append)
systemd-tmpfiles --create - <<EOF
a /tmp/acl_exec - - - - u:root:rwX
EOF
assert_in 'user:root:rw-' "$(getfacl -Ec /tmp/acl_exec)"

rm -f /tmp/acl_exec