mirror of
https://github.com/samba-team/samba.git
synced 2025-11-30 20:23:49 +03:00
selftest: add a test that verifies unlink works when "force user" is set
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14617 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
committed by
Jeremy Allison
parent
f3f8fdfbf1
commit
aa1f09cda0
40
source3/script/tests/test_force_user_unlink.sh
Executable file
40
source3/script/tests/test_force_user_unlink.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Test unlink on share with "force user"
|
||||
#
|
||||
# Copyright (C) 2021 Ralph Boehme
|
||||
|
||||
incdir=$(dirname $0)/../../../testprogs/blackbox
|
||||
. $incdir/subunit.sh
|
||||
. $incdir/common_test_fns.inc
|
||||
|
||||
smbclient="$BINDIR/smbclient"
|
||||
error_inject_conf=$(dirname ${SMB_CONF_PATH})/error_inject.conf
|
||||
failed=0
|
||||
|
||||
test_forced_user_can_delete() {
|
||||
out=$($smbclient -U $DOMAIN/$USERNAME%$PASSWORD //$SERVER_IP/force_user_error_inject -c "rm dir/file")
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo $out
|
||||
return 1
|
||||
fi
|
||||
tmp=$(echo $out | grep NT_STATUS_ )
|
||||
if [ $? -eq 0 ] ; then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
echo "error_inject:unlinkat = EACCES" > ${error_inject_conf}
|
||||
|
||||
$smbclient -U $DOMAIN/$USERNAME%$PASSWORD //$SERVER_IP/force_user_error_inject -c "mkdir dir" || failed=`expr $failed + 1`
|
||||
$smbclient -U $DOMAIN/$USERNAME%$PASSWORD //$SERVER_IP/force_user_error_inject -c "put WHATSNEW.txt dir/file" || failed=`expr $failed + 1`
|
||||
|
||||
testit "test_forced_user_can_delete" test_forced_user_can_delete || failed=`expr $failed + 1`
|
||||
|
||||
rm ${error_inject_conf}
|
||||
|
||||
# Clean up after ourselves.
|
||||
$smbclient -U $DOMAIN/$USERNAME%$PASSWORD //$SERVER_IP/force_user_error_inject -c "del dir/file; rmdir dir"
|
||||
|
||||
testok $0 $failed
|
||||
Reference in New Issue
Block a user