2020-05-12 01:37:00 +03:00
#!/bin/sh
# This checks directory listing with a file containing
# an invalid CP850 conversion name returns NT_STATUS_INVALID_NETWORK_RESPONSE
if [ $# -lt 6 ] ; then
2022-04-22 16:34:10 +03:00
cat <<EOF
2020-05-12 01:37:00 +03:00
Usage: test_smbclient_iconv.sh SERVER SERVER_IP SHARENAME USERNAME PASSWORD SMBCLIENT
EOF
2022-04-22 16:34:10 +03:00
exit 1
2020-05-12 01:37:00 +03:00
fi
SERVER = " $1 "
SERVER_IP = " $2 "
SHARENAME = " $3 "
USERNAME = " $4 "
PASSWORD = " $5 "
SMBCLIENT = " $6 "
shift 6
ADDARGS = " $@ "
2022-04-22 16:34:10 +03:00
incdir = $( dirname $0 ) /../../../testprogs/blackbox
2020-05-12 01:37:00 +03:00
. $incdir /subunit.sh
failed = 0
test_smbclient_iconv( )
{
2022-04-22 16:34:10 +03:00
normal_smbclient_config = " $PREFIX /client/client.conf "
smbclient_config = " $PREFIX /client/client_cp850_smbconf "
cat >$smbclient_config <<EOF
2020-05-12 01:37:00 +03:00
[ global]
2020-08-04 01:06:03 +03:00
include = $normal_smbclient_config
2020-05-12 01:37:00 +03:00
unix charset = cp850
client min protocol = core
EOF
2022-04-22 16:34:10 +03:00
cmd = 'CLI_FORCE_INTERACTIVE=yes $SMBCLIENT -U$USERNAME%$PASSWORD //$SERVER/$SHARENAME --configfile=$smbclient_config "$ADDARGS" -c ls 2>&1'
eval echo " $cmd "
out = $( eval $cmd )
rm -f $smbclient_config
2020-05-12 01:37:00 +03:00
2022-04-22 16:34:10 +03:00
echo " $out " | grep 'NT_STATUS_INVALID_NETWORK_RESPONSE'
ret = $?
if [ $ret -ne 0 ] ; then
echo " $out "
echo 'failed - should get: NT_STATUS_INVALID_NETWORK_RESPONSE.'
return 1
fi
2020-05-12 01:37:00 +03:00
2022-04-22 16:34:10 +03:00
return 0
2020-05-12 01:37:00 +03:00
}
testit "bad_iconv smbclient" test_smbclient_iconv || failed = $( expr $failed + 1)
testok $0 $failed