forked from GNUsocial/gnu-social
Fix some regressions caused by refactor of LDAP plugin
This commit is contained in:
parent
d9dcdf5b49
commit
6b538cd9b3
@ -118,7 +118,7 @@ class LdapAuthenticationPlugin extends AuthenticationPlugin
|
|||||||
|
|
||||||
function suggestNicknameForUsername($username)
|
function suggestNicknameForUsername($username)
|
||||||
{
|
{
|
||||||
$entry = $this->ldap_get_user($username, $this->attributes);
|
$entry = $this->ldapCommon->get_user($username, $this->attributes);
|
||||||
if(!$entry){
|
if(!$entry){
|
||||||
//this really shouldn't happen
|
//this really shouldn't happen
|
||||||
$nickname = $username;
|
$nickname = $username;
|
||||||
|
@ -47,7 +47,7 @@ class LdapCommon
|
|||||||
public $uniqueMember_attribute = null;
|
public $uniqueMember_attribute = null;
|
||||||
public $attributes=array();
|
public $attributes=array();
|
||||||
public $password_encoding=null;
|
public $password_encoding=null;
|
||||||
|
|
||||||
public function __construct($config)
|
public function __construct($config)
|
||||||
{
|
{
|
||||||
Event::addHandler('Autoload',array($this,'onAutoload'));
|
Event::addHandler('Autoload',array($this,'onAutoload'));
|
||||||
@ -68,7 +68,7 @@ class LdapCommon
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onAutoload($cls)
|
function onAutoload($cls)
|
||||||
{
|
{
|
||||||
switch ($cls)
|
switch ($cls)
|
||||||
{
|
{
|
||||||
case 'MemcacheSchemaCache':
|
case 'MemcacheSchemaCache':
|
||||||
@ -77,6 +77,15 @@ class LdapCommon
|
|||||||
case 'Net_LDAP2':
|
case 'Net_LDAP2':
|
||||||
require_once 'Net/LDAP2.php';
|
require_once 'Net/LDAP2.php';
|
||||||
return false;
|
return false;
|
||||||
|
case 'Net_LDAP2_Filter':
|
||||||
|
require_once 'Net/LDAP2/Filter.php';
|
||||||
|
return false;
|
||||||
|
case 'Net_LDAP2_Filter':
|
||||||
|
require_once 'Net/LDAP2/Filter.php';
|
||||||
|
return false;
|
||||||
|
case 'Net_LDAP2_Entry':
|
||||||
|
require_once 'Net/LDAP2/Entry.php';
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,8 +106,9 @@ class LdapCommon
|
|||||||
$config = $this->ldap_config;
|
$config = $this->ldap_config;
|
||||||
}
|
}
|
||||||
$config_id = crc32(serialize($config));
|
$config_id = crc32(serialize($config));
|
||||||
$ldap = self::$ldap_connections[$config_id];
|
if(array_key_exists($config_id,self::$ldap_connections)) {
|
||||||
if(! isset($ldap)) {
|
$ldap = self::$ldap_connections[$config_id];
|
||||||
|
} else {
|
||||||
//cannot use Net_LDAP2::connect() as StatusNet uses
|
//cannot use Net_LDAP2::connect() as StatusNet uses
|
||||||
//PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handleError');
|
//PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handleError');
|
||||||
//PEAR handling can be overridden on instance objects, so we do that.
|
//PEAR handling can be overridden on instance objects, so we do that.
|
||||||
@ -197,10 +207,10 @@ class LdapCommon
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get an LDAP entry for a user with a given username
|
* get an LDAP entry for a user with a given username
|
||||||
*
|
*
|
||||||
* @param string $username
|
* @param string $username
|
||||||
* $param array $attributes LDAP attributes to retrieve
|
* $param array $attributes LDAP attributes to retrieve
|
||||||
* @return string DN
|
* @return string DN
|
||||||
@ -212,7 +222,7 @@ class LdapCommon
|
|||||||
'attributes' => $attributes
|
'attributes' => $attributes
|
||||||
);
|
);
|
||||||
$search = $ldap->search(null,$filter,$options);
|
$search = $ldap->search(null,$filter,$options);
|
||||||
|
|
||||||
if (PEAR::isError($search)) {
|
if (PEAR::isError($search)) {
|
||||||
common_log(LOG_WARNING, 'Error while getting DN for user: '.$search->getMessage());
|
common_log(LOG_WARNING, 'Error while getting DN for user: '.$search->getMessage());
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user