Navigation Menu

Skip to content

Commit

Permalink
Set "password last set" time in passdb entries (#2949)
Browse files Browse the repository at this point in the history
  • Loading branch information
anodos325 committed Apr 24, 2019
1 parent b668b52 commit 2768ea4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/middlewared/middlewared/plugins/smb.py
Expand Up @@ -428,9 +428,14 @@ def update_passdb_user(self, username):
except Exception:
nt_passwd = ''

pass_last_set_time = int(smbpasswd_string[5].strip("LCT-"), 16)

if smbpasswd_string[3] != nt_passwd:
p.nt_passwd = binascii.unhexlify(smbpasswd_string[3])
pdb_entry_changed = True
if pass_last_set_time != p.pass_last_set_time:
p.pass_last_set_time = pass_last_set_time
pdb_entry_changed = True
if 'D' in smbpasswd_string[4] and not (p.acct_ctrl & SAMR_AcctFlags.DISABLED):
p.acct_ctrl |= SAMR_AcctFlags.DISABLED
pdb_entry_changed = True
Expand Down Expand Up @@ -480,9 +485,14 @@ def synchronize_passdb(self):
except Exception:
nt_passwd = ''

pass_last_set_time = int(smbpasswd_string[5].strip("LCT-"), 16)

if smbpasswd_string[3] != nt_passwd:
p.nt_passwd = binascii.unhexlify(smbpasswd_string[3])
pdb_entry_changed = True
if pass_last_set_time != p.pass_last_set_time:
p.pass_last_set_time = pass_last_set_time
pdb_entry_changed = True
if 'D' in smbpasswd_string[4] and not (p.acct_ctrl & SAMR_AcctFlags.DISABLED):
p.acct_ctrl |= SAMR_AcctFlags.DISABLED
pdb_entry_changed = True
Expand Down

0 comments on commit 2768ea4

Please sign in to comment.