Skip to content

Commit 2768ea4

Browse files
authored
Set "password last set" time in passdb entries (#2949)
1 parent b668b52 commit 2768ea4

File tree

1 file changed

+10
-0
lines changed
  • src/middlewared/middlewared/plugins

1 file changed

+10
-0
lines changed

src/middlewared/middlewared/plugins/smb.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,14 @@ def update_passdb_user(self, username):
428428
except Exception:
429429
nt_passwd = ''
430430

431+
pass_last_set_time = int(smbpasswd_string[5].strip("LCT-"), 16)
432+
431433
if smbpasswd_string[3] != nt_passwd:
432434
p.nt_passwd = binascii.unhexlify(smbpasswd_string[3])
433435
pdb_entry_changed = True
436+
if pass_last_set_time != p.pass_last_set_time:
437+
p.pass_last_set_time = pass_last_set_time
438+
pdb_entry_changed = True
434439
if 'D' in smbpasswd_string[4] and not (p.acct_ctrl & SAMR_AcctFlags.DISABLED):
435440
p.acct_ctrl |= SAMR_AcctFlags.DISABLED
436441
pdb_entry_changed = True
@@ -480,9 +485,14 @@ def synchronize_passdb(self):
480485
except Exception:
481486
nt_passwd = ''
482487

488+
pass_last_set_time = int(smbpasswd_string[5].strip("LCT-"), 16)
489+
483490
if smbpasswd_string[3] != nt_passwd:
484491
p.nt_passwd = binascii.unhexlify(smbpasswd_string[3])
485492
pdb_entry_changed = True
493+
if pass_last_set_time != p.pass_last_set_time:
494+
p.pass_last_set_time = pass_last_set_time
495+
pdb_entry_changed = True
486496
if 'D' in smbpasswd_string[4] and not (p.acct_ctrl & SAMR_AcctFlags.DISABLED):
487497
p.acct_ctrl |= SAMR_AcctFlags.DISABLED
488498
pdb_entry_changed = True

0 commit comments

Comments
 (0)