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.ionica (at) gmail (dot) com |
Created | 12/11/2008 (6027 days ago) |
Due | |
Updated | 12/22/2008 (6016 days ago) |
Assigned | 12/12/2008 (6026 days ago) |
Resolved | 12/22/2008 (6016 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | Yes |
State ⇒ Feedback
fixing such an issue, but I don't recall which Sork application it was.
Priority ⇒ 2. Medium
Patch ⇒ Yes
Milestone ⇒
Queue ⇒ Vacation
Summary ⇒ Ldap driver doesn't convert to lower case index attributes
Type ⇒ Bug
State ⇒ Unconfirmed
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);
---
array_change_key_case(ldap_get_attributes($this->_ds, $entry));