From 65acb7a9f03dcb383eb43992b838e4c60d09fcab Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Thu, 17 Nov 2011 09:55:22 +0000
Subject: [PATCH] SimpleSAML_Auth_LDAP: Clean up unnecessary code.

The search()-function contained some code that was unnecessary. This
patch removes that code and simplifies the function.

Thanks to Ryan Panning for fixing this!

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

diff --git a/lib/SimpleSAML/Auth/LDAP.php b/lib/SimpleSAML/Auth/LDAP.php
index 61ff47799..828f97fa5 100644
--- a/lib/SimpleSAML/Auth/LDAP.php
+++ b/lib/SimpleSAML/Auth/LDAP.php
@@ -190,24 +190,11 @@ class SimpleSAML_Auth_LDAP {
 		// Create the search filter.
 		$attribute = self::escape_filter_value($attribute, FALSE);
 		$value = self::escape_filter_value($value);
-		if (is_array($attribute)) {
-
-			// We have more than one attribute.
-			$filter = '';
-			foreach ($attribute AS $attr) {
-				$filter .= '(' . $attr . '=' . $value. ')';
-			}
-			$filter = '(|' . $filter . ')';
-
-		} elseif (is_string($attribute)) {
-
-			// We have only one attribute.
-			$filter = '(' . $attribute . '=' . $value. ')';
-
-		} else {
-			// We have an unknown attribute type...
-			throw $this->makeException('Library - LDAP search(): Search attribute must be an array or a string', ERR_INTERNAL);
+		$filter = '';
+		foreach ($attribute AS $attr) {
+			$filter .= '(' . $attr . '=' . $value. ')';
 		}
+		$filter = '(|' . $filter . ')';
 
 		// Search using generated filter.
 		SimpleSAML_Logger::debug('Library - LDAP search(): Searching base \'' . $base . '\' for \'' . $filter . '\'');
-- 
GitLab