summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2011-11-16 12:59:52 +1100
committerAmitay Isaacs <amitay@gmail.com>2011-11-18 14:38:27 +1100
commitc48a2aa43854636763cd6472ceba7f0c70185689 (patch)
treecd638aa467b4990ba3cc22ae1cbf9b64b218c416 /source4/scripting/python
parente80dbdcab1831bd07e76863acaea4e356f71cf98 (diff)
downloadsamba-c48a2aa43854636763cd6472ceba7f0c70185689.tar.gz
samba-c48a2aa43854636763cd6472ceba7f0c70185689.tar.bz2
samba-c48a2aa43854636763cd6472ceba7f0c70185689.zip
s4-s3-upgrade: Fix the minimum and maximum password age calculation
Windows sets maxPwdAge to -0x8000000000000000 when maximum password age is set to 0 days.
Diffstat (limited to 'source4/scripting/python')
-rw-r--r--source4/scripting/python/samba/upgrade.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py
index c58364bcfe..53f1206d21 100644
--- a/source4/scripting/python/samba/upgrade.py
+++ b/source4/scripting/python/samba/upgrade.py
@@ -60,15 +60,15 @@ def import_sam_policy(samdb, policy, logger):
ldb.FLAG_MOD_REPLACE, 'pwdHistoryLength')
min_pw_age_unix = policy['minimum password age']
- min_pw_age_nt = 0 - unix2nttime(min_pw_age_unix)
+ min_pw_age_nt = int(-min_pw_age_unix * (1e7 * 60 * 60 * 24))
m['a03'] = ldb.MessageElement(str(min_pw_age_nt), ldb.FLAG_MOD_REPLACE,
'minPwdAge')
max_pw_age_unix = policy['maximum password age']
- if (max_pw_age_unix == -1):
- max_pw_age_nt = 0
+ if max_pw_age_unix == -1:
+ max_pw_age_nt = -0x8000000000000000
else:
- max_pw_age_nt = unix2nttime(max_pw_age_unix)
+ max_pw_age_nt = int(-max_pw_age_unix * (1e7 * 60 * 60 * 24))
m['a04'] = ldb.MessageElement(str(max_pw_age_nt), ldb.FLAG_MOD_REPLACE,
'maxPwdAge')