Make LDAP connection error fatal - there really is no way to recover from that.
This commit is contained in:
parent
beb776cfd6
commit
489bd935eb
@ -199,8 +199,7 @@ class LdapAuthenticationPlugin extends AuthenticationPlugin
|
|||||||
$ldap->setErrorHandling(PEAR_ERROR_RETURN);
|
$ldap->setErrorHandling(PEAR_ERROR_RETURN);
|
||||||
$err=$ldap->bind();
|
$err=$ldap->bind();
|
||||||
if (Net_LDAP2::isError($err)) {
|
if (Net_LDAP2::isError($err)) {
|
||||||
common_log(LOG_WARNING, 'Could not connect to LDAP server: '.$err->getMessage());
|
throw new Exception('Could not connect to LDAP server: '.$err->getMessage());
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
if($config == null) $this->default_ldap=$ldap;
|
if($config == null) $this->default_ldap=$ldap;
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ class LdapAuthorizationPlugin extends AuthorizationPlugin
|
|||||||
$ldap->setErrorHandling(PEAR_ERROR_RETURN);
|
$ldap->setErrorHandling(PEAR_ERROR_RETURN);
|
||||||
$err=$ldap->bind();
|
$err=$ldap->bind();
|
||||||
if (Net_LDAP2::isError($err)) {
|
if (Net_LDAP2::isError($err)) {
|
||||||
common_log(LOG_WARNING, 'Could not connect to LDAP server: '.$err->getMessage());
|
throw new Exception('Could not connect to LDAP server: '.$err->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if($config == null) $this->default_ldap=$ldap;
|
if($config == null) $this->default_ldap=$ldap;
|
||||||
@ -185,6 +185,9 @@ class LdapAuthorizationPlugin extends AuthorizationPlugin
|
|||||||
if($ldap==null) {
|
if($ldap==null) {
|
||||||
$ldap = $this->ldap_get_connection();
|
$ldap = $this->ldap_get_connection();
|
||||||
}
|
}
|
||||||
|
if(! $ldap) {
|
||||||
|
throw new Exception("Could not connect to LDAP");
|
||||||
|
}
|
||||||
$filter = Net_LDAP2_Filter::create($this->attributes['username'], 'equals', $username);
|
$filter = Net_LDAP2_Filter::create($this->attributes['username'], 'equals', $username);
|
||||||
$options = array(
|
$options = array(
|
||||||
'attributes' => $attributes
|
'attributes' => $attributes
|
||||||
|
Loading…
Reference in New Issue
Block a user