1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-04 05:18:06 +03:00
samba-mirror/source3/script/tests/test_force_user_unlink.sh
Ralph Boehme aa1f09cda0 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>
2021-01-26 02:55:28 +00:00

41 lines
1.2 KiB
Bash
Executable File

#!/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