[horde] Horde 3.0.7 and Group Hooks problem (+ patch)

Thibault LE MEUR Thibault.LeMeur at supelec.fr
Wed Dec 7 09:47:32 PST 2005


Hello,

We are having a problem with an upgrade from horde 3.0.4 to horde 3.0.7.
Here is a summary of our setup:
* Horde, IMP, Ingo
* Authentication to IMP
* Datatree is Mysql
* Group is using hooks ($conf['group']['driver'] = 'hooks')
* Access to Ingo is restricted (by Horde's permission system) to the
"acces_ingo" group.
* The "acces_ingo" group is provisionned by our LDAP directory through a
customized hook function (_group_hook_acces_ingo in config/hooks.php)

Everything works well with the following versions:
v3.0.4  ==> Horde
v1.0.1  ==> ingo
v4.0.3  ==> imp
v0.1    ==> mimp
v2.0.2  ==> turba

But after having upgraded to horde 3.0.7, only users that are part of the
"acces_ingo" Group can log on the Webmail.
If we log as a user who is not part of the "acces_ingo" group, Horde fails
and the browser sends a "Impossible to display page" message.

We have debbuged this and found that Horde enters an "infinite loop" in its
search for the user group memberships:
* Group:userIsInGroup calls Group_Hooks:getGroupMemberships
* Group_Hooks:getGroupMemberships calls Group:userIsInGroup

We have patched the file "lib/Horde/Group/hooks.php" from 3.0.7 this way to
correct the issue:
---------------------------------------------------------------------------
    function getGroupMemberships($user, $parentGroups = false)
    {
        $memberships = parent::getGroupMemberships($user, $parentGroups);
        $groups = $this->listGroups();
        foreach ($groups as $gid => $group) {
//call_user_func($this->_getGroupHookName($group), $user)
//            if ($this->hasHook($group) &&
//                $this->userIsInGroup($user, $group)) {
// call our hook directly in order to avoid the loop
            if ($this->hasHook($group) &&
                call_user_func($this->_getGroupHookName($group), $user)) {
                $memberships += array($gid => $group);
            }
            if ($parentGroups) {
//                $parents = $this->getGroupParentList($gid);
// the "getGroupParentList" method doesn't exist, use getGroupParents
instead !!
                $parents = $this->getGroupParents($gid);
                foreach ($parents as $pid => $parent) {
//                    if ($this->hasHook($parent) &&
//                        $this->userIsInGroup($user, $parent)) {
// call our hook directly in order to avoid the loop
                    if ($this->hasHook($parent) &&
 
call_user_func($this->_getGroupHookName($group),$user)) {
                        $memberships += array($pid => $parent);
                    }
                }
            }
        }

        return $memberships;
    }
-------------------------------------------------------------

Can you confirm that it does make sense ?
Is there an official patch ?


Thanks in advance,
Thibault LE MEUR  




More information about the horde mailing list