diff options
author | Stefan Metzmacher <metze@samba.org> | 2017-06-20 08:26:45 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2017-06-22 13:07:39 +0200 |
commit | e73202aaec4f8c2199ea29fc666064239c11942a (patch) | |
tree | f8bf8802b5ff73f5f563e8a6c2cb85c16e22a9f4 /python | |
parent | 73a7d154a862340f64cdd98475d5d91c8b6018ec (diff) | |
download | samba-e73202aaec4f8c2199ea29fc666064239c11942a.tar.gz |
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 <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'python')
-rw-r--r-- | python/samba/tests/auth_log.py | 49 |
1 files changed, 47 insertions, 2 deletions
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 |