[horde] Default domain when using LDAP authentication

Leland J. Steinke steinkel at ctinetworks.com
Mon Feb 2 15:37:34 UTC 2009


Jason Voorhees wrote:
> Could you give some idea about what hook or portion code is where I
> should make modifications?

Use the IMP vinfo hook.  Here's ours (slightly redacted) where we pull 
the realm from the HTTP_HOST environment variable, if one is not already 
provided:

if (!function_exists('_imp_hook_vinfo')) {
     function _imp_hook_vinfo($type = 'username')
     {
         $vdomain = getenv('HTTP_HOST');
         $vdomain = preg_replace('#^(webmail|horde)[0-9]*\.#i', '', 
$vdomain);
         $vdomain = String::lower($vdomain);

         if ($type == 'username') {
             if (isset($_SESSION['imp']['user'])) {
                 if (strpos($_SESSION['imp']['user'], '@')) {
                     return $_SESSION['imp']['user'];
                 } else {
                     return $_SESSION['imp']['user'] . '@' . $vdomain;
                 }
             } else {
                 return '';
             }
         } elseif ($type == 'vdomain') {
             return $vdomain;
         } else {
             return PEAR::raiseError('invalid type: ' . $type);
         }
     }
}


Leland
-- 
Leland Steinke
Network Engineer
CTI Networks, Inc.


More information about the horde mailing list