[imp] HORDE/IMP with sperate logins synced.

Jon Mailing_Lists at Sytone.com
Sun Jun 26 08:49:43 PDT 2005


Jon <Mailing_Lists <at> Sytone.com> writes:

> 
> Hi,
> 
> I want to have al login for Horde ie fsmith and then have it mapped to a IMP
> login (w213-232) as it is a pain to rember the cryptic login.

Any ideas at all?  I want to use Horde as my login manager so I can create
friendly names for login, and then have the backend worry about the login to the
IMAP server.

Steps:
Login:-
 User: fsmith
 Pass: 123123
The user then clicks on mail (Or mail check action happens)
IMAP geting login details
Performs a lookup
  fsmith = v123123
Passwords will always match.
IMP logs in.

I have done a hack as per below, but filtering is not working. Im wondering if
this is the best way to do the auth lookup and would it affect ingo.

    function authenticate($userID = null, $credentials = array(),
                          $login = false)
    {
        // Check for for hordeauth.
        if (empty($_SESSION['imp']['uniquser'])) {
            if (IMP::canAutoLogin()) {
                $server_key = IMP::getAutoLoginServer();

                require IMP_BASE . '/config/servers.php';
                $ptr = &$servers[$server_key];
                if (isset($ptr['hordeauth'])) {

                    if (strcasecmp($ptr['hordeauth'], 'full') == 0) {
                        $imapuser = Auth::getAuth();
                    } else {
                        $imapuser = Auth::getBareAuth();
                    }
//My Hack
if ($imapuser == 'fsmith') {
$imapuser = 'v123123';
$_SESSION['imp']['user'] = 'v123123';
}
                    $pass = Auth::getCredential('password');

                    require_once IMP_BASE . '/lib/Session.php';
                    if (IMP_Session::createSession($imapuser, $pass,
                                                   $ptr['server'], $ptr)) {
                        $entry = sprintf('Login success for %s [%s] to {%s:%s}',
                                         $imapuser, $_SERVER['REMOTE_ADDR'],
                                         $ptr['server'], $ptr['port']);
                        Horde::logMessage($entry, __FILE__, __LINE__,
                                          PEAR_LOG_NOTICE);
                        return true;
                    }
                }
            }
        }

        if (empty($userID)) {
            if (empty($_SESSION['imp']['uniquser'])) {
                return false;
            }
            $userID = $_SESSION['imp']['uniquser'];
        }

        if (empty($credentials)) {
            if (empty($_SESSION['imp']['pass'])) {
                return false;
            }
            $credentials = array('password' =>
Secret::read(Secret::getKey('imp'), $_SESSION['imp']['pass']));
        }

        $login = ($login && ($this->getProvider() == 'imp'));

        return parent::authenticate($userID, $credentials, $login);
    } 

> Also any good pointers on Ingo, it does not seem to be filtering mail and I can
> see no error messages anywhere :(
> 






More information about the imp mailing list