naota/pypassdb — pull request #2 by shimarin (2014-06-28 02:26:22+00:00)
Title: Set pass_last_set_time when password is set

pass_last_set_time field should be kept up to date or Samba may assume that password is invalid (in such case, pass_must_change_time is treated as 0 regardless a field in the same name).

source3/passdb/pdb_get_set.c

time_t pdb_get_pass_must_change_time(const struct samu *sampass)
{
uint32_t expire;

if (sampass->pass_last_set_time == 0)
return (time_t) 0;

if (sampass->acct_ctrl & ACB_PWNOEXP)
return pdb_password_change_time_max();

if (!pdb_get_account_policy(PDB_POLICY_MAX_PASSWORD_AGE, &expire)
|| expire == (uint32_t)-1 || expire == 0)
return get_time_t_max();

return sampass->pass_last_set_time + expire;
}