[horde] Individual hosts in gollem

Jan Schneider jan at horde.org
Tue May 8 09:12:13 UTC 2012


Please don't top-post.

Zitat von Christopher Neuhaus <cne at ruhrverband.de>:

> Hi Jan,
>
>>
>> Zitat von Christopher Neuhaus <cne at ruhrverband.de>:
>>
>>> Hi List!
>>>
>>> I just try to get the list of servers on which the user can log in by
>>> smb in gollem.
>>> In horde and IMP, this is no problem, because I can use the hook to
>>> extract the server from the mail address, I can get from yellow pages
>>> (ypmatch).
>>>
>>> But how can I do this in gollem?
>>
>> Please use more words to describe exactly what you are trying to do,
>> how you do that in IMP, what you tried in Gollem, and what didn't
>> work, including examples.
>>
> sorry for my short expression.
> We use this hook to get the right authentication-server for the login:
>
> /horde/config/hooks.php:
> ---------------------------------
> class Horde_Hooks
> {
> public function preauthenticate($userId, $credentials)
> {
>  require dirname(__FILE__) . '/../imp/config/backends.local.php';
>  $ma = exec("/usr/bin/ypmatch $userId mail.aliases");
>  if ( strpos($ma,",")) {
>         $ma = substr($ma,0,strpos($ma,","));
>         $mserver = strtolower(substr($ma,strpos($ma,"@")+1));
>  } else {
>         $mserver = strtolower(substr($ma,strpos($ma,"@")+1));
>  }
>  foreach ( $servers as $key => $curServer ) {
>         if ( $servers[$key]['smtphost'] == $mserver ) {
>         $credentials['server'] = $key;
>         break;
>         }
>  }
>  return array('credentials' => $credentials);
> }
> }
> ---------------------------------
> Now we want to use the same serverlist from
> '/../imp/config/backends.local.php' to choose the server for the
> smb-authentication in gollem.
>
> My solution is now in /var/www/horde/gollem/config/backends.local.php
> ---------------------------------
> $rv_auth = $GLOBALS['registry']->getAuth('bare');
> require dirname(__FILE__) . '/../../imp/config/backends.local.php';
> $ma = exec("/usr/bin/ypmatch $rv_auth mail.aliases");
>
>  if ( strpos($ma,",")) {
> [...] see above
>
> $backends['smb'] = array(
>     'disabled' => false,
>     [...]
>     'params' => array(
>         'hostspec' => $mserver,
>         'port' => 139,
>         'share' => $rv_auth,
>     [...]
>
>
> ---------------------------------
>
> This mods are not really robust and make a bad performance on the
> login-site.
> I think there can be a better solution.

What's not robust about them? The only issue I see with this approach,  
is that you shouldn't load IMP's backend configuration from Gollem. If  
you are only after $rv_auth, put that into a separate file that you  
load from both backend.local.php files. And you probably want to cache  
the result, so that it's only called once during the complete Horde  
session.

-- 
Jan Schneider
The Horde Project
http://www.horde.org/




More information about the horde mailing list