From 53c78cd9e2dfcddadf232c887f73cb73b57332f6 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Fri, 23 Sep 2011 11:10:05 +0000 Subject: [PATCH] as the timestamp used for ldap is not the unixtimestamp, we just use time for updating the session cache on auth_alpwchange_val --- phpgwapi/inc/class.auth.inc.php | 4 ++-- phpgwapi/inc/class.auth_ldap.inc.php | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/phpgwapi/inc/class.auth.inc.php b/phpgwapi/inc/class.auth.inc.php index 81f036ca06..85e6a3baac 100644 --- a/phpgwapi/inc/class.auth.inc.php +++ b/phpgwapi/inc/class.auth.inc.php @@ -164,8 +164,8 @@ class auth elseif ($passwordAgeBorder > $alpwchange_val && $alpwchange_val > 0) { error_log(__METHOD__.' Password of '.$GLOBALS['egw_info']['user']['account_lid'].' ('.$GLOBALS['egw_info']['user']['account_fullname'].') is of old age.'.array2string(array( - 'ts'=>$GLOBALS['egw_info']['user']['account_lastpwd_change'], - 'date'=>egw_time::to($GLOBALS['egw_info']['user']['account_lastpwd_change'])))); + 'ts'=> $alpwchange_val, + 'date'=>egw_time::to($alpwchange_val)))); $message = lang('it has been more then %1 days since you changed your password',$GLOBALS['egw_info']['server']['change_pwd_every_x_days']); } if ($GLOBALS['egw_info']['user']['apps']['password']) egw::redirect_link('/preferences/password.php',array('message'=>$message)); diff --git a/phpgwapi/inc/class.auth_ldap.inc.php b/phpgwapi/inc/class.auth_ldap.inc.php index 3d897dcf80..a570c43992 100644 --- a/phpgwapi/inc/class.auth_ldap.inc.php +++ b/phpgwapi/inc/class.auth_ldap.inc.php @@ -245,7 +245,8 @@ class auth_ldap implements auth_backend { return false; } - if (!$admin) egw_cache::setSession('phpgwapi','auth_alpwchange_val',$entry['shadowlastchange']); + // using time() is sufficient to represent the current time, we do not need the timestamp written to the storage + if (!$admin) egw_cache::setSession('phpgwapi','auth_alpwchange_val',(is_null($lastpwdchange) || $lastpwdchange<0 ? time():$lastpwdchange)); return true; } @@ -300,7 +301,8 @@ class auth_ldap implements auth_backend if($old_passwd) // if old password given (not called by admin) update the password in the session { $GLOBALS['egw']->session->appsession('password','phpgwapi',$new_passwd); - egw_cache::setSession('phpgwapi','auth_alpwchange_val',$entry['shadowlastchange']); + // using time() is sufficient to represent the current time, we do not need the timestamp written to the storage + egw_cache::setSession('phpgwapi','auth_alpwchange_val',time()); } return $entry['userpassword']; }