[imp] Cyrus "realms" vs IMP "realms"
Edwin Culp
eculp@encontacto.net
Mon, 2 Sep 2002 10:24:12 -0700
Quoting "Marc G. Fournier" <scrappy@hub.org>:
| On Mon, 2 Sep 2002, Edwin Culp wrote:
|
| > | But when I try to login, it only gets the @$vdomain part:
| > |
| > | ...mail.pluto.hub.org:143[imap] as @pluto.hub.org ...
| > |
| > | So, what value should I be setting in there?
| >
| > I use the following script that will hopefully help as it is a bit
| different,
| > has the vdomain type and has worked for months. As they say if it works
| > don't fix it.
| >
| >
| > $conf['hooks']['vinfo'] = 'imp_get_vinfo';
| >
| > if (!function_exists('imp_get_vinfo')) {
| > function imp_get_vinfo ($type = 'username') {
| > global $conf, $imp;
| >
| > $vdomain = strtolower(preg_replace('|^mail\.|i', '',
| > $_SERVER['HTTP_HOST']));
| >
| > if ($type == 'username') {
| > return $_SESSION['imp']['user'] . '@' . $vdomain;
| > } elseif ($type == "vdomain") {
| > return $vdomain;
| > } else {
| > return new PEAR_Error('invalid type: ' . $type);
| > }
| > }
| > }
| >
| > Hope this helps,
|
| Nope, had thought to tried using the $_SESSION stuff, but then I get an
| error of:
|
| Notice: Undefined index: imp in
| /usr/local/www/pluto.hub.org/horde/imp/config/conf.php on line 312
|
| if (!function_exists('imp_get_vinfo')) {
| function imp_get_vinfo ($type) {
| global $conf, $imp;
|
| $vdomain = getenv('HTTP_HOST');
| $vdomain = preg_replace('|^webmail\.|i', '', $vdomain);
| $vdomain = strtolower($vdomain);
|
| return $_SESSION['imp']['user'] . '@' . $vdomain;
| }
| }
I'm sure that there is a better way to do this but this does work. Why
don't you try this patch for api.php to give a little more info on login
failures that you get without the domain. For example I removed the vhost
variable from vinfo in conf.php and got the following error in horde.log
Sep 02 10:08:56 HORDE [error] [imp] FAILED LOGIN 64.173.102.155 to
worldinternet.org:143[imap] as eculp@ [on line 161 of
"/usr/src/horde/imp/lib/IMP.php"]
BTW, if you put type back in along with the conditional you will see
"@your_domain.com" along side the login form. This, too, may help
you track down the error. I don't understand why it isn't working.
I'm sure you've looked for typos, right?
Index: api.php
===================================================================
RCS file: /repository/imp/lib/api.php,v
retrieving revision 1.38
diff -u -r1.38 api.php
--- api.php 29 Aug 2002 05:21:18 -0000 1.38
+++ api.php 2 Sep 2002 17:02:05 -0000
@@ -56,7 +56,9 @@
Horde::logMessage($entry, __FILE__, __LINE__, LOG_NOTICE);
return true;
}
-
+//ED: CHANGE for more info on login failure for Marc
+ $entry = sprintf('Login FAILURE for %s [%s] to {%s:%s}',
$imp['uniquser'], $_SERVER['REMOTE_ADDR'], $imp['server'], $imp['port']);
+ Horde::logMessage($entry, __FILE__, __LINE__, LOG_NOTICE);
return false;
}
Good luck,
ed
--