1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3/script/tests: Use protocol param passed to selectively run tests

samba3.blackbox.smbclient_s3 passes NT1 or SMB3 to run tests however
the PROTOCOL param is not used consistently within the script which
results in NT1 and SMB3 traffic being produced during testing. This
obviously causes issues when running the tests in an test environment
where SMB1 cannot be negiotiated. These changes fix this

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Noel Power 2019-11-21 12:31:31 +00:00 committed by Ralph Boehme
parent a645160999
commit 921f9f797f

View File

@ -331,7 +331,7 @@ test_msdfs_link()
tmpfile=$PREFIX/smbclient.in.$$ tmpfile=$PREFIX/smbclient.in.$$
prompt=" msdfs-target " prompt=" msdfs-target "
cmd='$SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/msdfs-share -I $SERVER_IP $ADDARGS -m nt1 -c dir 2>&1' cmd='$SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/msdfs-share -I $SERVER_IP $ADDARGS -m $PROTOCOL -c dir 2>&1'
out=`eval $cmd` out=`eval $cmd`
ret=$? ret=$?
@ -694,7 +694,9 @@ EOF
test_bad_names() test_bad_names()
{ {
# First with SMB1 # First with SMB1
cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/badname-tmp -I $SERVER_IP $ADDARGS -mNT1 -c ls 2>&1'
if [ $PROTOCOL = "NT1" ]; then
cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/badname-tmp -I $SERVER_IP $ADDARGS -m$PROTOCOL -c ls 2>&1'
eval echo "$cmd" eval echo "$cmd"
out=`eval $cmd` out=`eval $cmd`
ret=$? ret=$?
@ -752,9 +754,12 @@ test_bad_names()
echo "failed listing \\badname-tmp - grep (5) failed with $ret" echo "failed listing \\badname-tmp - grep (5) failed with $ret"
return 1 return 1
fi fi
fi
if [ $PROTOCOL = "SMB3" ]; then
# Now check again with -mSMB3 # Now check again with -mSMB3
cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/badname-tmp -I $SERVER_IP $ADDARGS -mSMB3 -c ls 2>&1' cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/badname-tmp -I $SERVER_IP $ADDARGS -m$PROTOCOL -c ls 2>&1'
eval echo "$cmd" eval echo "$cmd"
out=`eval $cmd` out=`eval $cmd`
ret=$? ret=$?
@ -812,6 +817,7 @@ test_bad_names()
echo "failed listing \\badname-tmp - SMB3 grep (5) failed with $ret" echo "failed listing \\badname-tmp - SMB3 grep (5) failed with $ret"
return 1 return 1
fi fi
fi
} }
# Test accessing an share with a name that must be mangled - with acl_xattrs. # Test accessing an share with a name that must be mangled - with acl_xattrs.
@ -862,8 +868,9 @@ del smbclient
del scopy_file del scopy_file
quit quit
EOF EOF
if [ $PROTOCOL = "SMB3" ]; then
# First SMB3 # First SMB3
cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS -mSMB3 < $tmpfile 2>&1' cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS -m$PROTOOCL < $tmpfile 2>&1'
eval echo "$cmd" eval echo "$cmd"
out=`eval $cmd` out=`eval $cmd`
ret=$? ret=$?
@ -883,12 +890,13 @@ EOF
echo "failed md5sum (1)" echo "failed md5sum (1)"
return 1 return 1
fi fi
fi
# #
# Now do again using SMB1 # Now do again using SMB1
# to force client-side fallback. # to force client-side fallback.
# #
if [ $PROTOCOL = "NT1" ]; then
cat > $tmpfile <<EOF cat > $tmpfile <<EOF
put ${SMBCLIENT} put ${SMBCLIENT}
scopy smbclient scopy_file scopy smbclient scopy_file
@ -898,7 +906,7 @@ del smbclient
del scopy_file del scopy_file
quit quit
EOF EOF
cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS -mNT1 < $tmpfile 2>&1' cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS -m$PROTOCOL < $tmpfile 2>&1'
eval echo "$cmd" eval echo "$cmd"
out=`eval $cmd` out=`eval $cmd`
ret=$? ret=$?
@ -918,6 +926,7 @@ EOF
echo "failed md5sum (2)" echo "failed md5sum (2)"
return 1 return 1
fi fi
fi
} }
# Test creating a stream on the root of the share directory filname - :foobar # Test creating a stream on the root of the share directory filname - :foobar