[#12089] Wrong LDap search created
Summary Wrong LDap search created
Queue Turba
Queue Version 4.0.3
Type Bug
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester macleajb (at) ednet (dot) ns (dot) ca
Created 2013-03-04 (2239 days ago)
Updated 2013-03-06 (2237 days ago)
Assigned 2013-03-04 (2239 days ago)
Resolved 2013-03-06 (2237 days ago)
Patch No

2013-03-06 20:12:46 macleajb (at) ednet (dot) ns (dot) ca Comment #4 Reply to this comment
I believe the same "$key === 'OR' " type fix can be added just below 
it for the AND adding an "$key === 'AND' ||" .
2013-03-06 18:07:29 Michael Rubinsky Comment #3
State ⇒ Resolved
Reply to this comment
Fixed for 4.0.4.
2013-03-06 18:06:55 Git Commit Comment #2 Reply to this comment
Changes have been made in Git (master):

commit 6aa424dc814ec8c95851c16b6cc89172d87f7369
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Wed Mar 6 13:05:53 2013 -0500

     Allow for more deeply nested search criteria.

     Fixes Bug: 12089 for activesync based global address book searches.

  turba/lib/Driver/Ldap.php |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

2013-03-04 16:12:30 Michael Rubinsky Assigned to Michael Rubinsky
State ⇒ Assigned
Priority ⇒ 1. Low
2013-03-04 13:31:03 macleajb (at) ednet (dot) ns (dot) ca Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Summary ⇒ Wrong LDap search created
Queue ⇒ Turba
Milestone ⇒
Patch ⇒ No
Reply to this comment
When Activesync requests a contact search, Driver.php returns :


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


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) {
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'])) {


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

makes the returned search :

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.

Saved Queries