diff options
Diffstat (limited to 'source3/script/tests/test_rpcclient_pw_nt_hash.sh')
-rwxr-xr-x | source3/script/tests/test_rpcclient_pw_nt_hash.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source3/script/tests/test_rpcclient_pw_nt_hash.sh b/source3/script/tests/test_rpcclient_pw_nt_hash.sh new file mode 100755 index 0000000..c1e3660 --- /dev/null +++ b/source3/script/tests/test_rpcclient_pw_nt_hash.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Blackbox tests for the rpcclient --pw-nt-hash option +# + +if [ $# -lt 4 ]; then + cat <<EOF +Usage: test_rpcclient_pw_nt_hash.sh USERNAME PASSWORD SERVER RPCCLIENT +EOF + exit 1 +fi + +USERNAME="$1" +PASSWORD="$2" +SERVER="$3" +RPCCLIENT="$4" + +HASH=$(echo -n $PASSWORD | $PYTHON -c 'import sys, binascii, samba, samba.crypto; sys.stdout.buffer.write(binascii.hexlify(samba.crypto.md4_hash_blob(sys.stdin.buffer.read(1000).decode().encode("UTF-16LE"))))') + +RPCCLIENTCMD="$RPCCLIENT $SERVER --pw-nt-hash -U$USERNAME%$HASH -c queryuser" + +incdir=$(dirname $0)/../../../testprogs/blackbox +. $incdir/subunit.sh + +testit "rpcclient --pw-nt-hash" $RPCCLIENTCMD || failed=$(expr $failed + 1) + +testok $0 $failed |