mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
netcmd: Use python constant for -0x8000000000000000
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13873 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
d247a60084
commit
b43f997f23
@ -1255,6 +1255,10 @@ class cmd_domain_level(Command):
|
|||||||
raise CommandError("invalid argument: '%s' (choose from 'show', 'raise')" % subcommand)
|
raise CommandError("invalid argument: '%s' (choose from 'show', 'raise')" % subcommand)
|
||||||
|
|
||||||
|
|
||||||
|
# In MS AD, setting a timeout to '(never)' corresponds to this value
|
||||||
|
NEVER_TIMESTAMP = int(-0x8000000000000000)
|
||||||
|
|
||||||
|
|
||||||
class cmd_domain_passwordsettings_show(Command):
|
class cmd_domain_passwordsettings_show(Command):
|
||||||
"""Display current password settings for the domain."""
|
"""Display current password settings for the domain."""
|
||||||
|
|
||||||
@ -1290,13 +1294,13 @@ class cmd_domain_passwordsettings_show(Command):
|
|||||||
cur_min_pwd_len = int(res[0]["minPwdLength"][0])
|
cur_min_pwd_len = int(res[0]["minPwdLength"][0])
|
||||||
# ticks -> days
|
# ticks -> days
|
||||||
cur_min_pwd_age = int(abs(int(res[0]["minPwdAge"][0])) / (1e7 * 60 * 60 * 24))
|
cur_min_pwd_age = int(abs(int(res[0]["minPwdAge"][0])) / (1e7 * 60 * 60 * 24))
|
||||||
if int(res[0]["maxPwdAge"][0]) == -0x8000000000000000:
|
if int(res[0]["maxPwdAge"][0]) == NEVER_TIMESTAMP:
|
||||||
cur_max_pwd_age = 0
|
cur_max_pwd_age = 0
|
||||||
else:
|
else:
|
||||||
cur_max_pwd_age = int(abs(int(res[0]["maxPwdAge"][0])) / (1e7 * 60 * 60 * 24))
|
cur_max_pwd_age = int(abs(int(res[0]["maxPwdAge"][0])) / (1e7 * 60 * 60 * 24))
|
||||||
cur_account_lockout_threshold = int(res[0]["lockoutThreshold"][0])
|
cur_account_lockout_threshold = int(res[0]["lockoutThreshold"][0])
|
||||||
# ticks -> mins
|
# ticks -> mins
|
||||||
if int(res[0]["lockoutDuration"][0]) == -0x8000000000000000:
|
if int(res[0]["lockoutDuration"][0]) == NEVER_TIMESTAMP:
|
||||||
cur_account_lockout_duration = 0
|
cur_account_lockout_duration = 0
|
||||||
else:
|
else:
|
||||||
cur_account_lockout_duration = abs(int(res[0]["lockoutDuration"][0])) / (1e7 * 60)
|
cur_account_lockout_duration = abs(int(res[0]["lockoutDuration"][0])) / (1e7 * 60)
|
||||||
@ -1455,7 +1459,7 @@ class cmd_domain_passwordsettings_set(Command):
|
|||||||
|
|
||||||
# days -> ticks
|
# days -> ticks
|
||||||
if max_pwd_age == 0:
|
if max_pwd_age == 0:
|
||||||
max_pwd_age_ticks = -0x8000000000000000
|
max_pwd_age_ticks = NEVER_TIMESTAMP
|
||||||
else:
|
else:
|
||||||
max_pwd_age_ticks = -int(max_pwd_age * (24 * 60 * 60 * 1e7))
|
max_pwd_age_ticks = -int(max_pwd_age * (24 * 60 * 60 * 1e7))
|
||||||
|
|
||||||
@ -1474,7 +1478,7 @@ class cmd_domain_passwordsettings_set(Command):
|
|||||||
|
|
||||||
# minutes -> ticks
|
# minutes -> ticks
|
||||||
if account_lockout_duration == 0:
|
if account_lockout_duration == 0:
|
||||||
account_lockout_duration_ticks = -0x8000000000000000
|
account_lockout_duration_ticks = NEVER_TIMESTAMP
|
||||||
else:
|
else:
|
||||||
account_lockout_duration_ticks = -int(account_lockout_duration * (60 * 1e7))
|
account_lockout_duration_ticks = -int(account_lockout_duration * (60 * 1e7))
|
||||||
|
|
||||||
@ -1503,7 +1507,7 @@ class cmd_domain_passwordsettings_set(Command):
|
|||||||
|
|
||||||
# minutes -> ticks
|
# minutes -> ticks
|
||||||
if reset_account_lockout_after == 0:
|
if reset_account_lockout_after == 0:
|
||||||
reset_account_lockout_after_ticks = -0x8000000000000000
|
reset_account_lockout_after_ticks = NEVER_TIMESTAMP
|
||||||
else:
|
else:
|
||||||
reset_account_lockout_after_ticks = -int(reset_account_lockout_after * (60 * 1e7))
|
reset_account_lockout_after_ticks = -int(reset_account_lockout_after * (60 * 1e7))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user