Skip to content
Snippets Groups Projects
Commit ea759d53 authored by Olav Morken's avatar Olav Morken
Browse files

ldap:AttributeAddFromLDAP: Extract attributes from multiple hits.

If there are several entries that matches the search, we should
extract the values from all of them.

Thanks to Stéphane Gully for providing this patch!

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2719 44740490-163a-0410-bde0-09ae8108e29a
parent a314de4c
No related branches found
No related tags found
No related merge requests found
......@@ -218,10 +218,12 @@ class sspmod_ldap_Auth_Process_AttributeAddFromLDAP extends SimpleSAML_Auth_Proc
// handle [multiple] values
if(is_array($entries) && is_array($entries[0])){
$entry = $entries[0][strtolower($this->config['ldap_search_attribute'])];
$results = array();
for($i = 0; $i < $entry['count']; $i++){
$results[] = $entry[$i];
foreach($entries as $entry){
$entry = $entry[strtolower($this->config['ldap_search_attribute'])];
for($i = 0; $i < $entry['count']; $i++){
$results[] = $entry[$i];
}
}
$attributes[$this->config['new_attribute_name']] = array_values($results);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment