Aleksander Machniak
2014-06-16 b76f8e5e26f638ecbe5bdcb58b6792ce05dabd86
Added option to specify connection socket parameters - managesieve_conn_options
4 files modified
22 ■■■■ changed files
plugins/managesieve/Changelog 1 ●●●● patch | view | raw | blame | history
plugins/managesieve/config.inc.php.dist 12 ●●●●● patch | view | raw | blame | history
plugins/managesieve/lib/Roundcube/rcube_sieve.php 5 ●●●●● patch | view | raw | blame | history
plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php 4 ●●● patch | view | raw | blame | history
plugins/managesieve/Changelog
@@ -2,6 +2,7 @@
- Fix disabled "create filter" action
- Fix enotify/notify extension handling
- Improved UI accessibility
- Added option to specify connection socket parameters - managesieve_conn_options
* version 7.2 [2014-02-14]
-----------------------------------------------------------
plugins/managesieve/config.inc.php.dist
@@ -28,6 +28,18 @@
// Note: tls:// prefix in managesieve_host is also supported
$config['managesieve_usetls'] = false;
// Connection scket context options
// See http://php.net/manual/en/context.ssl.php
// The example below enables server certificate validation
//$config['imap_conn_options'] = array(
//  'ssl'         => array(
//     'verify_peer'  => true,
//     'verify_depth' => 3,
//     'cafile'       => '/etc/openssl/certs/ca.crt',
//   ),
// );
$config['managesieve_conn_options'] = null;
// default contents of filters script (eg. default spam filter)
$config['managesieve_default'] = '/etc/dovecot/sieve/global';
plugins/managesieve/lib/Roundcube/rcube_sieve.php
@@ -57,10 +57,11 @@
     * @param boolean Enable/disable debugging
     * @param string  Proxy authentication identifier
     * @param string  Proxy authentication password
     * @param array   List of options to pass to stream_context_create().
     */
    public function __construct($username, $password='', $host='localhost', $port=2000,
        $auth_type=null, $usetls=true, $disabled=array(), $debug=false,
        $auth_cid=null, $auth_pw=null)
        $auth_cid=null, $auth_pw=null, $options=array())
    {
        $this->sieve = new Net_Sieve();
@@ -68,7 +69,7 @@
            $this->sieve->setDebug(true, array($this, 'debug_handler'));
        }
        if (PEAR::isError($this->sieve->connect($host, $port, null, $usetls))) {
        if (PEAR::isError($this->sieve->connect($host, $port, $options, $usetls))) {
            return $this->_set_error(SIEVE_ERROR_CONNECTION);
        }
plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
@@ -122,6 +122,7 @@
            'debug'     => $this->rc->config->get('managesieve_debug', false),
            'auth_cid'  => $this->rc->config->get('managesieve_auth_cid'),
            'auth_pw'   => $this->rc->config->get('managesieve_auth_pw'),
            'socket_options' => $this->rc->config->get('managesieve_conn_options'),
        ));
        // try to connect to managesieve server and to fetch the script
@@ -135,7 +136,8 @@
            $plugin['disabled'],
            $plugin['debug'],
            $plugin['auth_cid'],
            $plugin['auth_pw']
            $plugin['auth_pw'],
            $plugin['socket_options']
        );
        if (!($error = $this->sieve->error())) {