summaryrefslogtreecommitdiffstats
path: root/source/passdb
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2006-09-20 17:25:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:00:52 -0500
commitfd5761c9e52cbf8f1f7e45e71693598b27ecbf57 (patch)
tree52194c34d3d254753671b2ec18a1f0ec4bd175cb /source/passdb
parent867eeaafceaebde030a1d1e2fa39950b898b1846 (diff)
downloadsamba-fd5761c9e52cbf8f1f7e45e71693598b27ecbf57.tar.gz
samba-fd5761c9e52cbf8f1f7e45e71693598b27ecbf57.tar.xz
samba-fd5761c9e52cbf8f1f7e45e71693598b27ecbf57.zip
r18722: Fix up password change times. The can change and must change times are
calculated based on the last change time, policies, and acb flags. Next step will be to not bother storing them. Right now I'm just trying to get them reported correctly.
Diffstat (limited to 'source/passdb')
-rw-r--r--source/passdb/pdb_get_set.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/source/passdb/pdb_get_set.c b/source/passdb/pdb_get_set.c
index 6d437867af6..7aac8f58569 100644
--- a/source/passdb/pdb_get_set.c
+++ b/source/passdb/pdb_get_set.c
@@ -72,12 +72,32 @@ time_t pdb_get_pass_last_set_time(const struct samu *sampass)
time_t pdb_get_pass_can_change_time(const struct samu *sampass)
{
- return sampass->pass_can_change_time;
+ uint32 allow;
+
+ if (sampass->pass_last_set_time == 0)
+ return (time_t) 0;
+
+ if (!pdb_get_account_policy(AP_MIN_PASSWORD_AGE, &allow))
+ allow = 0;
+
+ return sampass->pass_last_set_time + allow;
}
time_t pdb_get_pass_must_change_time(const struct samu *sampass)
{
- return sampass->pass_must_change_time;
+ uint32 expire;
+
+ if (sampass->pass_last_set_time == 0)
+ return (time_t) 0;
+
+ if (sampass->acct_ctrl & ACB_PWNOEXP)
+ return get_time_t_max();
+
+ if (!pdb_get_account_policy(AP_MAX_PASSWORD_AGE, &expire)
+ || expire == (uint32)-1 || expire == 0)
+ return get_time_t_max();
+
+ return sampass->pass_last_set_time + expire;
}
uint16 pdb_get_logon_divs(const struct samu *sampass)