summaryrefslogtreecommitdiff
path: root/source4/setup/pwsettings
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-08-26 01:33:21 +0200
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-09-06 12:29:31 +0200
commit89d40419d5c38364e7e88c873c1f83f270357756 (patch)
treefdd6b7c6ef1f5826b6a88d5d7017a6d4f0ef6a52 /source4/setup/pwsettings
parent3694160ad91cc4aac5a47f7a2d920e37432db145 (diff)
downloadsamba-89d40419d5c38364e7e88c873c1f83f270357756.tar.gz
samba-89d40419d5c38364e7e88c873c1f83f270357756.tar.bz2
samba-89d40419d5c38364e7e88c873c1f83f270357756.zip
s4:pwsettings - Introduce the LDB modify flags in the right way
We can't emulate them through the LDB changetype flags since they haven't the same constants! The previous behaviour led to huge problems.
Diffstat (limited to 'source4/setup/pwsettings')
-rwxr-xr-xsource4/setup/pwsettings35
1 files changed, 8 insertions, 27 deletions
diff --git a/source4/setup/pwsettings b/source4/setup/pwsettings
index fc59f8c404..49bb5519b3 100755
--- a/source4/setup/pwsettings
+++ b/source4/setup/pwsettings
@@ -82,9 +82,8 @@ except:
print "So no settings can be displayed!"
sys.exit(1)
else:
- if pwd_props is None:
- pwd_props = 0
- print "WARNING: Assuming previous password properties 0 (used for password complexity setting)"
+ pwd_props = 0
+ print "WARNING: Assuming previous password properties 0 (used for password complexity setting)"
if args[0] == "show":
print "Password informations for domain '" + domain_dn + "'"
@@ -105,11 +104,8 @@ elif args[0] == "set":
m = ldb.Message()
m.dn = ldb.Dn(samdb, domain_dn)
- m["pwdProperties"] = ldb.MessageElement([],
- ldb.CHANGETYPE_DELETE, "pwdProperties")
- samdb.modify(m)
m["pwdProperties"] = ldb.MessageElement(str(pwd_props),
- ldb.CHANGETYPE_ADD, "pwdProperties")
+ ldb.FLAG_MOD_REPLACE, "pwdProperties")
samdb.modify(m)
print "Password complexity activated!"
elif opts.complexity == "off":
@@ -117,11 +113,8 @@ elif args[0] == "set":
m = ldb.Message()
m.dn = ldb.Dn(samdb, domain_dn)
- m["pwdProperties"] = ldb.MessageElement([],
- ldb.CHANGETYPE_DELETE, "pwdProperties")
- samdb.modify(m)
m["pwdProperties"] = ldb.MessageElement(str(pwd_props),
- ldb.CHANGETYPE_ADD, "pwdProperties")
+ ldb.FLAG_MOD_REPLACE, "pwdProperties")
samdb.modify(m)
print "Password complexity deactivated!"
else:
@@ -136,11 +129,8 @@ elif args[0] == "set":
m = ldb.Message()
m.dn = ldb.Dn(samdb, domain_dn)
- m["pwdHistoryLength"] = ldb.MessageElement([],
- ldb.CHANGETYPE_DELETE, "pwdHistoryLength")
- samdb.modify(m)
m["pwdHistoryLength"] = ldb.MessageElement(str(pwd_hist_len),
- ldb.CHANGETYPE_ADD, "pwdHistoryLength")
+ ldb.FLAG_MOD_REPLACE, "pwdHistoryLength")
samdb.modify(m)
print "Password history length changed!"
@@ -152,11 +142,8 @@ elif args[0] == "set":
m = ldb.Message()
m.dn = ldb.Dn(samdb, domain_dn)
- m["minPwdLength"] = ldb.MessageElement([],
- ldb.CHANGETYPE_DELETE, "minPwdLength")
- samdb.modify(m)
m["minPwdLength"] = ldb.MessageElement(str(min_pwd_len),
- ldb.CHANGETYPE_ADD, "minPwdLength")
+ ldb.FLAG_MOD_REPLACE, "minPwdLength")
samdb.modify(m)
print "Minimum password length changed!"
@@ -170,11 +157,8 @@ elif args[0] == "set":
m = ldb.Message()
m.dn = ldb.Dn(samdb, domain_dn)
- m["minPwdAge"] = ldb.MessageElement([],
- ldb.CHANGETYPE_DELETE, "minPwdAge")
- samdb.modify(m)
m["minPwdAge"] = ldb.MessageElement(str(min_pwd_age),
- ldb.CHANGETYPE_ADD, "minPwdAge")
+ ldb.FLAG_MOD_REPLACE, "minPwdAge")
samdb.modify(m)
print "Minimum password age changed!"
@@ -188,11 +172,8 @@ elif args[0] == "set":
m = ldb.Message()
m.dn = ldb.Dn(samdb, domain_dn)
- m["maxPwdAge"] = ldb.MessageElement([],
- ldb.CHANGETYPE_DELETE, "maxPwdAge")
- samdb.modify(m)
m["maxPwdAge"] = ldb.MessageElement(str(max_pwd_age),
- ldb.CHANGETYPE_ADD, "maxPwdAge")
+ ldb.FLAG_MOD_REPLACE, "maxPwdAge")
samdb.modify(m)
print "Maximum password age changed!"