[imp] Re: _imp_hook_vinfo problem: infinite loop

Marcos Monge mmonge at gmail.com
Wed Feb 9 10:40:05 PST 2005


Hi

I have resolve the problem. Just remove the "global $_SESSION;" I put
in the begining of the hook. It's not needed, and now the hook and
login work perfect.

Thanks
Marcos


On Tue, 8 Feb 2005 15:02:08 +0100, Marcos Monge <mmonge at gmail.com> wrote:
> HI
> 
> I have a horde 3.0.2 / imp 4.0.1 /turba/kronolith working OK.
> 
> The imap server only reconigze UID identifiers. But I want that the
> users do login with the long email address. To do this, in the IMP 3.0
> I use the hook_vinfo function to do a search in a ldap directory and
> obtein the uid of the user from the mail address. This work OK for
> long time.
> 
> Now, I'm trying to do the same in IMP 4. It's seens that work (at
> least the connection to the IMAP server is OK), but I get an error
> from browser (mozilla) "Redirection limit for this URL exceeded". With
> iexpolorer I get the typical MS unusefull error page. If I desactivate
> the hook_vinfo, all work ok.
> 
> I have been tracing the error up to "horde/login.php" (after pasing
> horde/imp/redirect.php, and horde/index.php), in this part:
> 
> $login_screen = $auth->_getLoginScreen();
> if (Util::removeParameter($login_screen, array('url', 'nocache')) !=
>    Horde::selfUrl(false, false, true)) {
>    if ($url_param) {
>        $login_screen = Util::addParameter($login_screen, 'url', $url_param);
>     }
>    if ($ie_version) {
>        $login_screen = Util::addParameter($login_screen,
> 'ie_version', $ie_version);
>    }
>    header('Location: ' . $login_screen);
>    exit;
> }
> 
> After executing this part, it return again and again to the
> horde/login.php and enter in this function that rewrite the URL.
> 
> I'm loss and I don't know where to continue looking. Anyone can help me?
> 
> The imp_hook_vinfo function to search the mail address in ldap and
> substitute the login with the uid is this:
> 
> if (!function_exists('_imp_hook_vinfo')) {
>     function _imp_hook_vinfo ($type = 'ldap') {
>         global $_SESSION;
> 
>         $vdomain = getenv('HTTP_HOST');
>         $vdomain = preg_replace('|^mail\.|i', '', $vdomain);
>         $vdomain = String::lower($vdomain);
> 
>         $ldapServer = "ldap.mydomain.es";
>         $ldapPort = "389";
>         $searchBase = "o=mydomain.es";
> 
>         if ($type == 'vdomain') {
>             return $vdomain;
>         } elseif ($type == "ldap") {
> 
>                $ds = @ldap_connect($ldapServer, $ldapPort);
>                $busqueda = 'mail=' . $_SESSION['imp']['user'];
>                $searchResult = @ldap_search($ds, $searchBase, $busqueda);
> 
>                if (@ldap_count_entries($ds, $searchResult) == 1) {
>                        $info = @ldap_get_entries($ds, $searchResult);
>                        $salida = $info[0]["uid"][0];
>                } else {
>                        $salida = $_SESSION['imp']['user'];
>                }
>                ldap_close($ds);
>                return $salida;
>         } else {
>         return PEAR::raiseError('invalid type: ' . $type);
>         }
>     }
> }
> 
> A very similar function was working OK in imp 3.0.
> 
> Best Regards
> Marcos
>


More information about the imp mailing list