summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorNadezhda Ivanova <nivanova@samba.org>2010-11-22 18:34:18 +0200
committerNadezhda Ivanova <nivanova@samba.org>2010-11-22 18:52:04 +0200
commitc88b90e9f69554832a4932cbc9e44ea1c3bd2b81 (patch)
tree884df45bbd3b3a205b95914fc9f18d708ee8af7e /source4
parentb85dfce74511dac7e623076ef13bf6d3e9f71a20 (diff)
downloadsamba-c88b90e9f69554832a4932cbc9e44ea1c3bd2b81.tar.gz
samba-c88b90e9f69554832a4932cbc9e44ea1c3bd2b81.tar.bz2
samba-c88b90e9f69554832a4932cbc9e44ea1c3bd2b81.zip
s4-dsdb: Added a helper to python SamDB for retrieving and setting minPwdAge.
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/python/samba/samdb.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py
index 61d7c3ec80..460c8b898c 100644
--- a/source4/scripting/python/samba/samdb.py
+++ b/source4/scripting/python/samba/samdb.py
@@ -602,3 +602,18 @@ accountExpires: %u
def get_partitions_dn(self):
return dsdb._dsdb_get_partitions_dn(self)
+
+ def set_minPwdAge(self, value):
+ m = ldb.Message()
+ m.dn = ldb.Dn(self, self.domain_dn())
+ m["minPwdAge"] = ldb.MessageElement(value, ldb.FLAG_MOD_REPLACE, "minPwdAge")
+ self.modify(m)
+
+ def get_minPwdAge(self):
+ res = self.search(self.domain_dn(), scope=ldb.SCOPE_BASE, attrs=["minPwdAge"])
+ if len(res) == 0:
+ return None
+ elif not "minPwdAge" in res[0]:
+ return None
+ else:
+ return res[0]["minPwdAge"][0]