|
|
|
|
@ -76,34 +76,28 @@ class krb_authentication extends rcube_plugin
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Storage_connect hook handler
|
|
|
|
|
* login_after hook handler
|
|
|
|
|
*/
|
|
|
|
|
function storage_connect($args)
|
|
|
|
|
function login($args)
|
|
|
|
|
{
|
|
|
|
|
if (!empty($_SERVER['REMOTE_USER']) && !empty($_SERVER['KRB5CCNAME'])) {
|
|
|
|
|
// Load plugin's config file
|
|
|
|
|
$this->load_config();
|
|
|
|
|
|
|
|
|
|
$rcmail = rcmail::get_instance();
|
|
|
|
|
$context = $rcmail->config->get('krb_authentication_context');
|
|
|
|
|
|
|
|
|
|
$args['gssapi_context'] = $context ?: 'imap/kolab.example.org@EXAMPLE.ORG';
|
|
|
|
|
$args['gssapi_cn'] = $_SERVER['KRB5CCNAME'];
|
|
|
|
|
$args['auth_type'] = 'GSSAPI';
|
|
|
|
|
// Redirect to the previous QUERY_STRING
|
|
|
|
|
if ($this->redirect_query) {
|
|
|
|
|
header('Location: ./?' . $this->redirect_query);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $args;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* login_after hook handler
|
|
|
|
|
* Storage_connect hook handler
|
|
|
|
|
*/
|
|
|
|
|
function login($args)
|
|
|
|
|
function storage_connect($args)
|
|
|
|
|
{
|
|
|
|
|
// Redirect to the previous QUERY_STRING
|
|
|
|
|
if ($this->redirect_query) {
|
|
|
|
|
header('Location: ./?' . $this->redirect_query);
|
|
|
|
|
exit;
|
|
|
|
|
if (!empty($_SERVER['REMOTE_USER']) && !empty($_SERVER['KRB5CCNAME'])) {
|
|
|
|
|
$args['gssapi_context'] = $this->gssapi_context('imap');
|
|
|
|
|
$args['gssapi_cn'] = $_SERVER['KRB5CCNAME'];
|
|
|
|
|
$args['auth_type'] = 'GSSAPI';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $args;
|
|
|
|
|
@ -115,37 +109,43 @@ class krb_authentication extends rcube_plugin
|
|
|
|
|
function managesieve_connect($args)
|
|
|
|
|
{
|
|
|
|
|
if ((!isset($args['auth_type']) || $args['auth_type'] == 'GSSAPI') && !empty($_SERVER['REMOTE_USER']) && !empty($_SERVER['KRB5CCNAME'])) {
|
|
|
|
|
// Load plugin's config file
|
|
|
|
|
$this->load_config();
|
|
|
|
|
|
|
|
|
|
$rcmail = rcmail::get_instance();
|
|
|
|
|
$context = $rcmail->config->get('krb_authentication_context');
|
|
|
|
|
|
|
|
|
|
$args['gssapi_context'] = $context ?: 'imap/kolab.example.org@EXAMPLE.ORG';
|
|
|
|
|
$args['gssapi_context'] = $this->gssapi_context('sieve');
|
|
|
|
|
$args['gssapi_cn'] = $_SERVER['KRB5CCNAME'];
|
|
|
|
|
$args['auth_type'] = 'GSSAPI';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $args;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* smtp_connect hook handler
|
|
|
|
|
*/
|
|
|
|
|
function smtp_connect($args)
|
|
|
|
|
{
|
|
|
|
|
if ((!isset($args['smtp_auth_type']) || $args['smtp_auth_type'] == 'GSSAPI') && !empty($_SERVER['REMOTE_USER']) && !empty($_SERVER['KRB5CCNAME'])) {
|
|
|
|
|
// Load plugin's config file
|
|
|
|
|
$this->load_config();
|
|
|
|
|
|
|
|
|
|
$rcmail = rcmail::get_instance();
|
|
|
|
|
$context = $rcmail->config->get('krb_authentication_context');
|
|
|
|
|
|
|
|
|
|
$args['gssapi_context'] = $context ?: 'imap/kolab.example.org@EXAMPLE.ORG';
|
|
|
|
|
$args['gssapi_context'] = $this->gssapi_context('smtp');
|
|
|
|
|
$args['gssapi_cn'] = $_SERVER['KRB5CCNAME'];
|
|
|
|
|
$args['smtp_auth_type'] = 'GSSAPI';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $args;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns configured GSSAPI context string
|
|
|
|
|
*/
|
|
|
|
|
private function gssapi_context($protocol)
|
|
|
|
|
{
|
|
|
|
|
// Load plugin's config file
|
|
|
|
|
$this->load_config();
|
|
|
|
|
|
|
|
|
|
$rcmail = rcmail::get_instance();
|
|
|
|
|
$context = $rcmail->config->get('krb_authentication_context');
|
|
|
|
|
|
|
|
|
|
if (is_array($context)) {
|
|
|
|
|
$context = $context[$protocol];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $context ?: 'host.fqdn@REALM.NAME';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|