diff --git a/samba/personal/samba/class_sambaAccount.inc b/samba/personal/samba/class_sambaAccount.inc index c372a9d..c0e2536 100644 --- a/samba/personal/samba/class_sambaAccount.inc +++ b/samba/personal/samba/class_sambaAccount.inc @@ -49,7 +49,6 @@ class sambaAccount extends plugin var $sambaLogoffTime= "2147483647"; var $sambaKickoffTime= ""; var $sambaPwdCanChange= "0"; - var $sambaPwdMustChange= "0"; // Flags (checkboxes) to restrict account settings. var $sambaAcctFlags= "[UX ]"; @@ -80,7 +79,7 @@ class sambaAccount extends plugin var $ctxattributes= array(); var $attributes= array("sambaSID", "sambaPwdLastSet", "sambaLogonTime", "sambaLogoffTime", "sambaKickoffTime", "sambaPwdCanChange", - "sambaPwdMustChange", "sambaAcctFlags", "uid", "sambaMungedDial", + "sambaAcctFlags", "uid", "sambaMungedDial", "sambaHomePath", "sambaHomeDrive", "sambaLogonScript", "sambaProfilePath", "sambaPrimaryGroupSID", "sambaDomainName", "sambaUserWorkstations", "sambaPasswordHistory", @@ -182,19 +181,10 @@ class sambaAccount extends plugin // sambaPwdLastSet // _______________ // The integer time in seconds since 1970 when the sambaLMPassword and sambaNTPassword attributes were last set. - - // sambaPwdMustChange - // _______________ - // Specifies the time (UNIX time format) when the user is forced to change his password. If this - // value is set to 0, the user will have to change his password at first login. If this attribute is not - // set, then the password will never expire. - - - // A password change is enforced by using a timestamp in sambaPwdMustChange. // We simple set it to '0' to enforce a change. // -------------------------------- // Normally it contains a timestamp, which specifies and expiration date. - $this->flag_enforcePasswordChange = (isset($attrs['sambaPwdMustChange']) && $attrs['sambaPwdMustChange'][0] == '0'); + $this->flag_enforcePasswordChange = (isset($attrs['sambaPwdLastSet']) && $attrs['sambaPwdLastSet'][0] == '0'); // A user cannot change his password until the given timestamp has reached. // We simply set it to max int to disallow a password change till the timestamp reaches 4294967295, @@ -507,7 +497,7 @@ class sambaAccount extends plugin $smarty->assign("tsloginstate",""); } - // Create additional info for sambaKickOffTime and sambaPwdMustChange. + // Create additional info for sambaKickOffTime and sambaPwdLastSet. // e.g. Display effective kickoff time. Domain policy + user settings. $additional_info_PwdMustChange = ""; @@ -587,7 +577,6 @@ class sambaAccount extends plugin $sambaKickoffTime = "unset"; $sambaPwdCanChange = "unset"; - $sambaPwdMustChange = "unset"; $sambaBadPasswordCount = "unset"; $sambaBadPasswordTime = "unset"; @@ -600,7 +589,7 @@ class sambaAccount extends plugin /* User attributes */ $user_attributes = array("sambaBadPasswordTime","sambaPwdLastSet","sambaLogonTime","sambaLogoffTime", - "sambaKickoffTime","sambaPwdCanChange","sambaPwdMustChange","sambaBadPasswordCount", "sambaSID"); + "sambaKickoffTime","sambaPwdCanChange","sambaBadPasswordCount", "sambaSID"); /* Get samba SID object and parse settings. */ @@ -622,8 +611,8 @@ class sambaAccount extends plugin $$attr = $this->attrs[$attr][0]; } } - if (is_numeric($sambaPwdMustChange)) { - $sambaPwdMustChange= date('d.m.Y', $sambaPwdMustChange); + if (is_numeric($sambaPwdLastSet) && is_numeric($attr['sambaPwdMaxAge'])) { + $sambaPwdMustChange=date('d.m.Y', $sambaPwdLastSet+$attr['sambaPwdMaxAge']); } if (is_numeric($sambaKickoffTime)) { $sambaKickoffTime= date('d.m.Y', $sambaKickoffTime); @@ -752,7 +741,7 @@ class sambaAccount extends plugin /* sambaPwdMustChange: Timestamp of when the password will expire */ - if($sambaPwdMustChange == "unset" || empty($sambaPwdMustChange)){ + if($sambaMustChange == "unset" || empty($sambaPwdMustChange)){ $sambaPwdMustChange = "("._("unset").")"; } @@ -1004,14 +993,15 @@ class sambaAccount extends plugin // Handle "enforce password change" flag. if($this->flag_enforcePasswordChange){ - $this->attrs['sambaPwdMustChange'] = 0; + $this->attrs['sambaPwdLastSet'] = 0; }else{ // Keep old values if given. - if ($this->sambaPwdMustChange != "0"){ - $this->attrs['sambaPwdMustChange']= $this->sambaPwdMustChange; + if ($this->sambaPwdLastSet != "0"){ + $this->attrs['sambaPwdLastSet']= $this->sambaPwdLastSet; } else { - $this->attrs['sambaPwdMustChange']= array(); + $sid = $this->get_domain_info(); + $this->attrs['sambaPwdLastSet']= time(); } }