Merge pull request #510 from smcv/etc-shadow

Adjust tests related to /etc/shadow
This commit is contained in:
Simon McVittie
2022-07-26 19:54:46 +01:00
committed by GitHub

View File

@@ -39,9 +39,16 @@ for ALT in "" "--unshare-user-try" "--unshare-pid" "--unshare-user-try --unshare
CAP=""
fi
if ! ${is_uidzero} && $RUN $CAP $ALT --unshare-net --proc /proc --bind /etc/shadow /tmp/foo cat /etc/shadow; then
if ! cat /etc/shadow >/dev/null &&
$RUN $CAP $ALT --unshare-net --proc /proc --bind /etc/shadow /tmp/foo cat /tmp/foo; then
assert_not_reached Could read /etc/shadow via /tmp/foo bind-mount
fi
if ! cat /etc/shadow >/dev/null &&
$RUN $CAP $ALT --unshare-net --proc /proc --bind /etc/shadow /tmp/foo cat /etc/shadow; then
assert_not_reached Could read /etc/shadow
fi
echo "ok - cannot read /etc/shadow with $ALT"
# Unreadable dir
if [ "x$UNREADABLE" != "x" ]; then