Skip to content

Commit

Permalink
MDL-41304: Hide and handle LDAP error when user not in context being …
Browse files Browse the repository at this point in the history
…checked
  • Loading branch information
tlock authored and danpoltawski committed Sep 3, 2013
1 parent 3a9a74b commit a5db1b5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/ldaplib.php
Expand Up @@ -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).'))',
Expand Down

0 comments on commit a5db1b5

Please sign in to comment.