summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-03-22 08:07:53 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-03-22 08:07:53 +0000
commit87cbd9ab68ed5f0831440009b16915edc7473e49 (patch)
tree998fd972fae1643f482c6766c580b5ce2c600f5f /source3/passdb
parent58cd54aeb8320e28b348ab7045fd348561c0a5c2 (diff)
downloadsamba-87cbd9ab68ed5f0831440009b16915edc7473e49.tar.gz
samba-87cbd9ab68ed5f0831440009b16915edc7473e49.tar.bz2
samba-87cbd9ab68ed5f0831440009b16915edc7473e49.zip
Patch from Jianliang Lu <j.lu@tiesse.com> to set the 'minimum password age'
when setting the password. Andrew Bartlett (This used to be commit 552198b9e149c41f8cb2f976421ef030eac6fba6)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/pdb_get_set.c11
1 files changed, 11 insertions, 0 deletions
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;
}