diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:20:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:20:00 +0000 |
commit | 8daa83a594a2e98f39d764422bfbdbc62c9efd44 (patch) | |
tree | 4099e8021376c7d8c05bdf8503093d80e9c7bad0 /source3/script/tests/test_sacl_set_get.sh | |
parent | Initial commit. (diff) | |
download | samba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.tar.xz samba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.zip |
Adding upstream version 2:4.20.0+dfsg.upstream/2%4.20.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | source3/script/tests/test_sacl_set_get.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/source3/script/tests/test_sacl_set_get.sh b/source3/script/tests/test_sacl_set_get.sh new file mode 100755 index 0000000..1c78ab2 --- /dev/null +++ b/source3/script/tests/test_sacl_set_get.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# +# Runs the smbtorture3 SMB2-SACL test +# that requires SeSecurityPrivilege +# against Samba. +# + +if [ $# -lt 7 ]; then + echo "Usage: $0 SERVER SERVER_IP USERNAME PASSWORD SMBTORTURE3 NET SHARE" + exit 1 +fi + +SERVER="$1" +SERVER_IP="$2" +USERNAME="$3" +PASSWORD="$4" +SMBTORTURE3="$5" +NET="$6" +SHARE="$7" + +failed=0 + +incdir=$(dirname $0)/../../../testprogs/blackbox +. $incdir/subunit.sh + +sacl_set_get() +{ + out=$($SMBTORTURE3 //$SERVER_IP/$SHARE -U $USERNAME%$PASSWORD SMB2-SACL) + if [ $? -ne 0 ]; then + echo "SMB2-SACL failed" + echo "$out" + return 1 + fi +} + +# Grant SeSecurityPrivilege to the user +testit "grant SeSecurityPrivilege" $NET rpc rights grant $USERNAME SeSecurityPrivilege -U $USERNAME%$PASSWORD -I $SERVER_IP || failed=$(expr $failed + 1) + +# Run the tests. +testit "SACL set_get" sacl_set_get || failed=$(expr $failed + 1) + +# Revoke SeSecurityPrivilege +testit "revoke SeSecurityPrivilege" $NET rpc rights revoke $USERNAME SeSecurityPrivilege -U $USERNAME%$PASSWORD -I $SERVER_IP || failed=$(expr $failed + 1) + +exit $failed |