1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
samba-mirror/source3/script/tests/test_shareenum.sh
Andreas Schneider a4ff172fee s3:tests: Reformat test_shareenum.sh
shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2022-06-10 13:53:37 +00:00

32 lines
777 B
Bash
Executable File

#!/bin/sh
# this tests share enumeration with "access based share enum"
if [ $# -lt 4 ]; then
cat <<EOF
Usage: $0 SERVER USERNAME PASSWORD RPCCLIENT
EOF
exit 1
fi
SERVER="$1"
USERNAME="$2"
PASSWORD="$3"
RPCCLIENT="$4"
RPCCLIENT="$VALGRIND ${RPCCLIENT}"
incdir=$(dirname $0)/../../../testprogs/blackbox
. $incdir/subunit.sh
user_see_share()
{
local user=$1
local share=$2
$RPCCLIENT //$SERVER -U$user%$PASSWORD -c "netshareenumall" | grep $share >/dev/null 2>&1
}
testit "$USERNAME sees tmp" user_see_share $USERNAME tmp
testit "$USERNAME sees valid-users-tmp" user_see_share $USERNAME valid-users-tmp
testit "force_user sees tmp" user_see_share force_user tmp
testit_expect_failure "force_user does not see valid-users-tmp" user_see_share force_user valid-users-tmp