summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorNadezhda Ivanova <nivanova@samba.org>2010-11-23 11:20:12 +0200
committerNadezhda Ivanova <nivanova@samba.org>2010-11-23 11:22:26 +0200
commiteaa9733a83b23da8c54cc2975c4ff3c854bbc30f (patch)
tree8198a23434862cdaa464bfa0a70305d4b314e277 /source4
parent95edbc382d8167b59a79a570aff664ba806de809 (diff)
downloadsamba-eaa9733a83b23da8c54cc2975c4ff3c854bbc30f.tar.gz
samba-eaa9733a83b23da8c54cc2975c4ff3c854bbc30f.tar.bz2
samba-eaa9733a83b23da8c54cc2975c4ff3c854bbc30f.zip
s4-dsdb: Added python helpers for getting and seting dSHeuristics to SamDB
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/python/samba/samdb.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py
index 460c8b898c..7bc461a030 100644
--- a/source4/scripting/python/samba/samdb.py
+++ b/source4/scripting/python/samba/samdb.py
@@ -617,3 +617,27 @@ accountExpires: %u
return None
else:
return res[0]["minPwdAge"][0]
+
+ def set_dsheuristics(self, dsheuristics):
+ m = ldb.Message()
+ m.dn = ldb.Dn(self, "CN=Directory Service,CN=Windows NT,CN=Services,%s"
+ % self.get_config_basedn().get_linearized())
+ if dsheuristics is not None:
+ m["dSHeuristics"] = ldb.MessageElement(dsheuristics, ldb.FLAG_MOD_REPLACE,
+ "dSHeuristics")
+ else:
+ m["dSHeuristics"] = ldb.MessageElement([], ldb.FLAG_MOD_DELETE, "dSHeuristics")
+ self.modify(m)
+
+ def get_dsheuristics(self):
+ res = self.search("CN=Directory Service,CN=Windows NT,CN=Services,%s"
+ % self.get_config_basedn().get_linearized(),
+ scope=ldb.SCOPE_BASE, attrs=["dSHeuristics"])
+ if len(res) == 0:
+ dsheuristics = None
+ elif "dSHeuristics" in res[0]:
+ dsheuristics = res[0]["dSHeuristics"][0]
+ else:
+ dsheuristics = None
+
+ return dsheuristics