From 354d2bd096bef0e093c2b75c3e99e5b5b628917a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Tue, 20 Jan 2009 09:20:20 +0000
Subject: [PATCH] Fix for LDAP search for dn

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1176 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Auth/LDAP.php | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/lib/SimpleSAML/Auth/LDAP.php b/lib/SimpleSAML/Auth/LDAP.php
index ab2439aa7..647ad505b 100644
--- a/lib/SimpleSAML/Auth/LDAP.php
+++ b/lib/SimpleSAML/Auth/LDAP.php
@@ -121,15 +121,13 @@ class SimpleSAML_Auth_LDAP {
 			}
 		}
 
-		// If no DN was found after traversing all base DNs, return NULL or an exception.
-		if (@ldap_count_entries($this->ldap, $search_result) == 0) {
-			if ($allowZeroHits) {
-				return NULL;
-			} else {
-				throw new Exception('LDAP search returned zero entries: ' . $searchattr . '=' . $searchvalue . ' base(s): ' . 
-					join(' & ', $searchbases));
-			}
-		}		
+		if ($allowZeroHits) {
+			return NULL;
+		} else {
+			throw new Exception('LDAP search returned zero entries: ' . $searchattr . '=' . $searchvalue . ' base(s): ' . 
+				join(' & ', $searchbases));
+		}
+
 
 	}
 	
-- 
GitLab