Permalink
Browse files

MDL-41304: Hide and handle LDAP error when user not in context being …

…checked
  • Loading branch information...
1 parent 3a9a74b commit a5db1b54326d4bfba0fce8df268ff070c8454361 @tlock tlock committed with danpoltawski Aug 20, 2013
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/ldaplib.php
View
@@ -247,9 +247,11 @@ function ldap_find_userdn($ldapconnection, $username, $contexts, $objectclass, $
}
if ($search_sub) {
- $ldap_result = ldap_search($ldapconnection, $context,
- '(&'.$objectclass.'('.$search_attrib.'='.ldap_filter_addslashes($username).'))',
- array($search_attrib));
+ if (!$ldap_result = @ldap_search($ldapconnection, $context,
+ '(&'.$objectclass.'('.$search_attrib.'='.ldap_filter_addslashes($username).'))',
+ array($search_attrib))) {
+ break; // Not found in this context.
+ }
} else {
$ldap_result = ldap_list($ldapconnection, $context,
'(&'.$objectclass.'('.$search_attrib.'='.ldap_filter_addslashes($username).'))',

0 comments on commit a5db1b5

Please sign in to comment.