diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2010-11-28 03:05:05 +0200 |
---|---|---|
committer | Kamen Mazdrashki <kamenim@samba.org> | 2010-11-28 03:00:41 +0100 |
commit | 092e923e2bfdbc78fa6a551222d778bc1b936a6f (patch) | |
tree | 0ae1cf0c1beb1530f78acf07f622cc681196a106 /source4 | |
parent | 60bf020394f5006dc343a8477c7621ca00f7ce88 (diff) | |
download | samba-092e923e2bfdbc78fa6a551222d778bc1b936a6f.tar.gz samba-092e923e2bfdbc78fa6a551222d778bc1b936a6f.tar.bz2 samba-092e923e2bfdbc78fa6a551222d778bc1b936a6f.zip |
s4-tests/bind.py: Use samba.tests.connect_samdb() instead of directly using SamDB class
connect_samdb() functino will correctly handle things like:
- session_info param - it will create system_session() using supplied
LoadParm parameter and thus avoiding creation of multiple LoadParm
instances (LoadParm() will mask certain command line supplied options)
- host url will be prefixed with ldap:// automatically
Autobuild-User: Kamen Mazdrashki <kamenim@samba.org>
Autobuild-Date: Sun Nov 28 03:00:41 CET 2010 on sn-devel-104
Diffstat (limited to 'source4')
-rwxr-xr-x | source4/auth/credentials/tests/bind.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/source4/auth/credentials/tests/bind.py b/source4/auth/credentials/tests/bind.py index 8c93319ccd..a10c91956f 100755 --- a/source4/auth/credentials/tests/bind.py +++ b/source4/auth/credentials/tests/bind.py @@ -106,7 +106,8 @@ unicodePwd:: """ + base64.b64encode("\"P@ssw0rd\"".encode('utf-16-le')) + """ creds_machine.set_bind_dn(self.computer_dn) creds_machine.set_password(self.password) print "BindTest with: " + creds_machine.get_bind_dn() - ldb_machine = SamDB(host, credentials=creds_machine, session_info=system_session(), lp=lp) + ldb_machine = samba.tests.connect_samdb(host, credentials=creds_machine, + lp=lp, ldap_only=True) res = ldb_machine.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"]) def test_user_account_bind(self): @@ -122,26 +123,28 @@ unicodePwd:: """ + base64.b64encode("\"P@ssw0rd\"".encode('utf-16-le')) + """ creds_user1.set_bind_dn(self.username + "@" + creds.get_realm()) creds_user1.set_password(self.password) print "BindTest with: " + creds_user1.get_bind_dn() - ldb_user1 = SamDB(host, credentials=creds_user1, session_info=system_session(), lp=lp) + ldb_user1 = samba.tests.connect_samdb(host, credentials=creds_user1, + lp=lp, ldap_only=True) res = ldb_user1.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"]) # do a simple bind and search with the user account in format domain\user creds_user2.set_bind_dn(creds.get_domain() + "\\" + self.username) creds_user2.set_password(self.password) print "BindTest with: " + creds_user2.get_bind_dn() - ldb_user2 = SamDB(host, credentials=creds_user2, lp=lp) + ldb_user2 = samba.tests.connect_samdb(host, credentials=creds_user2, + lp=lp, ldap_only=True) res = ldb_user2.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"]) # do a simple bind and search with the user account DN creds_user3.set_bind_dn(str(user_dn)) creds_user3.set_password(self.password) print "BindTest with: " + creds_user3.get_bind_dn() - ldb_user3 = SamDB(host, credentials=creds_user3, session_info=system_session(), lp=lp) + ldb_user3 = samba.tests.connect_samdb(host, credentials=creds_user3, + lp=lp, ldap_only=True) res = ldb_user3.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"]) -if not "://" in host: - host = "ldap://%s" % host -ldb = SamDB(host, credentials=creds, session_info=system_session(), lp=lp) + +ldb = samba.tests.connect_samdb(host, credentials=creds, lp=lp, ldap_only=True) runner = SubunitTestRunner() rc = 0 |