summaryrefslogtreecommitdiff
path: root/python/samba/tests/auth_log_netlogon_bad_creds.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/samba/tests/auth_log_netlogon_bad_creds.py')
-rw-r--r--python/samba/tests/auth_log_netlogon_bad_creds.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/python/samba/tests/auth_log_netlogon_bad_creds.py b/python/samba/tests/auth_log_netlogon_bad_creds.py
index d850bd1c1b4..73e3555fbaf 100644
--- a/python/samba/tests/auth_log_netlogon_bad_creds.py
+++ b/python/samba/tests/auth_log_netlogon_bad_creds.py
@@ -38,6 +38,7 @@ from samba.dsdb import UF_WORKSTATION_TRUST_ACCOUNT, UF_PASSWD_NOTREQD
from samba.dcerpc.misc import SEC_CHAN_WKSTA
from samba.dcerpc.netlogon import NETLOGON_NEG_STRONG_KEYS
from samba.compat import get_string
+from samba.dcerpc.windows_event_ids import EVT_ID_UNSUCCESSFUL_LOGON
class AuthLogTestsNetLogonBadCreds(samba.tests.auth_log_base.AuthLogTestBase):
@@ -74,7 +75,7 @@ class AuthLogTestsNetLogonBadCreds(samba.tests.auth_log_base.AuthLogTestBase):
super(AuthLogTestsNetLogonBadCreds, self).tearDown()
delete_force(self.ldb, self.dn)
- def _test_netlogon(self, name, pwd, status, checkFunction):
+ def _test_netlogon(self, name, pwd, status, checkFunction, event_id):
def isLastExpectedMessage(msg):
return (
@@ -82,7 +83,8 @@ class AuthLogTestsNetLogonBadCreds(samba.tests.auth_log_base.AuthLogTestBase):
msg["Authentication"]["serviceDescription"] == "NETLOGON" and
msg["Authentication"]["authDescription"] ==
"ServerAuthenticate" and
- msg["Authentication"]["status"] == status)
+ msg["Authentication"]["status"] == status and
+ msg["Authentication"]["eventId"] == event_id)
machine_creds = Credentials()
machine_creds.guess(self.get_loadparm())
@@ -121,13 +123,15 @@ class AuthLogTestsNetLogonBadCreds(samba.tests.auth_log_base.AuthLogTestBase):
self._test_netlogon("bad_name",
self.machinepass,
"NT_STATUS_NO_TRUST_SAM_ACCOUNT",
- self.netlogon_check)
+ self.netlogon_check,
+ EVT_ID_UNSUCCESSFUL_LOGON)
def test_netlogon_bad_password(self):
self._test_netlogon(self.netbios_name,
"badpass",
"NT_STATUS_ACCESS_DENIED",
- self.netlogon_check)
+ self.netlogon_check,
+ EVT_ID_UNSUCCESSFUL_LOGON)
def test_netlogon_password_DES(self):
"""Logon failure that exercises the "DES" passwordType path.
@@ -138,7 +142,8 @@ class AuthLogTestsNetLogonBadCreds(samba.tests.auth_log_base.AuthLogTestBase):
msg["Authentication"]["serviceDescription"] == "NETLOGON" and
msg["Authentication"]["authDescription"] ==
"ServerAuthenticate" and
- msg["Authentication"]["passwordType"] == "DES")
+ msg["Authentication"]["passwordType"] == "DES" and
+ msg["Authentication"]["eventId"] == EVT_ID_UNSUCCESSFUL_LOGON)
c = netlogon.netlogon("ncalrpc:[schannel]", self.get_loadparm())
creds = netlogon.netr_Credential()
@@ -163,7 +168,9 @@ class AuthLogTestsNetLogonBadCreds(samba.tests.auth_log_base.AuthLogTestBase):
msg["Authentication"]["serviceDescription"] == "NETLOGON" and
msg["Authentication"]["authDescription"] ==
"ServerAuthenticate" and
- msg["Authentication"]["passwordType"] == "HMAC-MD5")
+ msg["Authentication"]["passwordType"] == "HMAC-MD5" and
+ msg["Authentication"]["eventId"] == EVT_ID_UNSUCCESSFUL_LOGON)
+
c = netlogon.netlogon("ncalrpc:[schannel]", self.get_loadparm())
creds = netlogon.netr_Credential()
c.netr_ServerReqChallenge(self.server, self.netbios_name, creds)