auth/credentials: Add test for binding with a canonical name
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 30 Mar 2021 03:00:56 +0000 (16:00 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 7 Apr 2021 09:18:30 +0000 (09:18 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
auth/credentials/tests/bind.py

index b26be4f0f79e7e13539bbc93f7958f08b585dc10..191eb49ca1bf0821673271441f504e9f5350e42e 100755 (executable)
@@ -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)