From c6d1e756649408412d72e5ad2789804b2908b6f2 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Oct 2001 10:54:11 +0000 Subject: - fix handling of 0 last_change_time and must_change_time - move the arbitrary 21 day timeout to local.h (This used to be commit 11075f543470c3283accce0246d0b2983420695a) --- source3/passdb/passdb.c | 10 +++++----- source3/passdb/pdb_smbpasswd.c | 9 +++++---- source3/passdb/pdb_tdb.c | 3 --- 3 files changed, 10 insertions(+), 12 deletions(-) (limited to 'source3/passdb') diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index 75f2d432f2..2ffbe42f8c 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -79,11 +79,11 @@ static BOOL pdb_fill_default_sam(SAM_ACCOUNT *user) ZERO_STRUCTP(user); user->logon_time = (time_t)0; - user->logoff_time = (time_t)-1; - user->kickoff_time = (time_t)-1; - user->pass_last_set_time = (time_t)-1; - user->pass_can_change_time = (time_t)-1; - user->pass_must_change_time = (time_t)-1; + user->logoff_time = (time_t)0; + user->kickoff_time = (time_t)0; + user->pass_last_set_time = (time_t)0; + user->pass_can_change_time = (time_t)0; + user->pass_must_change_time = (time_t)0; user->unknown_3 = 0x00ffffff; /* don't know */ user->logon_divs = 168; /* hours per week */ diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c index bca7541782..f487dcf347 100644 --- a/source3/passdb/pdb_smbpasswd.c +++ b/source3/passdb/pdb_smbpasswd.c @@ -1219,10 +1219,11 @@ static BOOL build_sam_account(SAM_ACCOUNT *sam_pass, struct smb_passwd *pw_buf) pdb_set_dir_drive (sam_pass, lp_logon_drive()); - /* FIXME!! What should this be set to? New smb.conf parameter maybe? - max password age? For now, we'll use the current time + 21 days. - --jerry */ - pdb_set_pass_must_change_time (sam_pass, time(NULL)+1814400); + /* the smbpasswd format doesn't have a must change time field, so + we can't get this right. The best we can do is to set this to + some time in the future. 21 days seems as reasonable as any other value :) + */ + pdb_set_pass_must_change_time (sam_pass, pw_buf->pass_last_set_time + MAX_PASSWORD_AGE); /* check if this is a user account or a machine account */ if (samlogon_user[strlen(samlogon_user)-1] != '$') diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 9b932b7821..43eefa5c7a 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -466,9 +466,6 @@ BOOL pdb_getsampwent(SAM_ACCOUNT *user) pdb_set_uid (user, uid); pdb_set_gid (user, gid); - /* 21 days from present */ - pdb_set_pass_must_change_time(user, time(NULL)+1814400); - standard_sub_advanced(-1, pdb_get_username(user), "", gid, pdb_get_logon_script(user)); standard_sub_advanced(-1, pdb_get_username(user), "", gid, pdb_get_profile_path(user)); standard_sub_advanced(-1, pdb_get_username(user), "", gid, pdb_get_homedir(user)); -- cgit