[dev] selecting IMAP server based on username

Jan Schneider jan at horde.org
Tue Aug 30 13:24:43 PDT 2005


Zitat von Aleksandar Milivojevic <alex at milivojevic.org>:

> Quoting Jan Schneider <jan at horde.org>:
>
>> Zitat von Aleksandar Milivojevic <alex at milivojevic.org>:
>>
>>> Quoting Aleksandar Milivojevic <alex at milivojevic.org>:
>>>
>>>> I've patched horde/config/conf.xml and horde/imp/lib/IMP.php files.  In
>>>> conf.xml, I've added configuration option $conf[hooks][imapserver]
>>>> to support
>>>> custom _hook_imp_imapserver function.  Then, I placed call to it at
>>>> the start
>>>> of IMP::getAutoLoginServer() (see attached diff).
>>>
>>> Forgot to include diffs...
>>
>> Try this instead, doesn't even require a code change:
>> http://wiki.horde.org/ImapSelect
>
> My first idea was exactly the same.  Use preauthenticate hook.
>
> However, it does not work.

It works fine and is in use at a large ISP.

> It does not work because IMP_Session::CreateSession() is called after
> pre/post-authenticate hooks.  It will overwrite whatever values you place in
> $_SESSION['imp'] with what it thinks is correct server (or the caller 
> function
> thinks is correct server).  Most likely it will be the value returned by
> IMP::getAutoLoginServer(), which is exactly where I placed call to my
> new hook.

No, it's called exactly at the right moment.

> It might work if Horde is configured to use IMP for authentication (haven't
> tested that case, I'm having Horde perform its own auth, and set hordeauth to
> true in imp/config/servers.php).

Gotcha, it only works if IMP is doing authentication of course, because 
otherwise you would intersect Horde's authentication, not IMP's.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/


More information about the dev mailing list