1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-06 13:18:07 +03:00
samba-mirror/source3/script/tests/test_net_cache_samlogon.sh
Andreas Schneider 41661b779b s3:tests: Reformat test_net_cache_samlogon.sh
shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2022-06-07 08:22:28 +00:00

44 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
#
# Test 'net cache samlogon' command.
#
if [ $# -lt 4 ]; then
cat <<EOF
Usage: $0 SERVER SHARE USER PASS
EOF
exit 1
fi
SERVER=$1
SHARE=$2
USER=$3
PASS=$4
smbclient=$BINDIR/smbclient
failed=0
incdir=$(dirname $0)/../../../testprogs/blackbox
. $incdir/subunit.sh
. $incdir/common_test_fns.inc
# Ensure the samlogon cache is primed
test_smbclient "Prime samlogon cache" 'exit' //$SERVER/$SHARE -U$USER%$PASS || failed=$(expr $failed + 1)
# Ensure list works and remember the sid and name of the first entry
testit "net cache samlogon list" $BINDIR/net cache samlogon list || failed=$(expr $failed + 1)
usersid=$($BINDIR/net cache samlogon list | awk '/^S-/ { print $1 ; exit }')
username=$($BINDIR/net cache samlogon list | awk '/^S-/ { print $2 ; exit }')
# Test the show command with the sid from the previous list command
testit "net cache samlogon show $usersid" $BINDIR/net cache samlogon show $usersid || failed=$(expr $failed + 1)
tmp=$($BINDIR/net cache samlogon show $usersid | awk '/^Name:/ {print $2}')
testit "net cache samlogon show SID name matches name from list command" test x"$tmp" = x"$username" || failed=$(expr $failed + 1)
testit "net cache samlogon ndrdump $usersid" $BINDIR/net cache samlogon ndrdump $usersid || failed=$(expr $failed + 1)
tmp=$($BINDIR/net cache samlogon ndrdump $usersid | head -n 1 | grep "netr_SamInfo3: struct netr_SamInfo3")
retval=$?
testit "net cache samlogon ndrdump returns netr_SamInfo3 structure" test $retval -eq 0 || failed=$(expr $failed + 1)
testok $0 $failed