• We value your experience with Plesk during 2025
    Plesk strives to perform even better in 2026. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2025.
    Please take this short survey:

    https://survey.webpros.com/

IMP Login Patch

E

evangelion

Guest
I found this in :
/usr/share/psa-horde/imp/lib/Session.php

PHP:
/* Patch for PSA: I not found a config based-way to disable
         * short names, without @ so apply this patch */

        if (!preg_match('/^(.+)@(.+)$/', $imapuser, $matches)){                                 $imapuser .= '@' . $DomainName;
            $_SESSION['imp']['user'] = trim($imapuser);
        }

By the way IMP has this function and is checked just a few lines before:
PHP:
 /* Run the username through virtualhost expansion functions if
         * necessary. */
        $_SESSION['imp']['user'] = $imapuser;
        if (!empty($conf['hooks']['vinfo'])) {
            require_once HORDE_BASE . '/config/hooks.php';
            if (function_exists('_imp_hook_vinfo')) {
                $_SESSION['imp']['user'] = call_user_func('_imp_hook_vinfo');
            }
        }

I reccomend You to put these lines in horde/hooks.php instead


PHP:
if (!function_exists('_mimp_hook_vinfo')) {
    function _mimp_hook_vinfo($type = 'username')
    {
        $vdomain = getenv('HTTP_HOST');
        $vdomain = preg_replace('|^webmail\.|i', '', $vdomain);
        $vdomain = String::lower($vdomain);

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

Thank You
 
Back
Top