[Tickets #12089] Wrong LDap search created

noreply at bugs.horde.org noreply at bugs.horde.org
Mon Mar 4 13:31:03 UTC 2013


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/12089
------------------------------------------------------------------------------
  Ticket             | 12089
  Created By         | macleajb at ednet.ns.ca
  Summary            | Wrong LDap search created
  Queue              | Turba
  Version            | 4.0.3
  Type               | Bug
  State              | Unconfirmed
  Priority           | 2. Medium
  Milestone          |
  Patch              |
  Owners             |
------------------------------------------------------------------------------


macleajb at ednet.ns.ca (2013-03-04 13:31) wrote:

When Activesync requests a contact search, Driver.php returns :

(&(givenname=Maclean)(sn=Maclean)(|(displayname=*Maclean*)(mail=*Maclean*)))

Which never succeeds. I expect the returned search to be more like:

(&(|(givenname=Maclean)(sn=Maclean))(|(displayname=*Maclean*)(mail=*Maclean*)))

Looking at turba/lib/Driver/Ldap.php in function _buildSearchQuery,  
the passed criteria is placed in a foreach that does not pull out the  
passed array keys. Changing :

foreach ($criteria as $vals) {
to
foreach ($criteria as $key => $vals) {

and then checking for the key value in addition to the OR already  
tested for by changing :

if (!empty($vals['OR'])) {

to

if ($key === 'OR' || !empty($vals['OR'])) {

makes the returned search :

(&(|(givenname=Maclean)(sn=Maclean))(|(|(|(displayname=Maclean*)(displayname=*  
Maclean*))(|(mail=Maclean*)(mail=* Maclean*)))))

which does return values.

Sorry for not including a patch, but I am not convinced I chased down  
the correct solution.







More information about the bugs mailing list