Skip to content

Commit

Permalink
drop capabilities also in symlink test
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Dreik committed Jan 12, 2025
1 parent 5c586a5 commit 51ee3f1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion testcases/symlinking_action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ echo xxx > $datadir/readonly.d/a
echo xxx > $datadir/readonly.d/b
chmod 500 $datadir/readonly.d/

$rdfind -makesymlinks true $datadir/readonly.d/ 2>&1 |tee rdfind.out
if [ "$(id -u)" -eq 0 ]; then
# if running as root, directory rights are not respected. drop the capability
# for doing that (requires capsh from package libcap2-bin)
MAYBEDROP="capsh --drop=CAP_DAC_OVERRIDE -- -c"
else
MAYBEDROP=/bin/sh
fi
$MAYBEDROP "$rdfind -makesymlinks true $datadir/readonly.d/" 2>&1 |tee rdfind.out
if ! grep -iq "failed" rdfind.out ; then
dbgecho "expected failure when trying to make symlink on readonly directory"
exit 1
Expand Down

0 comments on commit 51ee3f1

Please sign in to comment.