Permalink
Browse files

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

…checked
  • Loading branch information...
1 parent 838d78a commit 6b718780c6c46a24ab4940ecf351ab976ba87031 @tlock tlock committed 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 6b71878

Please sign in to comment.