[horde] Horde4/BCBreaking

Christopher Neuhaus cne at ruhrverband.de
Thu Oct 27 14:33:26 UTC 2011


Am 26.10.2011 20:22, schrieb Michael M Slusarz:
> Quoting Christopher Neuhaus <cne at ruhrverband.de>:
>
>> In our multi IMAP-/one Horde-Server environment, we use a
>> preauthentication hook to autoselect the IMAP-Server for the user. Here
>> we extract the information of one of many IMAP-servers where the user
>> should authenticate. (just like http://wiki.horde.org/ImapSelect)
>>
>> After the H4 authentication cleaning process ..
>>
>>     http://wiki.horde.org/Horde4/BCBreaking: "Remove confusing mess of
>>     hooks and other ways of muddling logins (especially with IMP), and
>>     replace them _all_ with the preauthenticate and postauthenticate
>>     hooks + appropriate examples for things like vhosting. *(DONE)"*
>>     **
>>
>>  this solution doesn`t  work any more cause there are several changes,
>> that make this method impossible.
>
> How is it impossible?  Just disable the server selection list on the
> login page and set the desired server in the preauthenticate() hook. 
> See imp/config/hooks.php.dist
>
> michael
>
> ___________________________________
> Michael Slusarz [slusarz at horde.org]
>

Hi Michael,

while we where searching, why our H3-hook doesn`t work for H4, we found
f.e. that in imp/lib/Auth.php $_SERVER['HTTP_HOST'] is take for
identifying the users authentication host. This has to be changed for
each user who authenticates against a different server.

In our hook we have realised that in /horde/config/hooks.php over
$_SESSION['imp'][$key]:

if (!function_exists('_horde_hook_preauthenticate')) {
    function _horde_hook_preauthenticate($userID, $credential, $realm)
    {
        require dirname(__FILE__) . '/../imp/config/servers.php';
        $ma = exec("/usr/bin/ypmatch $userID mail.aliases");
// Ask yellow pages, which IMAP-server to choose
        if ( strpos($ma,",")) {
          $ma = substr($ma,0,strpos($ma,","));
          $mserver = strtolower(substr($ma,strpos($ma,"@")+1));
        } else {
          $mserver = strtolower(substr($ma,strpos($ma,"@")+1));
        }
// take server from servers.php
        foreach ( $servers as $key => $curServer ) {
          if ( $servers[$key]['smtphost'] == $mserver ) {
            $server = $key;
            break;
          }
          $server = 'imap';
        }
// Set IMAP server values.
foreach (array('server', 'folders', 'namespace', 'protocol', 'port',
'smtphost', 'smtpport', 'maildomain' ) as $key) {
            $_SESSION['imp'][$key] = $servers[$server][$key];
        }
        return true;
    }
 }

There seems to be also the requirement of changing the preferred
attribute in H4 to true in backends.local.php to every server in the array.

if we just leave the server selection list, this mechanisms are killing
the wanted automatic server selection.

I think we are not alone with our problem. Perhaps you have an idea how
our solution could be realised in a imp preauthenticate() hook?

Best Regards

Christopher

-- 

Dipl.-Ing. Christopher Neuhaus

Ruhrverband
Abteilung Datenverarbeitung
Kronprinzenstr. 37
45128 Essen

Telefon: 0201/178-1531
Telefax: 0201/178-1545
E-Mail: cne at ruhrverband.de
Internet: www.ruhrverband.de


Verbandsrat: Dr. Bernhard Görgens, Vorsitzender
Vorstand: Prof. Dr.-Ing. Harro Bode, Vorsitzender, Norbert Frece



More information about the horde mailing list