summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2005-08-10 16:02:32 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:00:28 -0500
commit3662fb6d3ae14750520c6567a6d488f1b7a377d6 (patch)
tree5317d40447375d2c2a49df7cf36e9b43c876a61f /source3
parentbc3aaeac6fe2dd6a98910e22bb36acb477fc6f96 (diff)
downloadsamba-3662fb6d3ae14750520c6567a6d488f1b7a377d6.tar.gz
samba-3662fb6d3ae14750520c6567a6d488f1b7a377d6.tar.bz2
samba-3662fb6d3ae14750520c6567a6d488f1b7a377d6.zip
r9229: merge from trunk:
allow admins to uncheck the "User must change Password at next Logon" checkbox in Usermanager. Guenther (This used to be commit b1e4b72c1c36869c4dfc5ed284be24edc99f6774)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_samr_util.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/source3/rpc_server/srv_samr_util.c b/source3/rpc_server/srv_samr_util.c
index 66cf1cc46d..24869d5d2b 100644
--- a/source3/rpc_server/srv_samr_util.c
+++ b/source3/rpc_server/srv_samr_util.c
@@ -286,7 +286,25 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
DEBUG(10,("INFO_21 PASS_MUST_CHANGE_AT_NEXT_LOGON: %02X\n",from->passmustchange));
if (from->passmustchange==PASS_MUST_CHANGE_AT_NEXT_LOGON) {
- pdb_set_pass_must_change_time(to,0, PDB_CHANGED);
+ pdb_set_pass_must_change_time(to,0, PDB_CHANGED);
+ } else {
+ uint32 expire;
+ time_t new_time;
+ if (pdb_get_pass_must_change_time(to) == 0) {
+ if (!account_policy_get(AP_MAX_PASSWORD_AGE, &expire)
+ || expire == (uint32)-1) {
+ new_time = get_time_t_max();
+ } else {
+ time_t old_time = pdb_get_pass_last_set_time(to);
+ new_time = old_time + expire;
+ if ((new_time) < time(0)) {
+ new_time = time(0) + expire;
+ }
+ }
+ if (!pdb_set_pass_must_change_time (to, new_time, PDB_CHANGED)) {
+ DEBUG (0, ("pdb_set_pass_must_change_time failed!\n"));
+ }
+ }
}
DEBUG(10,("INFO_21 PADDING_2: %02X\n",from->padding2));
@@ -490,7 +508,6 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
DEBUG(15,("INFO_23 LOGON_HRS.HOURS: %s -> %s\n",pdb_get_hours(to),from->logon_hrs.hours));
/* Fix me: only update if it changes --metze */
pdb_set_hours(to, from->logon_hrs.hours, PDB_CHANGED);
-
}
if (from->fields_present & ACCT_BAD_PWD_COUNT) {
@@ -510,6 +527,24 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
DEBUG(10,("INFO_23 PASS_MUST_CHANGE_AT_NEXT_LOGON: %02X\n",from->passmustchange));
if (from->passmustchange==PASS_MUST_CHANGE_AT_NEXT_LOGON) {
pdb_set_pass_must_change_time(to,0, PDB_CHANGED);
+ } else {
+ uint32 expire;
+ time_t new_time;
+ if (pdb_get_pass_must_change_time(to) == 0) {
+ if (!account_policy_get(AP_MAX_PASSWORD_AGE, &expire)
+ || expire == (uint32)-1) {
+ new_time = get_time_t_max();
+ } else {
+ time_t old_time = pdb_get_pass_last_set_time(to);
+ new_time = old_time + expire;
+ if ((new_time) < time(0)) {
+ new_time = time(0) + expire;
+ }
+ }
+ if (!pdb_set_pass_must_change_time (to, new_time, PDB_CHANGED)) {
+ DEBUG (0, ("pdb_set_pass_must_change_time failed!\n"));
+ }
+ }
}
DEBUG(10,("INFO_23 PADDING_2: %02X\n",from->padding2));