summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tests
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-06-11 10:04:50 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-06-11 10:04:50 +0200
commit93fe926842227bb7605503f69e471df765ab87e9 (patch)
tree32352e44c2a7c8652d212a5a136cd629f6e7a696 /source4/lib/ldb/tests
parent61976e4fcf49b340a50487d177dea38321ab0e06 (diff)
downloadsamba-93fe926842227bb7605503f69e471df765ab87e9.tar.gz
samba-93fe926842227bb7605503f69e471df765ab87e9.tar.bz2
samba-93fe926842227bb7605503f69e471df765ab87e9.zip
s4:passwords.py - set the "dSHeuristics"
As per Nadia's request and abartlet's suggestion the test now also sets the "dSHeuristics" attribute properly to be able to perform the tests also against Windows without further configuration. The code has the neat feature that it undoes the change and resets the behaviour as it was before.
Diffstat (limited to 'source4/lib/ldb/tests')
-rwxr-xr-xsource4/lib/ldb/tests/python/passwords.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/source4/lib/ldb/tests/python/passwords.py b/source4/lib/ldb/tests/python/passwords.py
index 5988cf6b1a..c26bbf0a12 100755
--- a/source4/lib/ldb/tests/python/passwords.py
+++ b/source4/lib/ldb/tests/python/passwords.py
@@ -572,8 +572,41 @@ if not "://" in host:
ldb = SamDB(url=host, session_info=system_session(), credentials=creds, lp=lp)
+# Gets back the configuration basedn
+res = ldb.search(base="", expression="", scope=SCOPE_BASE,
+ attrs=["configurationNamingContext"])
+configuration_dn = res[0]["configurationNamingContext"][0]
+
+# Get the old "dSHeuristics" if it was set
+res = ldb.search("CN=Directory Service, CN=Windows NT, CN=Services, "
+ + configuration_dn, scope=SCOPE_BASE, attrs=["dSHeuristics"])
+if "dSHeuristics" in res[0]:
+ dsheuristics = res[0]["dSHeuristics"][0]
+else:
+ dsheuristics = None
+
+# Set the "dSHeuristics" to have the tests run against Windows Server
+m = Message()
+m.dn = Dn(ldb, "CN=Directory Service, CN=Windows NT, CN=Services, "
+ + configuration_dn)
+m["dSHeuristics"] = MessageElement("000000001", FLAG_MOD_REPLACE,
+ "dSHeuristics")
+ldb.modify(m)
+
runner = SubunitTestRunner()
rc = 0
if not runner.run(unittest.makeSuite(PasswordTests)).wasSuccessful():
rc = 1
+
+# Reset the "dSHeuristics" as they were before
+m = Message()
+m.dn = Dn(ldb, "CN=Directory Service, CN=Windows NT, CN=Services, "
+ + configuration_dn)
+if dsheuristics is not None:
+ m["dSHeuristics"] = MessageElement(dsheuristics, FLAG_MOD_REPLACE,
+ "dSHeuristics")
+else:
+ m["dSHeuristics"] = MessageElement([], FLAG_MOD_DELETE, "dsHeuristics")
+ldb.modify(m)
+
sys.exit(rc)