]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Make LDAP connection error fatal - there really is no way to recover from that.
authorCraig Andrews <candrews@integralblue.com>
Thu, 25 Feb 2010 04:20:34 +0000 (23:20 -0500)
committerCraig Andrews <candrews@integralblue.com>
Thu, 25 Feb 2010 04:20:34 +0000 (23:20 -0500)
plugins/LdapAuthentication/LdapAuthenticationPlugin.php
plugins/LdapAuthorization/LdapAuthorizationPlugin.php

index 768f0fe7f6ea9353015d7a1102e8c4a92f3c189b..1b5dc92e3f12c6c48fd60c9b600573cdab858b42 100644 (file)
@@ -199,8 +199,7 @@ class LdapAuthenticationPlugin extends AuthenticationPlugin
         $ldap->setErrorHandling(PEAR_ERROR_RETURN);
         $err=$ldap->bind();
         if (Net_LDAP2::isError($err)) {
-            common_log(LOG_WARNING, 'Could not connect to LDAP server: '.$err->getMessage());
-            return false;
+            throw new Exception('Could not connect to LDAP server: '.$err->getMessage());
         }
         if($config == null) $this->default_ldap=$ldap;
 
index 7f48ce5e1b0fd8b35578200fd49adb5ae4a4c24a..19aff42b8bb57a8a4e4c17677d6bc508ec3d3256 100644 (file)
@@ -167,7 +167,7 @@ class LdapAuthorizationPlugin extends AuthorizationPlugin
         $ldap->setErrorHandling(PEAR_ERROR_RETURN);
         $err=$ldap->bind();
         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;
@@ -185,6 +185,9 @@ class LdapAuthorizationPlugin extends AuthorizationPlugin
         if($ldap==null) {
             $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);
         $options = array(
             'attributes' => $attributes