summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-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!"