1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

s3:tests: Reformat test_net_rpc_share_allowedusers.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:09 +02:00 committed by Andreas Schneider
parent 7a916f886f
commit 6170f97bb1

View File

@ -1,10 +1,10 @@
#!/bin/sh #!/bin/sh
if [ $# -lt 4 ]; then if [ $# -lt 4 ]; then
cat <<EOF cat <<EOF
Usage: test_net_rpc_share_allowedusers.sh SERVER USERNAME PASSWORD PREFIX Usage: test_net_rpc_share_allowedusers.sh SERVER USERNAME PASSWORD PREFIX
EOF EOF
exit 1; exit 1
fi fi
SERVER="$1" SERVER="$1"
@ -14,18 +14,18 @@ PREFIX="$4"
shift 4 shift 4
ADDARGS="$*" ADDARGS="$*"
incdir=`dirname $0`/../../../testprogs/blackbox incdir=$(dirname $0)/../../../testprogs/blackbox
. $incdir/subunit.sh . $incdir/subunit.sh
mkdir -p $PREFIX/private mkdir -p $PREFIX/private
net=$BINDIR/net net=$BINDIR/net
# Check for the SID for group "Everyone" as a basic test things are working. # Check for the SID for group "Everyone" as a basic test things are working.
testit_grep "net_usersidlist" '^ S-1-1-0$' $VALGRIND $net usersidlist $ADDARGS || failed=`expr $failed + 1` testit_grep "net_usersidlist" '^ S-1-1-0$' $VALGRIND $net usersidlist $ADDARGS || failed=$(expr $failed + 1)
# Check "print$" share is listed by default. # Check "print$" share is listed by default.
testit_grep "net_rpc_share_allowedusers" '^print\$$' $net usersidlist | $VALGRIND $net rpc share allowedusers -S$SERVER -U$USERNAME%$PASSWORD $ADDARGS || failed=`expr $failed + 1` testit_grep "net_rpc_share_allowedusers" '^print\$$' $net usersidlist | $VALGRIND $net rpc share allowedusers -S$SERVER -U$USERNAME%$PASSWORD $ADDARGS || failed=$(expr $failed + 1)
# Check "print$" share is listed if we ask for it. # Check "print$" share is listed if we ask for it.
testit_grep "net_rpc_share_allowedusers" '^print\$$' $net usersidlist | $VALGRIND $net rpc share allowedusers -S$SERVER -U$USERNAME%$PASSWORD $ADDARGS - 'print$' || failed=`expr $failed + 1` testit_grep "net_rpc_share_allowedusers" '^print\$$' $net usersidlist | $VALGRIND $net rpc share allowedusers -S$SERVER -U$USERNAME%$PASSWORD $ADDARGS - 'print$' || failed=$(expr $failed + 1)
# Check user "user1" is allowed to read share "tmp". # Check user "user1" is allowed to read share "tmp".
testit_grep "net_rpc_share_allowedusers" '^ user1$' $net usersidlist | $VALGRIND $net rpc share allowedusers -S$SERVER -U$USERNAME%$PASSWORD $ADDARGS || failed=`expr $failed + 1` testit_grep "net_rpc_share_allowedusers" '^ user1$' $net usersidlist | $VALGRIND $net rpc share allowedusers -S$SERVER -U$USERNAME%$PASSWORD $ADDARGS || failed=$(expr $failed + 1)
# #
# Subtle extra test for bug https://bugzilla.samba.org/show_bug.cgi?id=13992 # Subtle extra test for bug https://bugzilla.samba.org/show_bug.cgi?id=13992
# #
@ -36,14 +36,13 @@ testit_grep "net_rpc_share_allowedusers" '^ user1$' $net usersidlist | $VALGRIND
# user1 to read from it. # user1 to read from it.
# #
subunit_start_test "net_rpc_share_allowedusers" subunit_start_test "net_rpc_share_allowedusers"
multi_userout=`$net usersidlist | $VALGRIND $net rpc share allowedusers -S$SERVER -U$USERNAME%$PASSWORD $ADDARGS` multi_userout=$($net usersidlist | $VALGRIND $net rpc share allowedusers -S$SERVER -U$USERNAME%$PASSWORD $ADDARGS)
num_matches=`echo "$multi_userout" | grep -c '^ user1$'` num_matches=$(echo "$multi_userout" | grep -c '^ user1$')
if [ "$num_matches" -gt "1" ] if [ "$num_matches" -gt "1" ]; then
then
subunit_pass_test "net_rpc_share_allowedusers" subunit_pass_test "net_rpc_share_allowedusers"
else else
echo "net_rpc_share_allowedusers only found $num_matches shares readable by user1. Should be greater than one.\n" echo "net_rpc_share_allowedusers only found $num_matches shares readable by user1. Should be greater than one.\n"
failed=`expr $failed + 1` failed=$(expr $failed + 1)
echo "$multi_userout" | subunit_fail_test "net_rpc_share_allowedusers" echo "$multi_userout" | subunit_fail_test "net_rpc_share_allowedusers"
fi fi