From: Tim Beale Date: Tue, 15 Jan 2019 22:18:27 +0000 (+1300) Subject: tests: Relax auth_log SMB assertions to cover v1 *or* v2 X-Git-Tag: ldb-1.6.1~468 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=065faa6a1429db99ef1372ab194960f817d13ebf;p=thirdparty%2Fsamba.git tests: Relax auth_log SMB assertions to cover v1 *or* v2 The s4 Python bindings currently only support SMBv1 connections. If we change the bindings to support *either* v1 or v2, they'll end up negotiating v2. In which case the server is "SMB2", not "SMB", and these assertions fail. Long-term we want to get rid of SMBv1, so it makes sense to write the tests so that they pass against either v1 or v2. Signed-off-by: Tim Beale Reviewed-by: Jeremy Allison --- diff --git a/python/samba/tests/auth_log.py b/python/samba/tests/auth_log.py index c0d0aab94aa..29976aecbee 100644 --- a/python/samba/tests/auth_log.py +++ b/python/samba/tests/auth_log.py @@ -701,7 +701,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase): def test_smb(self): def isLastExpectedMessage(msg): return (msg["type"] == "Authorization" and - msg["Authorization"]["serviceDescription"] == "SMB" and + "SMB" in msg["Authorization"]["serviceDescription"] and msg["Authorization"]["authType"] == "krb5" and msg["Authorization"]["transportProtection"] == "SMB") @@ -910,7 +910,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase): def test_smb_no_krb_spnego(self): def isLastExpectedMessage(msg): return (msg["type"] == "Authorization" and - msg["Authorization"]["serviceDescription"] == "SMB" and + "SMB" in msg["Authorization"]["serviceDescription"] and msg["Authorization"]["authType"] == "NTLMSSP" and msg["Authorization"]["transportProtection"] == "SMB") @@ -929,8 +929,8 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase): msg = messages[0] self.assertEquals("Authentication", msg["type"]) self.assertEquals("NT_STATUS_OK", msg["Authentication"]["status"]) - self.assertEquals("SMB", - msg["Authentication"]["serviceDescription"]) + self.assertIn(msg["Authentication"]["serviceDescription"], + ["SMB", "SMB2"]) self.assertEquals("NTLMSSP", msg["Authentication"]["authDescription"]) self.assertEquals("NTLMv2", @@ -943,7 +943,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase): def test_smb_no_krb_spnego_bad_password(self): def isLastExpectedMessage(msg): return (msg["type"] == "Authentication" and - msg["Authentication"]["serviceDescription"] == "SMB" and + "SMB" in msg["Authentication"]["serviceDescription"] and msg["Authentication"]["authDescription"] == "NTLMSSP" and msg["Authentication"]["passwordType"] == "NTLMv2" and (msg["Authentication"]["status"] == @@ -975,7 +975,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase): def test_smb_no_krb_spnego_bad_user(self): def isLastExpectedMessage(msg): return (msg["type"] == "Authentication" and - msg["Authentication"]["serviceDescription"] == "SMB" and + "SMB" in msg["Authentication"]["serviceDescription"] and msg["Authentication"]["authDescription"] == "NTLMSSP" and msg["Authentication"]["passwordType"] == "NTLMv2" and (msg["Authentication"]["status"] ==