From fe767d4b70665bf8cf825455cb2c1db3fc2a1217 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Mon, 10 Aug 2009 11:06:33 +0200 Subject: s4:pwsettings script - Fix a small glitch This fixes the problem with the setting and getting of the "minPwdAge" and "maxPwdAge" attributes. I wanted to handle them in days but forgot to add conversions (from "ticks" (tenth of microsecond) -> "days" and backwards). --- source4/setup/pwsettings | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/source4/setup/pwsettings b/source4/setup/pwsettings index 8a4489b287..a2708531a1 100755 --- a/source4/setup/pwsettings +++ b/source4/setup/pwsettings @@ -77,8 +77,9 @@ try: pwd_props = int(res[0]["pwdProperties"][0]) pwd_hist_len = int(res[0]["pwdHistoryLength"][0]) min_pwd_len = int(res[0]["minPwdLength"][0]) - min_pwd_age = int(res[0]["minPwdAge"][0]) - max_pwd_age = int(res[0]["maxPwdAge"][0]) + # ticks -> days + min_pwd_age = int(abs(int(res[0]["minPwdAge"][0])) / (10e7 * 60 * 60 * 24)) + max_pwd_age = int(abs(int(res[0]["maxPwdAge"][0])) / (10e7 * 60 * 60 * 24)) except: if args[0] == "show": print "ERROR: Password informations missing in your AD domain object!" @@ -98,8 +99,8 @@ if args[0] == "show": print "Password complexity: off" print "Password history length: " + str(pwd_hist_len) print "Minimum password length: " + str(min_pwd_len) - print "Minimum password age: " + str(min_pwd_age) - print "Maximum password age: " + str(max_pwd_age) + print "Minimum password age (days): " + str(min_pwd_age) + print "Maximum password age (days): " + str(max_pwd_age) elif args[0] == "set": if opts.complexity is not None: @@ -168,6 +169,8 @@ elif args[0] == "set": min_pwd_age = 0 else: min_pwd_age = int(opts.min_pwd_age) + # days -> ticks + min_pwd_age = -int(min_pwd_age * (24 * 60 * 60 * 10e7)) m = ldb.Message() m.dn = ldb.Dn(samdb, domain_dn) @@ -181,9 +184,11 @@ elif args[0] == "set": if opts.max_pwd_age is not None: if opts.max_pwd_age == "default": - max_pwd_age = -37108517437440 + max_pwd_age = 43 else: max_pwd_age = int(opts.max_pwd_age) + # days -> ticks + max_pwd_age = -int(max_pwd_age * (24 * 60 * 60 * 10e7)) m = ldb.Message() m.dn = ldb.Dn(samdb, domain_dn) -- cgit