[Tickets #7770] Ldap driver doesn't convert to lower case index attributes
bugs at horde.org
bugs at horde.org
Thu Dec 11 09:23:33 UTC 2008
DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.
Ticket URL: http://bugs.horde.org/ticket/7770
------------------------------------------------------------------------------
Ticket | 7770
Created By | alexandru.ionica at gmail.com
Summary | Ldap driver doesn't convert to lower case index
| attributes
Queue | Vacation
Version | 3.0.1
Type | Bug
State | Unconfirmed
Priority | 2. Medium
Milestone |
Patch | 1
Owners |
------------------------------------------------------------------------------
alexandru.ionica at gmail.com (2008-12-11 04:23) wrote:
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));
More information about the bugs
mailing list