• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.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