6.0.0-git
2018-12-09
Last Modified 2010-05-07 by Guest

Attachments

 cpanel.php

Save the following file (also attached to this page) to horde/lib/Auth/cpanel.php:

<?php

require_once dirname(__FILE__) . '/imap.php';

class Auth_cpanel extends Auth_imap {

    /**
     * Constructs a new cpanel authentication object.
     *
     * @param array $params  A hash containing connection parameters.
     */
    function Auth_cpanel($params = array())
    {
        $this->capabilities['transparent'] = true;
        parent::Auth_imap($params);
    }

    /**
     * Automatic authentication.
     *
     * @return boolean  Whether or not the client is allowed.
     */
    function transparent()
    {
        if ($this->_authenticate(getenv('REMOTE_USER'),
                                 array('password' => getenv('REMOTE_PASSWORD')))) {
            $this->setAuth(getenv('REMOTE_USER'),
                           array('transparent' => 1,
                                 'password' => getenv('REMOTE_PASSWORD')));
            return true;
        } else {
            return false;
        }
    }

}

Then add the following line to horde/config/conf.php after the line saying /* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */:

$conf['auth']['driver'] = 'cpanel';

Don't change anything else in the conf.php file.