Fix some regressions caused by refactor of LDAP plugin

This commit is contained in:
Craig Andrews 2010-03-23 21:50:31 -04:00
parent d9dcdf5b49
commit 6b538cd9b3
2 changed files with 18 additions and 8 deletions

View File

@ -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;

View File

@ -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));
if(array_key_exists($config_id,self::$ldap_connections)) {
$ldap = self::$ldap_connections[$config_id]; $ldap = self::$ldap_connections[$config_id];
if(! isset($ldap)) { } 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.