import v2.0.0.0_RC3 | 2012-07-01

https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
2019-07-17 22:31:04 +02:00
parent 38c146901c
commit 2f397f01f7
2677 changed files with 296182 additions and 45159 deletions

View File

@ -17,7 +17,7 @@
* @subpackage Zend_Auth_Adapter
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Ldap.php 17788 2009-08-24 14:43:23Z sgehrig $
* @version $Id: Ldap.php 18882 2009-11-06 10:57:58Z sgehrig $
*/
/**
@ -161,7 +161,7 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
/**
* setIdentity() - set the identity (username) to be used
*
* Proxies to {@see setPassword()}
* Proxies to {@see setUsername()}
*
* Closes ZF-6813
*
@ -312,10 +312,16 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
continue;
}
$ldap->bind($username, $password);
$canonicalName = $ldap->getCanonicalAccountName($username);
$dn = $ldap->getCanonicalAccountName($username, Zend_Ldap::ACCTNAME_FORM_DN);
$ldap->bind($canonicalName, $password);
/*
* Fixes problem when authenticated user is not allowed to retrieve
* group-membership information or own account.
* This requires that the user specified with "username" and "password"
* in the Zend_Ldap options is able to retrieve the required information.
*/
$ldap->bind();
$dn = $ldap->getCanonicalAccountName($canonicalName, Zend_Ldap::ACCTNAME_FORM_DN);
$groupResult = $this->_checkGroupMembership($ldap, $canonicalName, $dn, $adapterOptions);
if ($groupResult === true) {
@ -323,6 +329,8 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
$messages[0] = '';
$messages[1] = '';
$messages[] = "$canonicalName authentication successful";
// rebinding with authenticated user
$ldap->bind($dn, $password);
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $canonicalName, $messages);
} else {
$messages[0] = 'Account is not a member of the specified group';
@ -409,7 +417,6 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
}
}
}
$ldap->setOptions($options);
return $adapterOptions;
}
@ -463,9 +470,10 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
* Closes ZF-6813
*
* @param array $returnAttribs
* @param array $omitAttribs
* @return stdClass|boolean
*/
public function getAccountObject(array $returnAttribs = array())
public function getAccountObject(array $returnAttribs = array(), array $omitAttribs = array())
{
if (!$this->_authenticatedDn) {
return false;
@ -473,8 +481,14 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
$returnObject = new stdClass();
$omitAttribs = array_map('strtolower', $omitAttribs);
$entry = $this->getLdap()->getEntry($this->_authenticatedDn, $returnAttribs, true);
foreach ($entry as $attr => $value) {
if (in_array($attr, $omitAttribs)) {
// skip attributes marked to be omitted
continue;
}
if (is_array($value)) {
$returnObject->$attr = (count($value) > 1) ? $value : $value[0];
} else {