Skip to content

Commit

Permalink
pb case sensitive when get ldap attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
jgutierr25 committed Jun 28, 2007
1 parent b05e8f4 commit 74c9f51
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions auth/cas/auth.php
Expand Up @@ -372,14 +372,15 @@ function get_userinfo($username) {
if ($value == 'dn') {
$result[$key] = $user_dn;
}
if (!array_key_exists($value, $user_entry[0])) {
if (!array_key_exists(strtolower($value), $user_entry[0])) {
continue; // wrong data mapping!
}
if (is_array($user_entry[0][$value])) {
$newval = $textlib->convert($user_entry[0][$value][0], $this->config->ldapencoding, 'utf-8');
if (is_array($user_entry[0][strtolower($value)])) {
$newval = $textlib->convert($user_entry[0][strtolower($value)][0], $this->config->ldapencoding, 'utf-8');
} else {
$newval = $textlib->convert($user_entry[0][$value], $this->config->ldapencoding, 'utf-8');
$newval = $textlib->convert($user_entry[0][strtolower($value)], $this->config->ldapencoding, 'utf-8');
}

if (!empty($newval)) { // favour ldap entries that are set
$ldapval = $newval;
}
Expand Down Expand Up @@ -954,6 +955,7 @@ function iscreator($username) {
if (count($result)!=0)
return true;
}

return false;
}
/**
Expand Down Expand Up @@ -1056,18 +1058,20 @@ function ldap_get_entries($conn, $searchresult) {
do {
$attributes = @ldap_get_attributes($conn, $entry);
for ($j=0; $j<$attributes['count']; $j++) {
$values = ldap_get_values_len($conn, $entry,$attributes[$j]);
$values = ldap_get_values_len($conn, $entry,$attributes[$j]);

if (is_array($values)) {
$fresult[$i][$attributes[$j]] = $values;
$fresult[$i][strtolower($attributes[$j])] = $values;
}
else {
$fresult[$i][$attributes[$j]] = array($values);
$fresult[$i][strtolower($attributes[$j])] = array($values);
}
}
$i++;
}
while ($entry = @ldap_next_entry($conn, $entry));
//were done

return ($fresult);
}
/**
Expand Down

0 comments on commit 74c9f51

Please sign in to comment.