Permalink
Browse files

Prevent error messages when username is not member of group

  • Loading branch information...
1 parent c86939e commit 52192a5ce7637c9bb2ceaf21271798e11d80b2b3 paca70 committed Nov 8, 2004
Showing with 6 additions and 2 deletions.
  1. +6 −2 auth/ldap/lib.php
View
@@ -1040,12 +1040,16 @@ function auth_ldap_isgroupmember ($username='', $groupdns='') {
if ($CFG->ldap_memberattribute_isdn) {
$username=auth_ldap_find_userdn($ldapconnection, $username);
}
+ if (! $username ) {
+ return $result;
+ }
$groups = explode(";",$groupdns);
-
+
foreach ($groups as $group){
+ //echo "Checking group $group for member $username\n";
$search = @ldap_read($ldapconnection, $group, '('.$CFG->ldap_memberattribute.'='.$username.')', array($CFG->ldap_memberattribute));
- if ($search) {$info = auth_ldap_get_entries($ldapconnection, $search);
+ if (ldap_count_entries($ldapconnection, $search)) {$info = auth_ldap_get_entries($ldapconnection, $search);
if (count($info) > 0 ) {
// user is member of group

0 comments on commit 52192a5

Please sign in to comment.