R26765 - in /branches/1.6/phpgwapi/inc: class.accounts_ldap.inc.php class.accounts_sql.inc.php class.auth_ldap.inc.php

Author: ralfbecker
New Revision: 26765

URL: http://www.egroupware.org/viewvc/egroupware?rev=3D26765&view=3Drev
Log:
Fixed not (always) updated last password change date

Modified:
branches/1.6/phpgwapi/inc/class.accounts_ldap.inc.php
branches/1.6/phpgwapi/inc/class.accounts_sql.inc.php
branches/1.6/phpgwapi/inc/class.auth_ldap.inc.php

Modified: branches/1.6/phpgwapi/inc/class.accounts_ldap.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/branches/1.6/phpgwapi/inc/=
class.accounts_ldap.inc.php?rev=3D26765&r1=3D26764&r2=3D26765&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
— branches/1.6/phpgwapi/inc/class.accounts_ldap.inc.php (original)
+++ branches/1.6/phpgwapi/inc/class.accounts_ldap.inc.php Thu Apr 9 08:44:=
02 2009
@@ -488,7 +488,7 @@
// shadowexpire is in days since 1970/01/01 (equivalent to a timestamp =
(int UTC!) / (246060)
‘account_status’ =3D> isset($data[‘shadowexpire’]) && $data[‘shadowe=
xpire’][0]243600+$utc_diff < time() ? false : ‘A’,
‘account_expires’ =3D> isset($data[‘shadowexpire’]) && $data[‘shadowe=
xpire’][0] ? $data[‘shadowexpire’][0]243600+$utc_diff : -1, // LDAP date =
is in UTC

  •   	'account_lastpasswd_change' =3D> isset($data['shadowlastchange']) ? $da=
    

ta[‘shadowlastchange’][0]243600 : null,

  •   	'account_lastpasswd_change' =3D> isset($data['shadowlastchange']) ? $da=
    

ta[‘shadowlastchange’][0]243600+$utc_diff : null,
// lastlogin and lastlogin from are not availible via the shadowAccount=
object class
// ‘account_lastlogin’ =3D> $data[‘phpgwaccountlastlogin’][0],
// ‘account_lastloginfrom’ =3D> $data[‘phpgwaccountlastloginfrom’][0],
@@ -548,6 +548,7 @@
}
$to_write[‘cn’] =3D $data[‘account_fullname’] ? $data[‘account_fu=
llname’] : $data[‘account_firstname’].’ '.$data[‘account_lastname’];

  •   $utc_diff =3D date('Z');
      if (isset($data['account_passwd']) && $data['account_passwd'])
      {
      	if (!preg_match('/^\\{[a-z5]{3,5}\\}.+/i',$data['account_passwd']))	// =
    

if it’s not already entcrypted, do so now
@@ -555,13 +556,13 @@
$data[‘account_passwd’] =3D auth::encrypt_ldap($data[‘account_passwd’]=
);
}
$to_write[‘userpassword’] =3D $data[‘account_passwd’];

  •   	$to_write['shadowLastChange'] =3D (time()-$utc_diff) / (24*3600);
      }
      // both status and expires are encoded in the single shadowexpire value =
    

in LDAP
// - if it’s unset an account is enabled AND does never expire
// - if it’s set to 0, the account is disabled
// - if it’s set to > 0, it will or already has expired --> acount is ac=
tive if it not yet expired
// shadowexpire is in days since 1970/01/01 (equivalent to a timestamp (=
int UTC!) / (246060)

  •   $utc_diff =3D date('Z');
      $shadowexpire =3D ($data['account_expires']-$utc_diff) / (24*3600);
      $account_expire =3D $shadowexpire*3600*24+$utc_diff;
      //echo "<p align=3Dright>account_expires=3D".date('Y-m-d H:i',$data['acc=
    

ount_expires’])." --> $shadowexpire --> “.date(‘Y-m-d H:i’,$account_expire)=
.”

\n";
@@ -714,7 +715,7 @@
$relevantAccounts =3D is_numeric($start) ? array_slice(array_keys($ful=
lSet), $start, $offset) : array_keys($fullSet);
// if we do not have a start, or want the members of a certain group, =
we want all, that way we dont want to or the uids
// since if we have a whole lot of members, it slows the query down
  •   		// if you work with very big groups, it may present a problem =
    
  •   		// if you work with very big groups, it may present a problem
      		if (is_numeric($start) || is_numeric($param['type'])) {
      			$filter =3D "(" . "&(objectclass=3Dposixaccount)" . '(|(uid=3D'.implo=
    

de(’)(uid=3D’,$relevantAccounts).’))’ . $this->account_filter . “)”;
} else {

Modified: branches/1.6/phpgwapi/inc/class.accounts_sql.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/branches/1.6/phpgwapi/inc/=
class.accounts_sql.inc.php?rev=3D26765&r1=3D26764&r2=3D26765&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
— branches/1.6/phpgwapi/inc/class.accounts_sql.inc.php (original)
+++ branches/1.6/phpgwapi/inc/class.accounts_sql.inc.php Thu Apr 9 08:44:0=
2 2009
@@ -167,6 +167,7 @@
$data[‘account_passwd’] =3D $GLOBALS[‘egw’]->auth->encrypt_sql($data[’=
account_passwd’]);
}
$to_write[‘account_pwd’] =3D $data[‘account_passwd’];

  •   	$to_write['account_lastpwd_change'] =3D time();
      }
      if (!(int)$data['account_id'] || !$this->id2name($data['account_id']))
      {
    

Modified: branches/1.6/phpgwapi/inc/class.auth_ldap.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/branches/1.6/phpgwapi/inc/=
class.auth_ldap.inc.php?rev=3D26765&r1=3D26764&r2=3D26765&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
— branches/1.6/phpgwapi/inc/class.auth_ldap.inc.php (original)
+++ branches/1.6/phpgwapi/inc/class.auth_ldap.inc.php Thu Apr 9 08:44:02 2=
009
@@ -1,10 +1,10 @@

<?php /** * eGroupWare API - LDAP Authentication - * = + * * @link http://www.egroupware.org * @author Lars Kneschke - * @author Joseph Engo = + * @author Joseph Engo * Copyright (C) 2000, 2001 Joseph Engo * Copyright (C) 2002, 2003 Lars Kneschke * @license http://opensource.org/licenses/lgpl-license.php LGPL - GNU Le= sser General Public License @@ -107,9 +107,9 @@ /** * changes password in LDAP * - * If $old_passwd is given, the password change is done binded as user an= d NOT with the = + * If $old_passwd is given, the password change is done binded as user an= d NOT with the * "root" dn given in the configurations. - * = + * * @param string $old_passwd must be cleartext or empty to not to be chec= ked * @param string $new_passwd must be cleartext * @param int $account_id account id of user whose passwd should be chang= ed @@ -134,8 +134,10 @@ $ds =3D $GLOBALS['egw']->common->ldapConnect(); $sri =3D ldap_search($ds, $GLOBALS['egw_info']['server']['ldap_context']= , $filter); $allValues =3D ldap_get_entries($ds, $sri); - = + $entry['userpassword'] =3D auth::encrypt_password($new_passwd); + $entry['shadowLastChange'] =3D (time()-date('Z')) / (24*3600); + $dn =3D $allValues[0]['dn']; = if($old_passwd) // if old password given (not called by admin) --> bind = as that user to change the pw ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ eGroupWare-cvs mailing list eGroupWare-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/egroupware-cvs