mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
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.
This commit is contained in:
parent
e80dbdcab1
commit
c48a2aa438
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user