Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Support tls:// prefix in managesieve_host option

  • Loading branch information...
commit 6c7ac2ef4b6e9482fd47b290dd9b07e5f8a0bd54 1 parent b5767d9
Aleksander Machniak alecpl authored
2  plugins/managesieve/Changelog
... ... @@ -1,3 +1,5 @@
  1 +- Support tls:// prefix in managesieve_host option
  2 +
1 3 * version 6.1 [2012-12-21]
2 4 -----------------------------------------------------------
3 5 - Fixed filter activation/deactivation confirmation message (#1488765)
3  plugins/managesieve/config.inc.php.dist
@@ -25,8 +25,7 @@ $rcmail_config['managesieve_auth_cid'] = null;
25 25 $rcmail_config['managesieve_auth_pw'] = null;
26 26
27 27 // use or not TLS for managesieve server connection
28   -// it's because I've problems with TLS and dovecot's managesieve plugin
29   -// and it's not needed on localhost
  28 +// Note: tls:// prefix in managesieve_host is also supported
30 29 $rcmail_config['managesieve_usetls'] = false;
31 30
32 31 // default contents of filters script (eg. default spam filter)
15 plugins/managesieve/managesieve.php
@@ -200,10 +200,19 @@ function managesieve_start()
200 200 $include_path .= ini_get('include_path');
201 201 set_include_path($include_path);
202 202
203   - $host = rcube_parse_host($this->rc->config->get('managesieve_host', 'localhost'));
  203 + // Get connection parameters
  204 + $host = $this->rc->config->get('managesieve_host', 'localhost');
  205 + $port = $this->rc->config->get('managesieve_port');
  206 + $tls = $this->rc->config->get('managesieve_usetls', false);
  207 +
  208 + $host = rcube_parse_host($host);
204 209 $host = rcube_idn_to_ascii($host);
205 210
206   - $port = $this->rc->config->get('managesieve_port');
  211 + // remove tls:// prefix, set TLS flag
  212 + if (($host = preg_replace('|^tls://|i', '', $host, 1, $cnt)) && $cnt) {
  213 + $tls = true;
  214 + }
  215 +
207 216 if (empty($port)) {
208 217 $port = getservbyname('sieve', 'tcp');
209 218 if (empty($port)) {
@@ -216,8 +225,8 @@ function managesieve_start()
216 225 'password' => $this->rc->decrypt($_SESSION['password']),
217 226 'host' => $host,
218 227 'port' => $port,
  228 + 'usetls' => $tls,
219 229 'auth_type' => $this->rc->config->get('managesieve_auth_type'),
220   - 'usetls' => $this->rc->config->get('managesieve_usetls', false),
221 230 'disabled' => $this->rc->config->get('managesieve_disabled_extensions'),
222 231 'debug' => $this->rc->config->get('managesieve_debug', false),
223 232 'auth_cid' => $this->rc->config->get('managesieve_auth_cid'),

0 comments on commit 6c7ac2e

Please sign in to comment.
Something went wrong with that request. Please try again.