[imp] setting the mail server via LDAP in IMP 4.0.1? also, syslog logging.

Sheeri Kritzer sheeri.kritzer at tufts.edu
Wed Feb 9 07:27:39 PST 2005


Hello,

I am in the process of upgrading our webmail system from Horde 2 /IMP 3 to Horde 
3/ IMP 4.

I configured everything with a basic configuration, hard-coding the mail server 
in config/servers.php and everything worked -- IMP 4.0.1 was able to read e-mail 
off our IMAP server as well as send mail successfully.  (Some of the new 
features are awesome, like the keyboard shortcuts. . . whee!)

Now that I have basic functionality, I'm doing the more advanced configuration.  
One of the problems I'm having is getting horde to log via syslog.  File logging
works fine, and we had syslog logging before, so I'm not sure what I'm doing
wrong.  Relevant conf:

/etc/syslog.conf:

local4.info                /var/log/imp.log

horde/config/conf.php

$conf['log']['priority'] = PEAR_LOG_ALL;
$conf['log']['ident'] = 'HORDE';
$conf['log']['params'] = array();
$conf['log']['name'] = 'local4';
$conf['log']['params']['append'] = true;
$conf['log']['type'] = 'syslog';
$conf['log']['enabled'] = true;

I've also tried it with:
$conf['log']['name'] = 'LOG_LOCAL4';

What am I doing wrong?

The other problem I'm having is migrating one of our custom hooks -- we 
determine what mail server to use based on a field in LDAP.

Relevant conf:
in horde/config/conf.php:

$conf['hooks']['getserver'] = true;

in horde/imp/config/conf.php:

$conf['server']['server_list'] = 'hidden';
$conf['server']['change_server'] = false;
$conf['server']['change_port'] = false;
$conf['server']['change_protocol'] = false;
$conf['server']['change_folders'] = false;
$conf['server']['sort_limit'] = '0';
$conf['server']['cache_folders'] = false;
$conf['hooks']['server'] = _imp_hook_getserver;

in hooks.php:

if( !function_exists('_imp_hook_getserver') ){
        function _imp_hook_getserver( $userId ){
                $val = fetch_ldap_attr($userId, 'tuftsedutrumpetermailhost');
                if( $val == false ){
                        return false;
                }

                $imp['server'] = $val;
                $imp['maildomain'] = $imp['server'];
                return true;
        }
}

(and yes, fetch_ldap_attr is a defined function, but it includes passwords and
such.  I've been able to determine that the function works, and horde actually
binds to LDAP and gets the value.  I'm guessing that what's wrong is that
$imp['server'] is no longer the variable to change for the server. . .)

in horde/lib/Horde/Auth.php, I added:
        if (!empty($conf['hooks']['getserver'])) {
            include_once HORDE_BASE . '/config/hooks.php';
            if (function_exists('_imp_hook_getserver')) {
                if (!call_user_func('_imp_hook_getserver', $userId)) {
                    $this->_setAuthError(AUTH_REASON_LDAP);
                    return false;
                }
            }
        }

(and I also defined what AUTH_REASON_LDAP is)

in horde/imp/config/servers.php:

$servers[''] = array(
    'name' => 'IMAP Server',
    'server' => '',
    'hordeauth' => false,
    'protocol' => 'imap/ssl/novalidate-cert',
    'port' => '993',
    'folders' => '',
    'namespace' => '',
    'maildomain' => '',
    'smtphost' => 'smtp.tufts.edu',
    'smtpport' => '25',
    'realm' => '',
    'preferred' => '',
    'dotfiles' => false,
    'hierarchies' => array()
);

Thanx for your time!

-Sheeri Kritzer
Systems Administrator
University Systems Group
Tufts University
617-627-3925
sheeri.kritzer at tufts.edu






More information about the imp mailing list