1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00
samba-mirror/source3/script/tests/test_rpcclient_pw_nt_hash.sh
SATOH Fumiyasu de009c194c tests: Replace iconv(1) UTF-16LE conversion with a python3 call
GNU libiconv and its iconv(1) do NOT define 'utf16le' as
an alias of 'UTF-16LE' encoding.

Signed-off-by: SATOH Fumiyasu <fumiyas@osstech.co.jp>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-05-19 00:29:33 +00:00

28 lines
703 B
Bash
Executable File

#!/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