6.0.0-beta1
7/5/25

[#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 03/04/2013 (4506 days ago)
Due
Updated 03/06/2013 (4504 days ago)
Assigned 03/04/2013 (4506 days ago)
Resolved 03/06/2013 (4504 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
03/06/2013 08:12:46 PM 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' ||" .
03/06/2013 06:07:29 PM Michael Rubinsky Comment #3
State ⇒ Resolved
Reply to this comment
Fixed for 4.0.4.
03/06/2013 06:06:55 PM 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(-)

http://git.horde.org/horde-git/-/commit/6aa424dc814ec8c95851c16b6cc89172d87f7369
03/04/2013 04:12:30 PM Michael Rubinsky State ⇒ Assigned
Priority ⇒ 1. Low
Assigned to Michael Rubinsky
 
03/04/2013 01:31:03 PM macleajb (at) ednet (dot) ns (dot) ca Comment #1
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ Wrong LDap search created
Queue ⇒ Turba
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Reply to this comment
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.


Saved Queries