[#7770] Ldap driver doesn't convert to lower case index attributes
Summary Ldap driver doesn't convert to lower case index attributes
Queue Vacation
Queue Version 3.0.1
Type Bug
State No Feedback
Priority 2. Medium
Owners
Requester alexandru (dot) ionica (at) gmail (dot) com
Created 12/11/08 (460 days ago)
Due
Updated 12/21/08 (450 days ago)
Assigned 12/12/08 (459 days ago)
Resolved 12/21/08 (450 days ago)
Attachments
Milestone
Patch Yes

History
12/21/08 Chuck Hagenbuch State ⇒ No Feedback
 
12/12/08 Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
Can you please try a recent snapshot or CVS checkout? I remember 
fixing such an issue, but I don't recall which Sork application it was.
12/11/08 alexandru (dot) ionica (at) gmail (dot) com Comment #1
State ⇒ Unconfirmed
Patch ⇒ 1
Milestone ⇒
Queue ⇒ Vacation
Summary ⇒ Ldap driver doesn't convert to lower case index attributes
Type ⇒ Bug
Priority ⇒ 2. Medium
Reply to this comment
Hello,

I use Sork Vacation with Ldap and my problem was that Sork Vacation 
didn't get the vacation status and vacation message from ldap. The 
ldap query was performed ok but the result comparison always was false 
because vacationActive != vacationactive



ldap_get_entries returns a complete result information in a 
multi-dimensional array and the attribute index is converted to 
lowercase (Attributes are case-insensitive for directory servers, but 
not when used as array indices.)

The problem is that ldap_get_attributes() doesn't have this behaveour 
and attribute idexes are not converted to lower case. To convert to 
lower case we can use the function array_change_key_case().



I see in the code in ldap.php on line 342

$messageAttr = String::lower($this->_params[$realm]['vacation']);

and on line 347

$vacationAttr = String::lower($this->_params[$realm]['active']);

So though in vacation3/conf.php i defined:

$conf['server']['params']['default']['vacation'] = 'vacationInfo';

$conf['server']['params']['default']['active'] = 'vacationActive';

they get converted to lower case and the comparisons

         if (isset($retAttrs[$messageAttr]))

and

         if (isset($retAttrs[$vacationAttr]))

are always false because $retAttrs[$messageAttr] has the value 
vacationInfo and $retAttrs[$vacationAttr] has the value 
vacationActive. Those values have been obtained with 
ldap_get_attributes and they were'n converted to lower case.



The patch i did is below pasted, and for me at the moment is working 
flawlessly:



332c332

<         $retAttrs = ldap_get_attributes($this->_ds, $entry);

---
         $retAttrs = 
array_change_key_case(ldap_get_attributes($this->_ds, $entry));