From 93fe926842227bb7605503f69e471df765ab87e9 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Fri, 11 Jun 2010 10:04:50 +0200 Subject: 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. --- source4/lib/ldb/tests/python/passwords.py | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) 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) -- cgit