summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL2
-rw-r--r--plugins/managesieve/Changelog1
-rw-r--r--program/lib/Crypt/GPG.php (renamed from plugins/enigma/lib/Crypt/GPG.php)0
-rw-r--r--program/lib/Crypt/GPG/DecryptStatusHandler.php (renamed from plugins/enigma/lib/Crypt/GPG/DecryptStatusHandler.php)0
-rw-r--r--program/lib/Crypt/GPG/Engine.php (renamed from plugins/enigma/lib/Crypt/GPG/Engine.php)0
-rw-r--r--program/lib/Crypt/GPG/Exceptions.php (renamed from plugins/enigma/lib/Crypt/GPG/Exceptions.php)0
-rw-r--r--program/lib/Crypt/GPG/Key.php (renamed from plugins/enigma/lib/Crypt/GPG/Key.php)0
-rw-r--r--program/lib/Crypt/GPG/Signature.php (renamed from plugins/enigma/lib/Crypt/GPG/Signature.php)0
-rw-r--r--program/lib/Crypt/GPG/SubKey.php (renamed from plugins/enigma/lib/Crypt/GPG/SubKey.php)0
-rw-r--r--program/lib/Crypt/GPG/UserId.php (renamed from plugins/enigma/lib/Crypt/GPG/UserId.php)0
-rw-r--r--program/lib/Crypt/GPG/VerifyStatusHandler.php (renamed from plugins/enigma/lib/Crypt/GPG/VerifyStatusHandler.php)0
-rw-r--r--program/lib/Net/Sieve.php (renamed from plugins/managesieve/lib/Net/Sieve.php)76
12 files changed, 40 insertions, 39 deletions
diff --git a/INSTALL b/INSTALL
index 5b1c21dac..834972c9c 100644
--- a/INSTALL
+++ b/INSTALL
@@ -23,6 +23,8 @@ REQUIREMENTS
- Net_SMTP (latest from https://github.com/pear/Net_SMTP/)
- Net_IDNA2 0.1.1 or newer
- Auth_SASL 1.0.6 or newer
+ - Net_Sieve 1.8.2 or newer (for managesieve plugin)
+ - Crypt_GPG 1.2.0 or newer (for enigma plugin)
* php.ini options (see .htaccess file):
- error_reporting E_ALL & ~E_NOTICE (or lower)
- memory_limit > 16MB (increase as suitable to support large attachments)
diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog
index c792c81da..115aec14f 100644
--- a/plugins/managesieve/Changelog
+++ b/plugins/managesieve/Changelog
@@ -1,3 +1,4 @@
+- lib/Net Sieve.php moved to Roundcube /lib directory
- Added managesieve_domains option to limit redirect destinations
- Fix bug where at least one additional address of vacation message was required (#1489345)
- Fix so i;ascii-numeric comparator is not forced as default for :count and :value operators
diff --git a/plugins/enigma/lib/Crypt/GPG.php b/program/lib/Crypt/GPG.php
index 6e8e717e8..6e8e717e8 100644
--- a/plugins/enigma/lib/Crypt/GPG.php
+++ b/program/lib/Crypt/GPG.php
diff --git a/plugins/enigma/lib/Crypt/GPG/DecryptStatusHandler.php b/program/lib/Crypt/GPG/DecryptStatusHandler.php
index 40e8d50ed..40e8d50ed 100644
--- a/plugins/enigma/lib/Crypt/GPG/DecryptStatusHandler.php
+++ b/program/lib/Crypt/GPG/DecryptStatusHandler.php
diff --git a/plugins/enigma/lib/Crypt/GPG/Engine.php b/program/lib/Crypt/GPG/Engine.php
index 081be8e21..081be8e21 100644
--- a/plugins/enigma/lib/Crypt/GPG/Engine.php
+++ b/program/lib/Crypt/GPG/Engine.php
diff --git a/plugins/enigma/lib/Crypt/GPG/Exceptions.php b/program/lib/Crypt/GPG/Exceptions.php
index 744acf5d4..744acf5d4 100644
--- a/plugins/enigma/lib/Crypt/GPG/Exceptions.php
+++ b/program/lib/Crypt/GPG/Exceptions.php
diff --git a/plugins/enigma/lib/Crypt/GPG/Key.php b/program/lib/Crypt/GPG/Key.php
index 67a4b9c7d..67a4b9c7d 100644
--- a/plugins/enigma/lib/Crypt/GPG/Key.php
+++ b/program/lib/Crypt/GPG/Key.php
diff --git a/plugins/enigma/lib/Crypt/GPG/Signature.php b/program/lib/Crypt/GPG/Signature.php
index 03ab44c53..03ab44c53 100644
--- a/plugins/enigma/lib/Crypt/GPG/Signature.php
+++ b/program/lib/Crypt/GPG/Signature.php
diff --git a/plugins/enigma/lib/Crypt/GPG/SubKey.php b/program/lib/Crypt/GPG/SubKey.php
index b6316e99f..b6316e99f 100644
--- a/plugins/enigma/lib/Crypt/GPG/SubKey.php
+++ b/program/lib/Crypt/GPG/SubKey.php
diff --git a/plugins/enigma/lib/Crypt/GPG/UserId.php b/program/lib/Crypt/GPG/UserId.php
index 04435708c..04435708c 100644
--- a/plugins/enigma/lib/Crypt/GPG/UserId.php
+++ b/program/lib/Crypt/GPG/UserId.php
diff --git a/plugins/enigma/lib/Crypt/GPG/VerifyStatusHandler.php b/program/lib/Crypt/GPG/VerifyStatusHandler.php
index 083bd3012..083bd3012 100644
--- a/plugins/enigma/lib/Crypt/GPG/VerifyStatusHandler.php
+++ b/program/lib/Crypt/GPG/VerifyStatusHandler.php
diff --git a/plugins/managesieve/lib/Net/Sieve.php b/program/lib/Net/Sieve.php
index 8a0a9b0e1..8ebdf0958 100644
--- a/plugins/managesieve/lib/Net/Sieve.php
+++ b/program/lib/Net/Sieve.php
@@ -39,7 +39,7 @@
* @copyright 2002-2003 Richard Heyes
* @copyright 2006-2008 Anish Mistry
* @license http://www.opensource.org/licenses/bsd-license.php BSD
- * @version SVN: $Id: Sieve.php 300898 2010-07-01 09:49:02Z yunosh $
+ * @version SVN: $Id$
* @link http://pear.php.net/package/Net_Sieve
*/
@@ -83,12 +83,12 @@ define('NET_SIEVE_STATE_TRANSACTION', 3, true);
* @copyright 2002-2003 Richard Heyes
* @copyright 2006-2008 Anish Mistry
* @license http://www.opensource.org/licenses/bsd-license.php BSD
- * @version Release: 1.3.0
+ * @version Release: 1.3.2
* @link http://pear.php.net/package/Net_Sieve
- * @link http://www.ietf.org/rfc/rfc3028.txt RFC 3028 (Sieve: A Mail
+ * @link http://tools.ietf.org/html/rfc5228 RFC 5228 (Sieve: An Email
* Filtering Language)
- * @link http://tools.ietf.org/html/draft-ietf-sieve-managesieve A
- * Protocol for Remotely Managing Sieve Scripts
+ * @link http://tools.ietf.org/html/rfc5804 RFC 5804 A Protocol for
+ * Remotely Managing Sieve Scripts
*/
class Net_Sieve
{
@@ -299,7 +299,7 @@ class Net_Sieve
$this->_data['host'] = $host;
$this->_data['port'] = $port;
$this->_useTLS = $useTLS;
- if (!empty($options) && is_array($options)) {
+ if (is_array($options)) {
$this->_options = array_merge($this->_options, $options);
}
@@ -489,8 +489,7 @@ class Net_Sieve
return PEAR::raiseError('Not currently in TRANSACTION state', 1);
}
- $command = sprintf('HAVESPACE %s %d', $this->_escape($scriptname), $size);
- if (PEAR::isError($res = $this->_doCmd($command))) {
+ if (PEAR::isError($res = $this->_doCmd(sprintf('HAVESPACE %s %d', $this->_escape($scriptname), $size)))) {
return $res;
}
return true;
@@ -616,6 +615,13 @@ class Net_Sieve
return $res;
}
+ // Query the server capabilities again now that we are authenticated.
+ if (PEAR::isError($res = $this->_cmdCapability())) {
+ return PEAR::raiseError(
+ 'Failed to connect, server said: ' . $res->getMessage(), 2
+ );
+ }
+
return $result;
}
@@ -756,8 +762,7 @@ class Net_Sieve
return PEAR::raiseError('Not currently in AUTHORISATION state', 1);
}
- $command = sprintf('DELETESCRIPT %s', $this->_escape($scriptname));
- if (PEAR::isError($res = $this->_doCmd($command))) {
+ if (PEAR::isError($res = $this->_doCmd(sprintf('DELETESCRIPT %s', $this->_escape($scriptname))))) {
return $res;
}
return true;
@@ -776,8 +781,7 @@ class Net_Sieve
return PEAR::raiseError('Not currently in AUTHORISATION state', 1);
}
- $command = sprintf('GETSCRIPT %s', $this->_escape($scriptname));
- if (PEAR::isError($res = $this->_doCmd($command))) {
+ if (PEAR::isError($res = $this->_doCmd(sprintf('GETSCRIPT %s', $this->_escape($scriptname))))) {
return $res;
}
@@ -798,8 +802,7 @@ class Net_Sieve
return PEAR::raiseError('Not currently in AUTHORISATION state', 1);
}
- $command = sprintf('SETACTIVE %s', $this->_escape($scriptname));
- if (PEAR::isError($res = $this->_doCmd($command))) {
+ if (PEAR::isError($res = $this->_doCmd(sprintf('SETACTIVE %s', $this->_escape($scriptname))))) {
return $res;
}
@@ -856,8 +859,9 @@ class Net_Sieve
$stringLength = $this->_getLineLength($scriptdata);
$command = sprintf("PUTSCRIPT %s {%d+}\r\n%s",
- $this->_escape($scriptname), $stringLength, $scriptdata);
-
+ $this->_escape($scriptname),
+ $stringLength,
+ $scriptdata);
if (PEAR::isError($res = $this->_doCmd($command))) {
return $res;
}
@@ -1005,9 +1009,9 @@ class Net_Sieve
}
/**
- * Receives x bytes from the server.
+ * Receives a number of bytes from the server.
*
- * @param int $length Number of bytes to read
+ * @param integer $length Number of bytes to read.
*
* @return string The server response.
*/
@@ -1015,14 +1019,11 @@ class Net_Sieve
{
$response = '';
$response_length = 0;
-
while ($response_length < $length) {
$response .= $this->_sock->read($length - $response_length);
$response_length = $this->_getLineLength($response);
}
-
- $this->_debug("S: " . rtrim($response));
-
+ $this->_debug('S: ' . rtrim($response));
return $response;
}
@@ -1059,7 +1060,7 @@ class Net_Sieve
if ('NO' == substr($uc_line, 0, 2)) {
// Check for string literal error message.
- if (preg_match('/{([0-9]+)}$/i', $line, $matches)) {
+ if (preg_match('/{([0-9]+)}$/', $line, $matches)) {
$line = substr($line, 0, -(strlen($matches[1])+2))
. str_replace(
"\r\n", ' ', $this->_recvBytes($matches[1] + 2)
@@ -1098,12 +1099,9 @@ class Net_Sieve
return PEAR::raiseError(trim($response . $line), 6);
}
- // "\+?" is added in the regexp to workaround DBMail bug
- // http://dbmail.org/mantis/view.php?id=963
- if (preg_match('/^{([0-9]+)\+?}/i', $line, $matches)) {
+ if (preg_match('/^{([0-9]+)}/', $line, $matches)) {
// Matches literal string responses.
$line = $this->_recvBytes($matches[1] + 2);
-
if (!$auth) {
// Receive the pending OK only if we aren't
// authenticating since string responses during
@@ -1187,16 +1185,16 @@ class Net_Sieve
// The server should be sending a CAPABILITY response after
// negotiating TLS. Read it, and ignore if it doesn't.
- // Doesn't work with older timsieved versions
- $regexp = '/^CYRUS TIMSIEVED V([0-9.]+)/';
- if (!preg_match($regexp, $this->_capability['implementation'], $matches)
- || version_compare($matches[1], '2.3.10', '>=')
- ) {
+ // Unfortunately old Cyrus versions are broken and don't send a
+ // CAPABILITY response, thus we would wait here forever. Parse the
+ // Cyrus version and work around this broken behavior.
+ if (!preg_match('/^CYRUS TIMSIEVED V([0-9.]+)/', $this->_capability['implementation'], $matches) ||
+ version_compare($matches[1], '2.3.10', '>=')) {
$this->_doCmd();
}
- // RFC says we need to query the server capabilities again now that we
- // are under encryption.
+ // Query the server capabilities again now that we are under
+ // encryption.
if (PEAR::isError($res = $this->_cmdCapability())) {
return PEAR::raiseError(
'Failed to connect, server said: ' . $res->getMessage(), 2
@@ -1239,16 +1237,16 @@ class Net_Sieve
}
/**
- * Convert string into RFC's quoted-string or literal-c2s form
+ * Converts strings into RFC's quoted-string or literal-c2s form.
*
- * @param string $string The string to convert.
+ * @param string $string The string to convert.
*
- * @return string Result string
+ * @return string Result string.
*/
function _escape($string)
{
- // Some implementations doesn't allow UTF-8 characters in quoted-string
- // It's safe to use literal-c2s
+ // Some implementations don't allow UTF-8 characters in quoted-string,
+ // use literal-c2s.
if (preg_match('/[^\x01-\x09\x0B-\x0C\x0E-\x7F]/', $string)) {
return sprintf("{%d+}\r\n%s", $this->_getLineLength($string), $string);
}