From c48a2aa43854636763cd6472ceba7f0c70185689 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Wed, 16 Nov 2011 12:59:52 +1100 Subject: 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. --- source4/scripting/python/samba/upgrade.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/scripting/python') 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') -- cgit