From 87cbd9ab68ed5f0831440009b16915edc7473e49 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 22 Mar 2003 08:07:53 +0000 Subject: Patch from Jianliang Lu to set the 'minimum password age' when setting the password. Andrew Bartlett (This used to be commit 552198b9e149c41f8cb2f976421ef030eac6fba6) --- source3/passdb/pdb_get_set.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3/passdb/pdb_get_set.c') diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c index 2efe720474..a86d936263 100644 --- a/source3/passdb/pdb_get_set.c +++ b/source3/passdb/pdb_get_set.c @@ -1064,6 +1064,7 @@ BOOL pdb_set_hours (SAM_ACCOUNT *sampass, const uint8 *hours, enum pdb_value_sta BOOL pdb_set_pass_changed_now (SAM_ACCOUNT *sampass) { uint32 expire; + uint32 min_age; if (!sampass) return False; @@ -1082,6 +1083,16 @@ BOOL pdb_set_pass_changed_now (SAM_ACCOUNT *sampass) return False; } + if (!account_policy_get(AP_MIN_PASSWORD_AGE, &min_age) + || (min_age==(uint32)-1)) { + if (!pdb_set_pass_can_change_time (sampass, 0, PDB_CHANGED)) + return False; + } else { + if (!pdb_set_pass_can_change_time (sampass, + pdb_get_pass_last_set_time(sampass) + + min_age, PDB_CHANGED)) + return False; + } return True; } -- cgit