[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Thu Dec 5 18:45:03 UTC 2019


The branch, master has been updated
       via  e30607aff31 s4/smb_server: Fix handling of SMB2 messages after Netbios session setup
       via  5010535ec14 s3/utils: Make sure we can negotiate protocol based on smb.conf settings
       via  66443fe9340 s3/script/tests: Add simple test for net share list
       via  aca1c949023 s3/utils: net time always hardcoded to use SMB1
       via  921f9f797f1 s3/script/tests: Use protocol param passed to selectively run tests
       via  a6451609993 s3/selftest: allow samba3.blackbox.smbclient_ntlm.plain run SMB1 & SMB3
       via  980f7736fc0 s3/selftest: run samba3.blackbox.preserve_case with SMB1 & >=SMB2
       via  f26c678a2ca s3/script/tests: Allow test script to accept option protocol list
       via  f56314a97c5 s3/selftest: Run samba3.blackbox.net.misc with smb1/smb2
       via  d4d2e0175a4 s3/selftest: split SMB1 & SMB2 parts of samba3.blackbox.dfree_quota
       via  7c0ccbe1a00 s3/script/tests: Prepare to split samba3.blackbox.net.misc for SMB1/SMB2
       via  b4b25128b87 s3/selftest: allow samba3.blackbox.dfree_command run NT1 & SMB3 tests
       via  2ffccf9c016 selftest: fix a flapping test
      from  ea1c62f3c71 ldb:tests: Allow test filtering in ldb_mod_op_test

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e30607aff3149395ce908d8ebfcac0fe56daa1ae
Author: Noel Power <noel.power at suse.com>
Date:   Wed Nov 20 16:32:59 2019 +0000

    s4/smb_server: Fix handling of SMB2 messages after Netbios session setup
    
    On receiving a special NBT packet (e.g. session setup) the samba daemon
    effectively sets up SMB1 as the negotiated protocol (in terms of
    software handling of the messages) even though no SMB protocol
    has yet been negotiated. If the next message after the nbt session setup
    is a SMB2 message it will be handled by the SMB1 callbacks and will be
    rejected. This is evident when using smbclient (with -p 139) option
    in an env where SMB1 cannot be negotiated [*]
    
    This change doesn't set up the SMB1 callbacks on receipt of NBT special
    messages but lets the generic callback in place. Once either SMB1 (or)
    SMB2 is established (by receipt of a 'real' SMB or >=SMB2 message) then
    the proper callbacks will be set as normal.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Thu Dec  5 18:44:40 UTC 2019 on sn-devel-184

commit 5010535ec14d4e1f4dd83450432fc51a8ab53646
Author: Noel Power <noel.power at suse.com>
Date:   Fri Nov 22 17:01:45 2019 +0000

    s3/utils: Make sure we can negotiate protocol based on smb.conf settings
    
    net_rpc_check was hardcoded to check for rpc using SMB1 only. We
    should negotiate protocols based on the client max|min protocol settings
    
    this commit also removes the entry for
       samba3.blackbox.net.misc.lookup share list
    
    from knownfails as this test should now pass following this change.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 66443fe9340f1ae3894016fd7be51780f4c631b4
Author: Noel Power <noel.power at suse.com>
Date:   Fri Nov 22 16:53:08 2019 +0000

    s3/script/tests: Add simple test for net share list
    
    Adding a test for the net share list command. Currently this
    command will fail because of a bug in the net command when it tries
    to see if rpc is supported. This change adds a known fail to swallow
    this error. A future commit will fix the net command and remove the
    known fail
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit aca1c949023bf4ac620fe8d21a5e2a6e12c48dae
Author: Noel Power <noel.power at suse.com>
Date:   Tue Nov 19 12:38:18 2019 +0000

    s3/utils: net time always hardcoded to use SMB1
    
    net time ... cmd ignores any configuration to do with min/max protocols
    and connects allways with smb1
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 921f9f797f125d5e7cfe5505cd4287d23c2ae8f9
Author: Noel Power <noel.power at suse.com>
Date:   Thu Nov 21 12:31:31 2019 +0000

    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 at suse.com>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit a6451609993639616edcb6ee262381d5155774a1
Author: Noel Power <noel.power at suse.com>
Date:   Wed Nov 27 20:06:10 2019 +0000

    s3/selftest: allow samba3.blackbox.smbclient_ntlm.plain run SMB1 & SMB3
    
    samba3.blackbox.smbclient_ntlm.plain used test SMB3 & NT1 protocols
    in one test. These changes:
      *  modify the test driver script test_smbclient_ntlm.sh to take a
         protocol as param
      *  modify the test description generators to pass NT1 & SMB3
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 980f7736fc0c569af6142288ac444775941426c3
Author: Noel Power <noel.power at suse.com>
Date:   Wed Nov 27 19:44:23 2019 +0000

    s3/selftest: run samba3.blackbox.preserve_case with SMB1 & >=SMB2
    
    adjust test generators to run SMB1 & >=SMB2 versions of
    samba3.blackbox.preserve_case test.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit f26c678a2ca550de6207634a8ea1461699cf54d6
Author: Noel Power <noel.power at suse.com>
Date:   Tue Nov 19 15:45:35 2019 +0000

    s3/script/tests: Allow test script to accept option protocol list
    
    test_preserve_case.sh tests a range of protocols, this however
    fails when running against the normal test env (which have min
    protocol of SMB2) because one of the protocols is NT1. This change
    allows tests to pass the protocol (or list of protocols) so that
    tests can be split.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit f56314a97c508e105cd2b981730cd4fd25b0c6e4
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 5 11:05:57 2019 +0100

    s3/selftest: Run samba3.blackbox.net.misc with smb1/smb2
    
    samba3.blackbox.net.misc now can run with >=SMB2 or SMB1 protocols,
    adjust previous test definition and add new one
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit d4d2e0175a4fef00566efa276a779a4ec23794d2
Author: Noel Power <noel.power at suse.com>
Date:   Wed Nov 27 19:37:26 2019 +0000

    s3/selftest: split SMB1 & SMB2 parts of samba3.blackbox.dfree_quota
    
    samba3.blackbox.dfree_quota was almost exclusively a SMB3 test, only
    one part was testing legacy SMB1 behaviour, this change splits this
    out so the SMB1 part can be run independantly.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 7c0ccbe1a004b96ccf726bda01262e5394c4d0b6
Author: Noel Power <noel.power at suse.com>
Date:   Tue Nov 19 14:11:21 2019 +0000

    s3/script/tests: Prepare to split samba3.blackbox.net.misc for SMB1/SMB2
    
    modify test_net_misc.sh to accept optional protocol, no protocol
    specified and it behaves more or less as before (expect this time the
    client max protocol is explicitly speficied)
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit b4b25128b878cc4c41973de9c5ef5e9d0109a6a4
Author: Noel Power <noel.power at suse.com>
Date:   Wed Nov 27 19:25:49 2019 +0000

    s3/selftest: allow samba3.blackbox.dfree_command run NT1 & SMB3 tests
    
    samba3.blackbox.dfree_command was a single test that run both NT1 &
    SMB3 tests together. This allow the protocol to be passed into the test
    script so the test can be divided into SMB1 & >=SM2 tests.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 2ffccf9c016a91818e6617a53c5f9d54f5c70c8b
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 5 10:38:17 2019 +0100

    selftest: fix a flapping test
    
    The previous approach of using ls | grep $NAME for testing whether the previous
    directory removal succeeded will fail in case $NAME is a substring of any
    directory entrie's name.
    
    Eg
    
      NAME=tmp.123
    
    and the directory contains an unrelated entry
    
      tmp.123456
    
    Using allinfo instead should fix this.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/script/tests/test_dfree_command.sh  | 20 ++++++---
 source3/script/tests/test_dfree_quota.sh    | 18 ++++++--
 source3/script/tests/test_inherit_owner.sh  |  4 +-
 source3/script/tests/test_net_misc.sh       | 25 +++++++++--
 source3/script/tests/test_preserve_case.sh  |  9 +++-
 source3/script/tests/test_smbclient_ntlm.sh | 69 +++++++++++++++++++++--------
 source3/script/tests/test_smbclient_s3.sh   | 21 ++++++---
 source3/selftest/tests.py                   | 20 ++++++---
 source3/utils/net_rpc.c                     |  5 ++-
 source3/utils/net_time.c                    |  5 ++-
 source4/smb_server/smb_server.c             |  1 -
 11 files changed, 144 insertions(+), 53 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/script/tests/test_dfree_command.sh b/source3/script/tests/test_dfree_command.sh
index a60a52de5c4..715496d47d7 100755
--- a/source3/script/tests/test_dfree_command.sh
+++ b/source3/script/tests/test_dfree_command.sh
@@ -17,7 +17,9 @@ USERNAME=$3
 PASSWORD=$4
 PREFIX=$5
 smbclient=$6
-shift 6
+protocol=$7
+
+shift 7
 failed=0
 
 incdir=`dirname $0`/../../../testprogs/blackbox
@@ -47,12 +49,18 @@ test_smbclient_dfree() {
 	return $status
 }
 
+if [ $protocol = "SMB3" ]; then
+	test_smbclient_dfree "Test dfree command share root SMB3" dfree "l" "2000 1024. 20" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`
+	test_smbclient_dfree "Test dfree command subdir1 SMB3" dfree "cd subdir1; l" "8000 1024. 80" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`
+	test_smbclient_dfree "Test dfree command subdir2 SMB3" dfree "cd subdir2; l" "32000 1024. 320" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`
 
-test_smbclient_dfree "Test dfree command share root SMB3" dfree "l" "2000 1024. 20" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`
-test_smbclient_dfree "Test dfree command share root NT1" dfree "l" "2000 1024. 20" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=NT1 || failed=`expr $failed + 1`
-test_smbclient_dfree "Test dfree command subdir1 SMB3" dfree "cd subdir1; l" "8000 1024. 80" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`
-test_smbclient_dfree "Test dfree command subdir2 SMB3" dfree "cd subdir2; l" "32000 1024. 320" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`
+elif [ $protocol = "NT1" ]; then
+	test_smbclient_dfree "Test dfree command share root NT1" dfree "l" "2000 1024. 20" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=NT1 || failed=`expr $failed + 1`
 #SMB1 queries disk usage stat on the share's root, regardless of working directory
-test_smbclient_dfree "Test dfree command subdir1 NT1" dfree "cd subdir1; l" "2000 1024. 20" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=NT1 || failed=`expr $failed + 1`
+	test_smbclient_dfree "Test dfree command subdir1 NT1" dfree "cd subdir1; l" "2000 1024. 20" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=NT1 || failed=`expr $failed + 1`
 
+else
+	echo "unsupported protocol $protocol" |  subunit_fail_test "Test dfree command"
+	$failed=`expr $failed + 1`
+fi
 exit $failed
diff --git a/source3/script/tests/test_dfree_quota.sh b/source3/script/tests/test_dfree_quota.sh
index cfba4a9173f..e86d431180a 100755
--- a/source3/script/tests/test_dfree_quota.sh
+++ b/source3/script/tests/test_dfree_quota.sh
@@ -19,7 +19,8 @@ WORKDIR=$5/dfree
 smbclient=$6
 smbcquotas=$7
 smbcacls=$8
-shift 8
+protocol=$9
+shift 9
 failed=0
 
 CONFFILE=$ENVDIR/lib/dfq.conf
@@ -196,13 +197,22 @@ test_smbcquotas() {
 	return $status
 }
 
+if [ $protocol != "SMB3" -a $protocol != "NT1"]; then
+	echo "unsupported protocol $protocol" | subunit_fail_test "Test dfree quota"
+	failed=`expr $failed + 1`
+fi
+
+if [ $protocol = "NT1" ]; then
+	setup_conf
+	#basic quota test (SMB1 only)
+	test_smbcquotas "Test user quota" confq1 $USERNAME "40960/4096000/3072000" "smb1" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=NT1 || failed=`expr $failed + 1`
+	exit $failed
+fi
+
 #basic disk-free tests
 test_smbclient_dfree "Test dfree share root SMB3 no quota" dfq "." "conf1 ." "10 1024. 5" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`
 test_smbclient_dfree "Test dfree subdir SMB3 no quota" dfq "subdir1" "conf1 . conf2 subdir1" "20 1024. 10" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`
-test_smbclient_dfree "Test dfree subdir NT1 no quota" dfq "subdir1" "conf1 . conf2 subdir1" "10 1024. 5" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=NT1 || failed=`expr $failed + 1`
 test_smbclient_dfree "Test large disk" dfq "." "conf3 ." "1125899906842624 1024. 3000" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB3 || failed=`expr $failed + 1`
-#basic quota test (SMB1 only)
-test_smbcquotas "Test user quota" confq1 $USERNAME "40960/4096000/3072000" "smb1" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=NT1 || failed=`expr $failed + 1`
 #basic quota test (SMB2 only)
 test_smbcquotas "Test user quota" confq1 $USERNAME "40960/4096000/3072000" "smb2" -U$USERNAME%$PASSWORD --option=clientmaxprotocol=SMB2 || failed=`expr $failed + 1`
 
diff --git a/source3/script/tests/test_inherit_owner.sh b/source3/script/tests/test_inherit_owner.sh
index 9f22a2c1cba..7e1333787aa 100755
--- a/source3/script/tests/test_inherit_owner.sh
+++ b/source3/script/tests/test_inherit_owner.sh
@@ -37,7 +37,7 @@ create_file() {
     local bname=$(basename $fname)
     touch $PREFIX/$bname
     $SMBCLIENT //$SERVER/$share -U $USERNAME%$PASSWORD -c "cd $rem_dirname; rm $bname" 2>/dev/null
-    $SMBCLIENT //$SERVER/$share -U $USERNAME%$PASSWORD -c "cd $rem_dirname; ls" 2>/dev/null | grep "$bname" && exit 1
+    $SMBCLIENT //$SERVER/$share -U $USERNAME%$PASSWORD -c "cd $rem_dirname; allinfo $bname" 2>/dev/null | grep "NT_STATUS_OBJECT_NAME_NOT_FOUND" || exit 1
     $SMBCLIENT //$SERVER/$share -U $USERNAME%$PASSWORD -c "lcd $PREFIX; cd $rem_dirname; put $bname" 2>/dev/null || exit 1
 }
 
@@ -47,7 +47,7 @@ create_dir() {
     local rem_dirname=$(dirname $dname)
     local bname=$(basename $dname)
     $SMBCLIENT //$SERVER/$share -U $USERNAME%$PASSWORD -c "cd $rem_dirname; rmdir $bname" 2>/dev/null
-    $SMBCLIENT //$SERVER/$share -U $USERNAME%$PASSWORD -c "cd $rem_dirname; ls" 2>/dev/null | grep "$dname" && exit 1
+    $SMBCLIENT //$SERVER/$share -U $USERNAME%$PASSWORD -c "cd $rem_dirname; allinfo $bname" 2>/dev/null | grep "NT_STATUS_OBJECT_NAME_NOT_FOUND" || exit 1
     $SMBCLIENT //$SERVER/$share -U $USERNAME%$PASSWORD -c "cd $rem_dirname; mkdir $bname" 2>/dev/null || exit 1
 }
 
diff --git a/source3/script/tests/test_net_misc.sh b/source3/script/tests/test_net_misc.sh
index 566694be74b..cc8781c355b 100755
--- a/source3/script/tests/test_net_misc.sh
+++ b/source3/script/tests/test_net_misc.sh
@@ -14,10 +14,17 @@ SERVERCONFFILE="$2"
 NET="$3"
 CONFIGURATION="$4"
 
-NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION"
+# optional protocl, default to NT1
+if [ $# -gt 4 ]; then
+	PROTOCOL="$5"
+else
+	PROTOCOL="NT1"
+fi
 
-NETTIME="${NET} time"
-NETLOOKUP="${NET} lookup"
+NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION"
+NETTIME="${NET}   --option=clientmaxprotocol=${PROTOCOL} time"
+NETLOOKUP="${NET} --option=clientmaxprotocol=${PROTOCOL} lookup"
+NETSHARE="${NET} -U${USERNAME}%${PASSWORD} --option=clientmaxprotocol=${PROTOCOL} -S ${SERVER} share"
 
 incdir=`dirname $0`/../../../testprogs/blackbox
 . $incdir/subunit.sh
@@ -38,6 +45,13 @@ test_lookup()
 	${NETLOOKUP} ${PARAM}
 }
 
+test_share()
+{
+	PARAM="$1"
+
+	${NETSHARE} ${PARAM}
+}
+
 testit "get the time" \
 	test_time || \
 	failed=`expr $failed + 1`
@@ -58,5 +72,10 @@ testit "lookup the master browser" \
 	test_lookup master || \
 	failed=`expr $failed + 1`
 
+# This test attempts to lookup shares
+testit "lookup share list" \
+	test_share list || \
+	failed=`expr $failed + 1`
+
 testok $0 $failed
 
diff --git a/source3/script/tests/test_preserve_case.sh b/source3/script/tests/test_preserve_case.sh
index 2e49b0c0c84..04885f12a1e 100755
--- a/source3/script/tests/test_preserve_case.sh
+++ b/source3/script/tests/test_preserve_case.sh
@@ -17,7 +17,13 @@ USERNAME=$3
 PASSWORD=$4
 PREFIX=$5
 smbclient=$6
-shift 6
+if [ $# -gt 6 ]; then
+	PROTOCOL_LIST=$7
+	shift 7
+else
+	PROTOCOL_LIST="NT1 SMB2 SMB3"
+	shift 6
+fi
 failed=0
 
 incdir=`dirname $0`/../../../testprogs/blackbox
@@ -40,7 +46,6 @@ test_smbclient() {
 	return $status
 }
 
-PROTOCOL_LIST="NT1 SMB2 SMB3"
 SHARE="lowercase"
 
 for PROTOCOL in $PROTOCOL_LIST; do
diff --git a/source3/script/tests/test_smbclient_ntlm.sh b/source3/script/tests/test_smbclient_ntlm.sh
index 33a927fe4c2..ab556cd56a4 100755
--- a/source3/script/tests/test_smbclient_ntlm.sh
+++ b/source3/script/tests/test_smbclient_ntlm.sh
@@ -2,9 +2,9 @@
 
 # this runs a smbclient based authentication tests
 
-if [ $# -lt 5 ]; then
+if [ $# -lt 6 ]; then
 cat <<EOF
-Usage: test_smbclient_ntlm.sh SERVER USERNAME PASSWORD MAPTOGUEST SMBCLIENT <smbclient arguments>
+Usage: test_smbclient_ntlm.sh SERVER USERNAME PASSWORD MAPTOGUEST SMBCLIENT PROTOCOL <smbclient arguments>
 EOF
 exit 1;
 fi
@@ -14,31 +14,62 @@ USERNAME="$2"
 PASSWORD="$3"
 MAPTOGUEST="$4"
 SMBCLIENT="$5"
+PROTOCOL="$6"
 SMBCLIENT="$VALGRIND ${SMBCLIENT}"
-shift 5
+shift 6
 ADDARGS="$*"
 
 incdir=`dirname $0`/../../../testprogs/blackbox
 . $incdir/subunit.sh
 
-testit "smbclient username.password.NT1OLD" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U$USERNAME%$PASSWORD -mNT1 --option=clientusespnego=no --option=clientntlmv2auth=no -c quit $ADDARGS
-testit "smbclient username.password.NT1NEW" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U$USERNAME%$PASSWORD -mNT1 -c quit $ADDARGS
-testit "smbclient username.password.SMB3" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U$USERNAME%$PASSWORD -mSMB3 -c quit $ADDARGS
+if [ $PROTOCOL != "SMB3" -a $PROTOCOL != "NT1" ]; then
+cat <<EOF
+Uexpected protocol specified $PROTOCOL
+EOF
+	exit 1;
+fi
 
-testit "smbclient anonymous.nopassword.NT1OLD" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U% -mNT1 --option=clientusespnego=no --option=clientntlmv2auth=no -c quit $ADDARGS
-testit "smbclient anonymous.nopassword.NT1NEW" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U% -mNT1 -c quit $ADDARGS
-testit "smbclient anonymous.nopassword.SMB3" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U% -mSMB3 -c quit $ADDARGS
+if [ $PROTOCOL = "NT1" ]; then
+	testit "smbclient username.password.NT1OLD" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U$USERNAME%$PASSWORD -mNT1 --option=clientusespnego=no --option=clientntlmv2auth=no -c quit $ADDARGS
+	testit "smbclient username.password.NT1NEW" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U$USERNAME%$PASSWORD -mNT1 -c quit $ADDARGS
+fi
+if [ $PROTOCOL = "SMB3" ]; then
+	testit "smbclient username.password.SMB3" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U$USERNAME%$PASSWORD -mSMB3 -c quit $ADDARGS
+fi
+
+if [ $PROTOCOL = "NT1" ]; then
+	testit "smbclient anonymous.nopassword.NT1OLD" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U% -mNT1 --option=clientusespnego=no --option=clientntlmv2auth=no -c quit $ADDARGS
+	testit "smbclient anonymous.nopassword.NT1NEW" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U% -mNT1 -c quit $ADDARGS
+fi
+if [ $PROTOCOL = "SMB3" ]; then
+	testit "smbclient anonymous.nopassword.SMB3" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U% -mSMB3 -c quit $ADDARGS
+fi
 if test x"${MAPTOGUEST}" = x"never" ; then
-	testit_expect_failure "smbclient anonymous.badpassword.NT1NEW.fail" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U%badpassword -mNT1 -c quit $ADDARGS
-	testit_expect_failure "smbclient anonymous.badpassword.SMB3.fail" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U%badpassword -mSMB3 -c quit $ADDARGS
+	if [ $PROTOCOL = "NT1" ]; then
+		testit_expect_failure "smbclient anonymous.badpassword.NT1NEW.fail" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U%badpassword -mNT1 -c quit $ADDARGS
+	fi
+	if [ $PROTOCOL = "SMB3" ]; then
+		testit_expect_failure "smbclient anonymous.badpassword.SMB3.fail" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U%badpassword -mSMB3 -c quit $ADDARGS
+	fi
 else
-	testit "smbclient anonymous.badpassword.NT1NEW.guest" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U%badpassword -mNT1 -c quit $ADDARGS
-	testit "smbclient anonymous.badpassword.SMB3.guest" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U%badpassword -mSMB3 -c quit $ADDARGS
-
-	testit "smbclient baduser.badpassword.NT1NEW.guest" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mNT1 -c quit $ADDARGS
-	testit "smbclient baduser.badpassword.SMB3.guest" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mSMB3 -c quit $ADDARGS
+	if [ $PROTOCOL = "NT1" ]; then
+		testit "smbclient anonymous.badpassword.NT1NEW.guest" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U%badpassword -mNT1 -c quit $ADDARGS
+	fi
+	if [ $PROTOCOL = "SMB3" ]; then
+		testit "smbclient anonymous.badpassword.SMB3.guest" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -U%badpassword -mSMB3 -c quit $ADDARGS
+	fi
 
-	testit_expect_failure "smbclient baduser.badpassword.NT1OLD.signfail" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mNT1 --option=clientusespnego=no --option=clientntlmv2auth=no --signing=required -c quit $ADDARGS
-	testit_expect_failure "smbclient baduser.badpassword.NT1NEW.signfail" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mNT1 --signing=required -c quit $ADDARGS
-	testit_expect_failure "smbclient baduser.badpassword.SMB3.signfail" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mSMB3 --signing=required -c quit $ADDARGS
+	if [ $PROTOCOL = "NT1" ]; then
+		testit "smbclient baduser.badpassword.NT1NEW.guest" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mNT1 -c quit $ADDARGS
+	fi
+	if [ $PROTOCOL = "SMB3" ]; then
+		testit "smbclient baduser.badpassword.SMB3.guest" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mSMB3 -c quit $ADDARGS
+	fi
+	if [ $PROTOCOL = "NT1" ]; then
+		testit_expect_failure "smbclient baduser.badpassword.NT1OLD.signfail" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mNT1 --option=clientusespnego=no --option=clientntlmv2auth=no --signing=required -c quit $ADDARGS
+		testit_expect_failure "smbclient baduser.badpassword.NT1NEW.signfail" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mNT1 --signing=required -c quit $ADDARGS
+	fi
+	if [ $PROTOCOL = "SMB3" ]; then
+		testit_expect_failure "smbclient baduser.badpassword.SMB3.signfail" $SMBCLIENT //$SERVER/IPC\$ $CONFIGURATION -Ubaduser%badpassword -mSMB3 --signing=required -c quit $ADDARGS
+	fi
 fi
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index 0bae1d78fac..5df8a7cb550 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -331,7 +331,7 @@ test_msdfs_link()
     tmpfile=$PREFIX/smbclient.in.$$
     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`
     ret=$?
 
@@ -694,7 +694,9 @@ EOF
 test_bad_names()
 {
     # 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"
     out=`eval $cmd`
     ret=$?
@@ -752,9 +754,12 @@ test_bad_names()
 	echo "failed listing \\badname-tmp - grep (5) failed with $ret"
 	return 1
     fi
+fi
+
+if [ $PROTOCOL = "SMB3" ]; then
 
     # 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"
     out=`eval $cmd`
     ret=$?
@@ -812,6 +817,7 @@ test_bad_names()
 	echo "failed listing \\badname-tmp - SMB3 grep (5) failed with $ret"
 	return 1
     fi
+fi
 }
 
 # Test accessing an share with a name that must be mangled - with acl_xattrs.
@@ -862,8 +868,9 @@ del smbclient
 del scopy_file
 quit
 EOF
+if [ $PROTOCOL = "SMB3" ]; then
     # 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"
     out=`eval $cmd`
     ret=$?
@@ -883,12 +890,13 @@ EOF
 	echo "failed md5sum (1)"
 	return 1
     fi
-
+fi
 #
 # Now do again using SMB1
 # to force client-side fallback.
 #
 
+if [ $PROTOCOL = "NT1" ]; then
     cat > $tmpfile <<EOF
 put ${SMBCLIENT}
 scopy smbclient scopy_file
@@ -898,7 +906,7 @@ del smbclient
 del scopy_file
 quit
 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"
     out=`eval $cmd`
     ret=$?
@@ -918,6 +926,7 @@ EOF
 	echo "failed md5sum (2)"
 	return 1
     fi
+fi
 }
 
 # Test creating a stream on the root of the share directory filname - :foobar
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 49d88d54be4..deadb960f3e 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -249,7 +249,8 @@ for options in ["", "--option=clientntlmv2auth=no", "--option=clientusespnego=no
 
 for env in ["nt4_dc", "nt4_member", "ad_member", "ad_dc", "ad_dc_ntvfs", "s4member", "fl2000dc"]:
     plantestsuite("samba3.blackbox.smbclient_machine_auth.plain (%s:local)" % env, "%s:local" % env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_machine_auth.sh"), '$SERVER', smbclient3, configuration])
-    plantestsuite("samba3.blackbox.smbclient_ntlm.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_ntlm.sh"), '$SERVER', '$DC_USERNAME', '$DC_PASSWORD', "never", smbclient3, configuration])
+    plantestsuite("samba3.blackbox.smbclient_ntlm.plain NT1 (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_ntlm.sh"), '$SERVER', '$DC_USERNAME', '$DC_PASSWORD', "never", smbclient3, "NT1", configuration])
+    plantestsuite("samba3.blackbox.smbclient_ntlm.plain SMB3 (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_ntlm.sh"), '$SERVER', '$DC_USERNAME', '$DC_PASSWORD', "never", smbclient3, "SMB3", configuration])
 
 for options in ["--option=clientntlmv2auth=no", "--option=clientusespnego=no --option=clientntlmv2auth=no", "--option=clientusespnego=no --option=clientntlmv2auth=no -mNT1", ""]:
     for env in ["nt4_member", "ad_member"]:
@@ -303,7 +304,8 @@ for env in ["maptoguest", "simpleserver"]:
 
 env = "maptoguest"
 plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) bad username" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', 'notmy$USERNAME', '$PASSWORD', smbclient3, configuration + " --option=clientntlmv2auth=no --option=clientlanmanauth=yes"])
-plantestsuite("samba3.blackbox.smbclient_ntlm.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_ntlm.sh"), '$SERVER', '$USERNAME', '$PASSWORD', "baduser", smbclient3, configuration])
+plantestsuite("samba3.blackbox.smbclient_ntlm.plain NT1 (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_ntlm.sh"), '$SERVER', '$USERNAME', '$PASSWORD', "baduser", smbclient3, "NT1", configuration])
+plantestsuite("samba3.blackbox.smbclient_ntlm.plain SMB3 (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_ntlm.sh"), '$SERVER', '$USERNAME', '$PASSWORD', "baduser", smbclient3, "NT1", configuration])
 
 # plain
 for env in ["nt4_dc"]:
@@ -328,9 +330,12 @@ for env in ["nt4_dc"]:
     plantestsuite("samba3.blackbox.smbclient_s3.SMB3.crypt (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration, "SMB3", "-e"])
 
 for env in ["fileserver"]:
-    plantestsuite("samba3.blackbox.preserve_case (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_preserve_case.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3])
-    plantestsuite("samba3.blackbox.dfree_command (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_dfree_command.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3])
-    plantestsuite("samba3.blackbox.dfree_quota (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_dfree_quota.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbclient3, smbcquotas, smbcacls])
+    plantestsuite("samba3.blackbox.preserve_case NT1 (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_preserve_case.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3, "NT1"])
+    plantestsuite("samba3.blackbox.preserve_case >=SMB2 %s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_preserve_case.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3, '"SMB2 SMB3"'])
+    plantestsuite("samba3.blackbox.dfree_command NT1 (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_dfree_command.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3, "NT1"])
+    plantestsuite("samba3.blackbox.dfree_command SMB3 (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_dfree_command.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3, "SMB3"])
+    plantestsuite("samba3.blackbox.dfree_quota NT1 (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_dfree_quota.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbclient3, smbcquotas, smbcacls, "NT1"])
+    plantestsuite("samba3.blackbox.dfree_quota SMB3 (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_dfree_quota.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbclient3, smbcquotas, smbcacls, "SMB3"])
     plantestsuite("samba3.blackbox.smbcquotas (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbcquota.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbcquotas])
     plantestsuite("samba3.blackbox.valid_users (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_valid_users.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3])
     plantestsuite("samba3.blackbox.offline (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_offline.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH/offline', smbclient3])
@@ -397,7 +402,10 @@ for env in ["fileserver:local"]:
 # TODO encrypted against member, with member creds, and with DC creds
 plantestsuite("samba3.blackbox.net.misc", "nt4_dc:local",
               [os.path.join(samba3srcdir, "script/tests/test_net_misc.sh"),
-               scriptdir, "$SMB_CONF_PATH", net, configuration])
+               scriptdir, "$SMB_CONF_PATH", net, configuration, "NT1"])
+plantestsuite("samba3.blackbox.net.misc", "nt4_dc:local",
+              [os.path.join(samba3srcdir, "script/tests/test_net_misc.sh"),
+               scriptdir, "$SMB_CONF_PATH", net, configuration, "SMB3"])
 plantestsuite("samba3.blackbox.net.local.registry", "nt4_dc:local",
               [os.path.join(samba3srcdir, "script/tests/test_net_registry.sh"),
                scriptdir, "$SMB_CONF_PATH", net, configuration])
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 96c94e5179b..e4cf7ef05f5 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -7472,8 +7472,9 @@ bool net_rpc_check(struct net_context *c, unsigned flags)
 		}
 		return false;
 	}
-	status = smbXcli_negprot(cli->conn, cli->timeout, PROTOCOL_CORE,
-				 PROTOCOL_NT1);
+	status = smbXcli_negprot(cli->conn, cli->timeout,
+				 lp_client_min_protocol(),
+				 lp_client_max_protocol());
 	if (!NT_STATUS_IS_OK(status))
 		goto done;
 	if (smbXcli_conn_protocol(cli->conn) < PROTOCOL_NT1)
diff --git a/source3/utils/net_time.c b/source3/utils/net_time.c
index 5e6cf2ea15d..d102f84614f 100644
--- a/source3/utils/net_time.c
+++ b/source3/utils/net_time.c
@@ -47,8 +47,9 @@ static time_t cli_servertime(const char *host,
 		goto done;
 	}
 
-	status = smbXcli_negprot(cli->conn, cli->timeout, PROTOCOL_CORE,
-				 PROTOCOL_NT1);
+	status = smbXcli_negprot(cli->conn, cli->timeout,
+				 lp_client_min_protocol(),
+				 lp_client_max_protocol());
 	if (!NT_STATUS_IS_OK(status)) {
 		fprintf(stderr, _("Protocol negotiation failed: %s\n"),
 			nt_errstr(status));
diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c
index 45641a4f2c9..0b80f2fbd20 100644
--- a/source4/smb_server/smb_server.c
+++ b/source4/smb_server/smb_server.c
@@ -44,7 +44,6 @@ static NTSTATUS smbsrv_recv_generic_request(void *private_data, DATA_BLOB blob)
 	if (CVAL(blob.data,0) != 0) {
 		status = smbsrv_init_smb_connection(smb_conn, smb_conn->lp_ctx);
 		NT_STATUS_NOT_OK_RETURN(status);
-		packet_set_callback(smb_conn->packet, smbsrv_recv_smb_request);
 		return smbsrv_recv_smb_request(smb_conn, blob);
 	}
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list