[PATCH] Add second authentication to make sure we're not locked out
Andreas Schneider
asn at samba.org
Thu Feb 22 16:52:58 UTC 2018
On Thursday, 22 February 2018 17:37:49 CET Stefan Metzmacher wrote:
> Am 22.02.2018 um 17:33 schrieb Andreas Schneider via samba-technical:
> > +
> > + # check that we are not locked out with just one failed login
> > + def test_authenticate_two(self):
> > + domain = os.environ["DOMAIN"]
> > + username = os.environ["USERNAME"]
> > + password = os.environ["PASSWORD"]
> > + unix_username = "%s/%s" % (domain, username)
> > + expected_rc = 0 # PAM_SUCCESS
> > +
> > + tc = pypamtest.TestCase(pypamtest.PAMTEST_AUTHENTICATE,
> > expected_rc) + res = pypamtest.run_pamtest(unix_username, "samba",
> > [tc], [password]) +
> > + self.assertTrue(res != None)
>
> I only see one check here...
> If you indent to check twice please do so within one test.
Here you go ... :-)
--
Andreas Schneider GPG-ID: CC014E3D
Samba Team asn at samba.org
www.samba.org
-------------- next part --------------
>From 3e5b11dc9107ebe3fb6c5b2ce37af8a28c062361 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 22 Feb 2018 17:30:36 +0100
Subject: [PATCH] tests: Authenticate again so make sure we are not locked out
Signed-off-by: Andreas Schneider <asn at samba.org>
---
python/samba/tests/pam_winbind.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/python/samba/tests/pam_winbind.py b/python/samba/tests/pam_winbind.py
index 1054e86dc9d..d64600e8566 100644
--- a/python/samba/tests/pam_winbind.py
+++ b/python/samba/tests/pam_winbind.py
@@ -44,3 +44,13 @@ class SimplePamTests(samba.tests.TestCase):
res = pypamtest.run_pamtest(unix_username, "samba", [tc], [password])
self.assertTrue(res != None)
+
+ # Authenticate again to check that we are not locked out with just one
+ # failed login
+ password = os.environ["PASSWORD"]
+ expected_rc = 0 # PAM_SUCCESS
+
+ tc = pypamtest.TestCase(pypamtest.PAMTEST_AUTHENTICATE, expected_rc)
+ res = pypamtest.run_pamtest(unix_username, "samba", [tc], [password])
+
+ self.assertTrue(res != None)
--
2.16.1
More information about the samba-technical
mailing list