6.0.0-alpha14
6/24/25

[#9826] Schema checking broken in Turba_Driver_Ldap
Summary Schema checking broken in Turba_Driver_Ldap
Queue Turba
Queue Version 3.0
Type Bug
State Resolved
Priority 2. Medium
Owners jan (at) horde (dot) org
Requester heinz (at) htl-steyr (dot) ac (dot) at
Created 04/06/2011 (5193 days ago)
Due
Updated 04/26/2011 (5173 days ago)
Assigned 04/14/2011 (5185 days ago)
Resolved 04/19/2011 (5180 days ago)
Github Issue Link
Github Pull Request
Milestone 3.0.1
Patch No

History
04/26/2011 04:50:55 PM Git Commit Comment #13 Reply to this comment
Changes have been made in Git for this ticket:

[jan] Fix detecting superiour objectclass' must/may attributes (Bug #9826).

  2 files changed, 18 insertions(+), 12 deletions(-)
http://git.horde.org/horde-git/-/commit/fd141fa43b966363f2c8035c62b1a4db3fcd8b36
04/26/2011 01:38:29 PM heinz (at) htl-steyr (dot) ac (dot) at Comment #12 Reply to this comment
I upgraded to PEAR package Horde_Ldap version 1.1.0
There is still a problem in class Horde_Ldap_Schema.
If there is an objectclass with no must attributes but superclasses 
would have one,
an empty array is returned.
current code:
public function must($oc, $checksup = false)
     {
         try {
             $attributes = $this->_getAttr($oc, 'must');
             if ($checksup) {
                 foreach ($this->superclass($oc) as $sup) {
                     $attributes = array_merge($attributes, $this->must($sup));
                 }
                 $attributes = array_values(array_unique($attributes));
             }
             return $attributes;
         } catch (Horde_Ldap_Exception $e) {
             return array();
         }
     }

_getAttr throws an Exception and if catched an empty arry ist 
returned, no superclass is called
Possible solution:
     public function must($oc, $checksup = false)
     {
         try {
             $attributes = $this->_getAttr($oc, 'must');
         } catch (Horde_Ldap_Exception $e) {
             $attributes =  array();
         }

         if ($checksup) {
            foreach ($this->superclass($oc) as $sup) {
                $attributes = array_merge($attributes, 
$this->must($sup, true));
            }
            $attributes = array_values(array_unique($attributes));
         }
         return $attributes;
    }


04/19/2011 04:24:15 PM Git Commit Comment #11 Reply to this comment
Changes have been made in Git for this ticket:

Make sure that may() and must() are recursively called (Bug #9826).

  1 files changed, 2 insertions(+), 2 deletions(-)
http://git.horde.org/horde-git/-/commit/283bceb26af9dd1fbf5ddc9cccf66a6b65859231
04/19/2011 04:23:15 PM Jan Schneider Comment #10 Reply to this comment
In _checkRequiredAttributes must attributes are received with the 
checksup parameter set to false. It should default to true to get 
all required attributes.
This is already the case.
04/19/2011 04:18:10 PM heinz (at) htl-steyr (dot) ac (dot) at Comment #9 Reply to this comment
In _checkRequiredAttributes must attributes are received with the 
checksup parameter set to false. It should default to true to get all 
required attributes. Alternativly add an parameter in turba's 
backend.php config file.
04/19/2011 04:08:38 PM heinz (at) htl-steyr (dot) ac (dot) at Comment #8 Reply to this comment
In function may() and must() superclasses are checked like:
$attributes = array_merge($attributes, $this->may($sup));

You should provide a "true" value to the parameter "checksup" to check 
ALL superclasses
(also superclasses of the superclass)
-> $attributes = array_merge($attributes, $this->may($sup,true));

04/19/2011 02:28:41 PM Jan Schneider State ⇒ Resolved
Milestone ⇒ 3.0.1
 
04/19/2011 02:26:16 PM Git Commit Comment #7 Reply to this comment
Changes have been made in Git for this ticket:

[jan] Add parameter to Horde_Ldap_Schema#must() and #may() to return 
attributes from superior objectclasses too (Bug #9826).

  3 files changed, 26 insertions(+), 9 deletions(-)
http://git.horde.org/horde-git/-/commit/41119a20da71a6c2a91aa16e2a74ed721883daba
04/19/2011 02:26:13 PM Git Commit Comment #6 Reply to this comment
Changes have been made in Git for this ticket:

[jan] Don't throw exceptions from Horde_Ldap_Schema#must() and #may() 
(Bug #9826).

  2 files changed, 12 insertions(+), 6 deletions(-)
http://git.horde.org/horde-git/-/commit/557c7142c6a052b3c7f51f1a518d3d9d8644f603
04/19/2011 02:26:09 PM Git Commit Comment #5 Reply to this comment
Changes have been made in Git for this ticket:

Use Horde_Ldap_Schema to check for required attributes (Bug #9826).

  1 files changed, 20 insertions(+), 20 deletions(-)
http://git.horde.org/horde-git/-/commit/b5a1551f40db490d8c5a0a783b687be059e860a4
04/15/2011 03:11:25 PM heinz (at) htl-steyr (dot) ac (dot) at Comment #4
New Attachment: patch_horde_turba_ldap.diff Download
Reply to this comment
I don't use checksyntax, so I have appied your patch to the function
_checkRequiredAttributes

The schema is now retrieved, but:
- if an objectclass (like turbacontacts) has no MUST attribute, the
function must() in Horde_Ldap_Schema throws an Exception
I've added an empty array entry as a workaround in the parse() function for
must, may and sup attributes if the are not set yet.

- if an objectclass (like inetorgperson) has no MUST attribute but 
MUST attributes
are defined in superior objectclasses we shout recurse to get all 
required attributenames. I have implemented this (quick and dirty) 
only in the function must().
Should be done also in may().

With this changes the Turba_Driver_Ldap works now fine for me.

04/14/2011 11:28:23 PM Jan Schneider Comment #3
State ⇒ Feedback
Assigned to Jan Schneider
Reply to this comment
Does this work?
04/14/2011 11:28:15 PM Git Commit Comment #2 Reply to this comment
Changes have been made in Git for this ticket:

Complete half-finished conversion to Horde_Ldap_Schema (Bug #9826).

  3 files changed, 46 insertions(+), 9 deletions(-)
http://git.horde.org/horde-git/-/commit/5090bf32fab18405baf39897d30829a03511cc39
04/06/2011 07:01:48 PM heinz (at) htl-steyr (dot) ac (dot) at Comment #1
Priority ⇒ 2. Medium
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Summary ⇒ Schema checking broken in Turba_Driver_Ldap
Type ⇒ Bug
Queue ⇒ Turba
Reply to this comment
With 'checkrequired' or 'checksyntax' enables in backend configuration
turba fails.
In function _checkRequiredAttributes the schema is retrieved with
$this->_ldap->schema()

but property _ldap is undefined in the class Turba_Driver_Ldap

same behavier in  function _getSyntax

Saved Queries