1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

s3:tests: Reformat test_close_denied_share.sh

shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andreas Schneider 2022-04-22 15:34:08 +02:00 committed by Andrew Bartlett
parent 9d32559fb1
commit 0d29cbf041

View File

@ -5,9 +5,9 @@
# Copyright (C) 2020 Volker Lendecke # Copyright (C) 2020 Volker Lendecke
if [ $# -lt 6 ]; then if [ $# -lt 6 ]; then
echo Usage: test_close_denied_share.sh \ echo Usage: test_close_denied_share.sh \
SERVERCONFFILE SHARESEC SMBCLIENT SMBCONTROL IP SHARE SERVERCONFFILE SHARESEC SMBCLIENT SMBCONTROL IP SHARE
exit 1 exit 1
fi fi
CONF=$1 CONF=$1
@ -27,51 +27,52 @@ cd $SELFTEST_TMPDIR || exit 1
rm -f smbclient-stdin smbclient-stdout rm -f smbclient-stdin smbclient-stdout
mkfifo smbclient-stdin smbclient-stdout mkfifo smbclient-stdin smbclient-stdout
CLI_FORCE_INTERACTIVE=1; export CLI_FORCE_INTERACTIVE CLI_FORCE_INTERACTIVE=1
export CLI_FORCE_INTERACTIVE
${SMBCLIENT} //${SERVER}/${SHARE} ${CONF} -U${USER}%${PASSWORD} \ ${SMBCLIENT} //${SERVER}/${SHARE} ${CONF} -U${USER}%${PASSWORD} \
< smbclient-stdin > smbclient-stdout & <smbclient-stdin >smbclient-stdout &
CLIENT_PID=$! CLIENT_PID=$!
sleep 1 sleep 1
exec 100>smbclient-stdin 101<smbclient-stdout exec 100>smbclient-stdin 101<smbclient-stdout
# consume the smbclient startup message # consume the smbclient startup message
head -n 1 <&101 head -n 1 <&101
testit "smbcontrol" ${SMBCONTROL} ${CONF} smbd close-denied-share ${SHARE} || testit "smbcontrol" ${SMBCONTROL} ${CONF} smbd close-denied-share ${SHARE} ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
sleep 1 sleep 1
echo dir >&100 echo dir >&100
COUNT=$(head -n 2 <&101 | COUNT=$(head -n 2 <&101 |
grep NT_STATUS_NETWORK_NAME_DELETED | grep NT_STATUS_NETWORK_NAME_DELETED |
wc -l) wc -l)
testit "Verify close-denied-share did not kill valid client" \ testit "Verify close-denied-share did not kill valid client" \
test $COUNT -eq 0 || failed=$(expr $failed + 1) test $COUNT -eq 0 || failed=$(expr $failed + 1)
testit "Deny access" ${SHARESEC} ${CONF} --replace S-1-1-0:DENIED/0x0/FULL \ testit "Deny access" ${SHARESEC} ${CONF} --replace S-1-1-0:DENIED/0x0/FULL \
${SHARE} || failed=$(expr $failed + 1) ${SHARE} || failed=$(expr $failed + 1)
testit "smbcontrol" ${SMBCONTROL} ${CONF} smbd close-denied-share ${SHARE} || testit "smbcontrol" ${SMBCONTROL} ${CONF} smbd close-denied-share ${SHARE} ||
failed=$(expr $failed + 1) failed=$(expr $failed + 1)
sleep 1 sleep 1
echo dir >&100 echo dir >&100
COUNT=$(head -n 2 <&101 | COUNT=$(head -n 2 <&101 |
grep NT_STATUS_NETWORK_NAME_DELETED | grep NT_STATUS_NETWORK_NAME_DELETED |
wc -l) wc -l)
testit "Verify close-denied-share did kill now-invalid client" \ testit "Verify close-denied-share did kill now-invalid client" \
test $COUNT -eq 1 || failed=$(expr $failed + 1) test $COUNT -eq 1 || failed=$(expr $failed + 1)
kill ${CLIENT_PID} kill ${CLIENT_PID}
rm -f smbclient-stdin smbclient-stdout rm -f smbclient-stdin smbclient-stdout
testit "Allow access" ${SHARESEC} ${CONF} --replace S-1-1-0:ALLOWED/0x0/FULL \ testit "Allow access" ${SHARESEC} ${CONF} --replace S-1-1-0:ALLOWED/0x0/FULL \
${SHARE} || failed=$(expr $failed + 1) ${SHARE} || failed=$(expr $failed + 1)
testok $0 $failed testok $0 $failed