Added replacement variables support in password_pop_host (#5539)

Use rcube_utils::parse_host() on a hostname
pull/5549/head
Paolo Asperti 8 years ago committed by Aleksander Machniak
parent a99e479cb4
commit 815b79df7f

@ -132,10 +132,17 @@ $config['password_hash_base64'] = false;
// Poppassd Driver options // Poppassd Driver options
// ----------------------- // -----------------------
// The host which changes the password // The host which changes the password (default: localhost)
// Supported replacement variables:
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %h - IMAP host
// %z - IMAP domain without first part
// %s - domain name after the '@' from e-mail address provided at login screen
$config['password_pop_host'] = 'localhost'; $config['password_pop_host'] = 'localhost';
// TCP port used for poppassd connections // TCP port used for poppassd connections (default: 106)
$config['password_pop_port'] = 106; $config['password_pop_port'] = 106;

@ -40,8 +40,12 @@ class rcube_poppassd_password
$rcmail = rcmail::get_instance(); $rcmail = rcmail::get_instance();
// include('Net/Socket.php'); // include('Net/Socket.php');
$poppassd = new Net_Socket(); $poppassd = new Net_Socket();
$host = $rcmail->config->get('password_pop_host', 'localhost');
$host = rcube_utils::parse_host($host);
$port = $rcmail->config->get('password_pop_port', 106)
$result = $poppassd->connect($rcmail->config->get('password_pop_host'), $rcmail->config->get('password_pop_port'), null); $result = $poppassd->connect($host, $port, null);
if (is_a($result, 'PEAR_Error')) { if (is_a($result, 'PEAR_Error')) {
return $this->format_error_result(PASSWORD_CONNECT_ERROR, $result->getMessage()); return $this->format_error_result(PASSWORD_CONNECT_ERROR, $result->getMessage());
} }

Loading…
Cancel
Save