From 2c44fe34a7075d808ccc99cf3c97e800cb54ec12 Mon Sep 17 00:00:00 2001
From: Johannes Meyer <johannes.meyer@netways.de>
Date: Mon, 29 Sep 2014 11:22:43 +0200
Subject: [PATCH] Fix that ldap auth validation does not send a BIND request

---
 application/forms/Config/Resource/LdapResourceForm.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/application/forms/Config/Resource/LdapResourceForm.php b/application/forms/Config/Resource/LdapResourceForm.php
index 5f46f64b2..facf5679e 100644
--- a/application/forms/Config/Resource/LdapResourceForm.php
+++ b/application/forms/Config/Resource/LdapResourceForm.php
@@ -114,7 +114,13 @@ class LdapResourceForm extends Form
     {
         try {
             $resource = ResourceFactory::createResource(new Zend_Config($form->getValues()));
-            $resource->connect();
+            if (false === $resource->testCredentials(
+                $form->getElement('bind_dn')->getValue(),
+                $form->getElement('bind_pw')->getValue()
+                )
+            ) {
+                throw new Exception();
+            }
         } catch (Exception $e) {
             $form->addError(t('Connectivity validation failed, connection to the given resource not possible.'));
             return false;