mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: skip any entry with an unknown user
What an unknown user in an entry did depended on the type. A d entry
was skipped, but this one made a file owned by root:
f /run/frr/state 0640 frr frr
The user was looked up in each type on its own, and only d checked
the result.
Look it up once for the entry, and skip the entry when the user is
not known. An unknown group leaves the group of the path as it is,
for a new path that is the group of root, as before. Both are only
reported with --debug, Finit's own files have entries for services
that may not be installed.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
4 files changed
+36
-27
No files matched your search
@@ -39,3 +39,14 @@ assert_perm "d $DIR - bin" 750 bin:daemon
|
||||
assert_perm "d $DIR - - sys" 750 bin:sys
|
||||
assert_perm "e $DIR" 750 bin:sys
|
||||
assert_perm "d $DIR 1777 root root" 1777 root:root
|
||||
|
||||
sep
|
||||
say 'An unknown user skips the entry, an unknown group only the group'
|
||||
run "cat > $CONF" <<CONF
|
||||
d $DIR/user 0755 nosuchuser
|
||||
f $DIR/file 0644 nosuchuser
|
||||
d $DIR/group 0750 bin nosuchgroup
|
||||
CONF
|
||||
run "/libexec/finit/tmpfiles --create $CONF"
|
||||
assert "Only the entry with a known user is created" "$(texec ls $DIR)" = "group"
|
||||
assert "With its mode and user" "$(texec stat -c '%a %U:%G' $DIR/group)" = "750 bin:root"
|
||||
Reference in new issue
Block a user