0010858: LDAP plain password not possible
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 14 Apr 2015 16:04:16 +0000 (18:04 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 15 Apr 2015 12:08:06 +0000 (14:08 +0200)
* prevent hashing of plain passwords
* fixes duplicate array key "adr_one_region"

https://forge.tine20.org/view.php?id=10858

Change-Id: I4e2ba49549e16202627bf7d55a2aef34bca8ce10
Reviewed-on: http://gerrit.tine20.com/customers/1829
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/User/Ldap.php

index 2406f47..a06c43b 100644 (file)
@@ -360,7 +360,9 @@ class Tinebase_User_Ldap extends Tinebase_User_Sql implements Tinebase_User_Inte
         $metaData = $this->_getMetaData($user);
 
         $encryptionType = isset($this->_options['pwEncType']) ? $this->_options['pwEncType'] : Tinebase_User_Abstract::ENCRYPT_SSHA;
-        $userpassword = $_encrypt ? Hash_Password::generate($encryptionType, $_password) : $_password;
+        $userpassword = ($_encrypt && $encryptionType !== Tinebase_User_Abstract::ENCRYPT_PLAIN)
+            ? Hash_Password::generate($encryptionType, $_password)
+            : $_password;
         
         $ldapData = array(
             'userpassword'     => $userpassword,
@@ -468,7 +470,7 @@ class Tinebase_User_Ldap extends Tinebase_User_Sql implements Tinebase_User_Inte
     public function updateUserInSyncBackend(Tinebase_Model_FullUser $_account)
     {
         if ($this->_isReadOnlyBackend) {
-            return;
+            return $_account;
         }
         
         $ldapEntry = $this->_getLdapEntry('accountId', $_account);
@@ -913,7 +915,6 @@ class Tinebase_User_Ldap extends Tinebase_User_Sql implements Tinebase_User_Inte
             'adr_two_postalcode'    => 'mozillahomepostalcode',
             'adr_two_region'        => 'mozillahomestate',
             'adr_two_street'        => 'mozillahomestreet',
-            'adr_one_region'        => 'l',
             'adr_one_postalcode'    => 'postalcode',
             'adr_one_street'        => 'street',
             'adr_one_region'        => 'st',