From 7679995b95c9d572a2e94213f5f55e3641844422 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Tue, 30 Mar 2021 16:00:56 +1300 Subject: [PATCH] auth/credentials: Add test for binding with a canonical name Signed-off-by: Joseph Sutton Reviewed-by: Douglas Bagnall --- auth/credentials/tests/bind.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/auth/credentials/tests/bind.py b/auth/credentials/tests/bind.py index b26be4f0f79..191eb49ca1b 100755 --- a/auth/credentials/tests/bind.py +++ b/auth/credentials/tests/bind.py @@ -54,6 +54,7 @@ creds_user2 = create_credential(lp, creds) creds_user3 = create_credential(lp, creds) creds_user4 = create_credential(lp, creds) creds_user5 = create_credential(lp, creds) +creds_user6 = create_credential(lp, creds) class BindTests(samba.tests.TestCase): @@ -211,6 +212,14 @@ unicodePwd:: """ + base64.b64encode(u"\"P@ssw0rd\"".encode('utf-16-le')).decode( self.fail("Failed to connect with user account SID") res = ldb_user5.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"]) + # do a simple bind and search with the canonical name + creds_user6.set_bind_dn(user_dn.canonical_str()) + creds_user6.set_password(self.password) + print("BindTest with: " + creds_user6.get_bind_dn()) + ldb_user6 = samba.tests.connect_samdb(host, credentials=creds_user6, + lp=lp, ldap_only=True) + res = ldb_user6.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"]) + def test_user_account_bind_no_domain(self): # create user self.ldb.newuser(username=self.username, password=self.password)