mirror of
https://github.com/samba-team/samba.git
synced 2025-07-31 20:22:15 +03:00
auth logging tests: Add tests for sessionId
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
committed by
Andrew Bartlett
parent
52a3318be8
commit
fdf827553a
@ -94,6 +94,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
|
|||||||
msg["Authorization"]["serviceDescription"])
|
msg["Authorization"]["serviceDescription"])
|
||||||
self.assertEquals(authTypes[2], msg["Authorization"]["authType"])
|
self.assertEquals(authTypes[2], msg["Authorization"]["authType"])
|
||||||
self.assertEquals("SMB", msg["Authorization"]["transportProtection"])
|
self.assertEquals("SMB", msg["Authorization"]["transportProtection"])
|
||||||
|
self.assertTrue(self.is_guid(msg["Authorization"]["sessionId"]))
|
||||||
|
|
||||||
# Check the third message it should be an Authentication
|
# Check the third message it should be an Authentication
|
||||||
# if we are expecting 4 messages
|
# if we are expecting 4 messages
|
||||||
@ -148,6 +149,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
|
|||||||
msg["Authorization"]["serviceDescription"])
|
msg["Authorization"]["serviceDescription"])
|
||||||
self.assertEquals(authTypes[3], msg["Authorization"]["authType"])
|
self.assertEquals(authTypes[3], msg["Authorization"]["authType"])
|
||||||
self.assertEquals("SMB", msg["Authorization"]["transportProtection"])
|
self.assertEquals("SMB", msg["Authorization"]["transportProtection"])
|
||||||
|
self.assertTrue(self.is_guid(msg["Authorization"]["sessionId"]))
|
||||||
|
|
||||||
|
|
||||||
def test_rpc_ncacn_np_ntlm_dns_sign(self):
|
def test_rpc_ncacn_np_ntlm_dns_sign(self):
|
||||||
@ -277,6 +279,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
|
|||||||
msg["Authorization"]["serviceDescription"])
|
msg["Authorization"]["serviceDescription"])
|
||||||
self.assertEquals(authTypes[1], msg["Authorization"]["authType"])
|
self.assertEquals(authTypes[1], msg["Authorization"]["authType"])
|
||||||
self.assertEquals("NONE", msg["Authorization"]["transportProtection"])
|
self.assertEquals("NONE", msg["Authorization"]["transportProtection"])
|
||||||
|
self.assertTrue(self.is_guid(msg["Authorization"]["sessionId"]))
|
||||||
|
|
||||||
# Check the second message it should be an Authentication
|
# Check the second message it should be an Authentication
|
||||||
msg = messages[1]
|
msg = messages[1]
|
||||||
@ -301,6 +304,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
|
|||||||
msg["Authorization"]["serviceDescription"])
|
msg["Authorization"]["serviceDescription"])
|
||||||
self.assertEquals(authTypes[1], msg["Authorization"]["authType"])
|
self.assertEquals(authTypes[1], msg["Authorization"]["authType"])
|
||||||
self.assertEquals("NONE", msg["Authorization"]["transportProtection"])
|
self.assertEquals("NONE", msg["Authorization"]["transportProtection"])
|
||||||
|
self.assertTrue(self.is_guid(msg["Authorization"]["sessionId"]))
|
||||||
|
|
||||||
# Check the second message it should be an Authentication
|
# Check the second message it should be an Authentication
|
||||||
msg = messages[1]
|
msg = messages[1]
|
||||||
@ -1313,3 +1317,4 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
|
|||||||
msg["Authorization"]["serviceDescription"])
|
msg["Authorization"]["serviceDescription"])
|
||||||
self.assertEquals("schannel", msg["Authorization"]["authType"])
|
self.assertEquals("schannel", msg["Authorization"]["authType"])
|
||||||
self.assertEquals("SEAL", msg["Authorization"]["transportProtection"])
|
self.assertEquals("SEAL", msg["Authorization"]["transportProtection"])
|
||||||
|
self.assertTrue(self.is_guid(msg["Authorization"]["sessionId"]))
|
||||||
|
@ -27,6 +27,7 @@ from samba.dcerpc import srvsvc, dnsserver
|
|||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
from samba import smb
|
from samba import smb
|
||||||
from samba.samdb import SamDB
|
from samba.samdb import SamDB
|
||||||
|
|
||||||
@ -120,3 +121,10 @@ class AuthLogTestBase(samba.tests.TestCase):
|
|||||||
return sd != "NETLOGON"
|
return sd != "NETLOGON"
|
||||||
|
|
||||||
return list(filter(is_not_netlogon, messages))
|
return list(filter(is_not_netlogon, messages))
|
||||||
|
|
||||||
|
GUID_RE = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
|
||||||
|
#
|
||||||
|
# Is the supplied GUID string correctly formatted
|
||||||
|
#
|
||||||
|
def is_guid(self, guid):
|
||||||
|
return re.match(self.GUID_RE, guid)
|
||||||
|
@ -74,6 +74,7 @@ class AuthLogTestsNcalrpc(samba.tests.auth_log_base.AuthLogTestBase):
|
|||||||
msg["Authorization"]["serviceDescription"])
|
msg["Authorization"]["serviceDescription"])
|
||||||
self.assertEquals(authTypes[1], msg["Authorization"]["authType"])
|
self.assertEquals(authTypes[1], msg["Authorization"]["authType"])
|
||||||
self.assertEquals("NONE", msg["Authorization"]["transportProtection"])
|
self.assertEquals("NONE", msg["Authorization"]["transportProtection"])
|
||||||
|
self.assertTrue(self.is_guid(msg["Authorization"]["sessionId"]))
|
||||||
|
|
||||||
# Check the second message it should be an Authentication
|
# Check the second message it should be an Authentication
|
||||||
msg = messages[1]
|
msg = messages[1]
|
||||||
|
@ -114,6 +114,7 @@ class AuthLogTestsNetLogon(samba.tests.auth_log_base.AuthLogTestBase):
|
|||||||
msg["Authorization"]["serviceDescription"])
|
msg["Authorization"]["serviceDescription"])
|
||||||
self.assertEquals("ncalrpc", msg["Authorization"]["authType"])
|
self.assertEquals("ncalrpc", msg["Authorization"]["authType"])
|
||||||
self.assertEquals("NONE", msg["Authorization"]["transportProtection"])
|
self.assertEquals("NONE", msg["Authorization"]["transportProtection"])
|
||||||
|
self.assertTrue(self.is_guid(msg["Authorization"]["sessionId"]))
|
||||||
|
|
||||||
# Check the fourth message it should be a NETLOGON Authentication
|
# Check the fourth message it should be a NETLOGON Authentication
|
||||||
msg = messages[3]
|
msg = messages[3]
|
||||||
|
@ -115,6 +115,7 @@ class AuthLogTestsNetLogonBadCreds(samba.tests.auth_log_base.AuthLogTestBase):
|
|||||||
msg["Authorization"]["serviceDescription"])
|
msg["Authorization"]["serviceDescription"])
|
||||||
self.assertEquals("ncalrpc", msg["Authorization"]["authType"])
|
self.assertEquals("ncalrpc", msg["Authorization"]["authType"])
|
||||||
self.assertEquals("NONE", msg["Authorization"]["transportProtection"])
|
self.assertEquals("NONE", msg["Authorization"]["transportProtection"])
|
||||||
|
self.assertTrue(self.is_guid(msg["Authorization"]["sessionId"]))
|
||||||
|
|
||||||
def test_netlogon_bad_machine_name(self):
|
def test_netlogon_bad_machine_name(self):
|
||||||
self._test_netlogon("bad_name",
|
self._test_netlogon("bad_name",
|
||||||
|
@ -171,6 +171,7 @@ class AuthLogTestsSamLogon(samba.tests.auth_log_base.AuthLogTestBase):
|
|||||||
msg["Authorization"]["serviceDescription"])
|
msg["Authorization"]["serviceDescription"])
|
||||||
self.assertEquals("ncalrpc", msg["Authorization"]["authType"])
|
self.assertEquals("ncalrpc", msg["Authorization"]["authType"])
|
||||||
self.assertEquals("NONE", msg["Authorization"]["transportProtection"])
|
self.assertEquals("NONE", msg["Authorization"]["transportProtection"])
|
||||||
|
self.assertTrue(self.is_guid(msg["Authorization"]["sessionId"]))
|
||||||
|
|
||||||
|
|
||||||
def test_ncalrpc_samlogon(self):
|
def test_ncalrpc_samlogon(self):
|
||||||
|
Reference in New Issue
Block a user