From: Stefan Metzmacher Date: Tue, 20 Jun 2017 06:26:45 +0000 (+0200) Subject: python/tests: test SMB1 and SMB2/3 in auth_log.py X-Git-Tag: tevent-0.9.32~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e73202aaec4f8c2199ea29fc666064239c11942a;p=thirdparty%2Fsamba.git python/tests: test SMB1 and SMB2/3 in auth_log.py We should do this explicitly in order to make the tests independent of 'client max protocol'. Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison --- diff --git a/python/samba/tests/auth_log.py b/python/samba/tests/auth_log.py index ff84befda45..65800c99181 100644 --- a/python/samba/tests/auth_log.py +++ b/python/samba/tests/auth_log.py @@ -700,7 +700,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase): len(messages), "Did not receive the expected number of messages") - def test_smb_anonymous(self): + def test_smb1_anonymous(self): def isLastExpectedMessage(msg): return (msg["type"] == "Authorization" and msg["Authorization"]["serviceDescription"] == "SMB" and @@ -712,7 +712,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase): path = "//%s/IPC$" % server auth = "-N" - call(["bin/smbclient", path, auth, "-c quit"]) + call(["bin/smbclient", path, auth, "-mNT1", "-c quit"]) messages = self.waitForMessages(isLastExpectedMessage) self.assertEquals(3, @@ -745,6 +745,51 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase): self.assertEquals("ANONYMOUS LOGON", msg["Authentication"]["becameAccount"]) + def test_smb2_anonymous(self): + def isLastExpectedMessage(msg): + return (msg["type"] == "Authorization" and + msg["Authorization"]["serviceDescription"] == "SMB2" and + msg["Authorization"]["authType"] == "NTLMSSP" and + msg["Authorization"]["account"] == "ANONYMOUS LOGON" and + msg["Authorization"]["transportProtection"] == "SMB") + + server = os.environ["SERVER"] + + path = "//%s/IPC$" % server + auth = "-N" + call(["bin/smbclient", path, auth, "-mSMB3", "-c quit"]) + + messages = self.waitForMessages(isLastExpectedMessage) + self.assertEquals(3, + len(messages), + "Did not receive the expected number of messages") + + # Check the first message it should be an Authentication + msg = messages[0] + self.assertEquals("Authentication", msg["type"]) + self.assertEquals("NT_STATUS_NO_SUCH_USER", + msg["Authentication"]["status"]) + self.assertEquals("SMB2", + msg["Authentication"]["serviceDescription"]) + self.assertEquals("NTLMSSP", + msg["Authentication"]["authDescription"]) + self.assertEquals("No-Password", + msg["Authentication"]["passwordType"]) + + # Check the second message it should be an Authentication + msg = messages[1] + self.assertEquals("Authentication", msg["type"]) + self.assertEquals("NT_STATUS_OK", + msg["Authentication"]["status"]) + self.assertEquals("SMB2", + msg["Authentication"]["serviceDescription"]) + self.assertEquals("NTLMSSP", + msg["Authentication"]["authDescription"]) + self.assertEquals("No-Password", + msg["Authentication"]["passwordType"]) + self.assertEquals("ANONYMOUS LOGON", + msg["Authentication"]["becameAccount"]) + def test_smb_no_krb_spnego(self): def isLastExpectedMessage(msg): return (msg["type"] == "Authorization" and