Roundcube Community Forum
Miscellaneous => Roundcube Discussion => Topic started by: chingson on November 24, 2011, 02:28:01 AM
-
After R-Cube 5, Managesieve plug-in always fail with my DBMAIL-timsieved, which shall be compatible to other sieve-daemon. Even all my scripts are created by R-Cube 4.
I found modifying _recvLn() function in Sieve.php can make it back to work. I don't know why empty $lastline need to raise error in source code.
Any comments?
function _recvLn()
{
if (PEAR::isError($lastline = $this->_sock->gets(8192))) {
return PEAR::raiseError(
'Failed to read from socket: ' . $lastline->getMessage()
);
}
$lastline = rtrim($lastline);
$this->_debug("S: $lastline");
//if ($lastline === '') {
// return PEAR::raiseError('Failed to read from socket');
//}
return $lastline;
}
-
Please enable managesieve_debug option and privide the log.
-
as the attached documents.
-
It looks that DBMail uses Cyrus' timsieved implementation. So, it can have the same bug for which there's already a workaround in Net_Sieve package. Please revert your changes and try with this patch (plugins/managesieve/lib/Net/Sieve.php):
--- Sieve.php (wersja 5478)
+++ Sieve.php (kopia robocza)
@@ -1186,7 +1186,7 @@
// 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.]+)/';
+ $regexp = '/TIMSIEVED V*([0-9.]+)/i';
if (!preg_match($regexp, $this->_capability['implementation'], $matches)
|| version_compare($matches[1], '2.3.10', '>=')
) {
-
I tried but it still fail at _recvLn() when read empty.
The sieve log shows that it is dead at the tail of sieve script reading.
It looks that DBMail uses Cyrus' timsieved implementation. So, it can have the same bug for which there's already a workaround in Net_Sieve package. Please revert your changes and try with this patch (plugins/managesieve/lib/Net/Sieve.php):
--- Sieve.php (wersja 5478)
+++ Sieve.php (kopia robocza)
@@ -1186,7 +1186,7 @@
// 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.]+)/';
+ $regexp = '/TIMSIEVED V*([0-9.]+)/i';
if (!preg_match($regexp, $this->_capability['implementation'], $matches)
|| version_compare($matches[1], '2.3.10', '>=')
) {
-
I've opened a ticket in PEAR's bugtracker. Let's continue there. Please, attach debug log when your Sieve.php file is not patched.
-
I have another problem with managesieve connecting to dbmail sieve.
Here's the protocol log I get:
S: "IMPLEMENTATION" "DBMail timsieved 3.0.0-rc3"
S: "SASL" "PLAIN"
S: "SIEVE" "regex imap4flags relational subaddress fileinto reject envelope vacation notify "
S: OK
C: CAPABILITY
S: "IMPLEMENTATION" "DBMail timsieved 3.0.0-rc3"
S: "SASL" "PLAIN"
S: "SIEVE" "regex imap4flags relational subaddress fileinto reject envelope vacation notify "
S: OK
C: AUTHENTICATE "PLAIN" "blah"
S: OK
C: LISTSCRIPTS
S: "sieve" ACTIVE
S: OK
C: GETSCRIPT "sieve"
S: {18+}
S: /* empty script */
S: OK
At this point, execution hangs and php times out after 120s. I have xdebug and here's the stactrace I get:
PHP Fatal error: Maximum execution time of 120 seconds exceeded in /var/www/roundcubemail-0.7.2/plugins/managesieve/lib/rcube_sieve_script.php on line 945
PHP Stack trace:
PHP 1. {main}() /var/www/roundcubemail-0.7.2/index.php:0
PHP 2. rcube_plugin_api->exec_action() /var/www/roundcubemail-0.7.2/index.php:248
PHP 3. call_user_func() /var/www/roundcubemail-0.7.2/program/include/rcube_plugin_api.php:296
PHP 4. managesieve->managesieve_actions() /var/www/roundcubemail-0.7.2/program/include/rcube_plugin_api.php:296
PHP 5. managesieve->managesieve_start() /var/www/roundcubemail-0.7.2/plugins/managesieve/managesieve.php:309
PHP 6. rcube_sieve->load() /var/www/roundcubemail-0.7.2/plugins/managesieve/managesieve.php:269
PHP 7. rcube_sieve->_parse() /var/www/roundcubemail-0.7.2/plugins/managesieve/lib/rcube_sieve.php:288
PHP 8. rcube_sieve_script->__construct() /var/www/roundcubemail-0.7.2/plugins/managesieve/lib/rcube_sieve.php:313
PHP 9. rcube_sieve_script->_parse_text() /var/www/roundcubemail-0.7.2/plugins/managesieve/lib/rcube_sieve_script.php:70
PHP 10. rcube_sieve_script->_parse_actions() /var/www/roundcubemail-0.7.2/plugins/managesieve/lib/rcube_sieve_script.php:527
PHP 11. rcube_sieve_script::tokenize() /var/www/roundcubemail-0.7.2/plugins/managesieve/lib/rcube_sieve_script.php:736
To me looks like tokenize gets stuck parsing the "/* empty script */" that gets inserted by default by managesieve if no script exists. This seems so silly that I hope I don't understand this stack trace properly.
Can you help me with this?
PHP is 5.3.10.
-
C: GETSCRIPT "sieve"
S: {18+}
S: /* empty script */
S: OK
"/* empty script */" works for me. What I see here wrong is "{18+}" in server response. It should be "{18}", but this might be not the issue.
-
After some tests I can confirm this is related to "{18+}". You should request a bug to DBMail developers. I'll try to find a workaround tomorrow.
-
DBMail bug: 0000963: Wrong string literal usage in server responses - DBMail Bug Tracker (http://www.dbmail.org/mantis/view.php?id=963)
Managesieve plugin fix: Changeset 6014 (http://trac.roundcube.net/changeset/6014)
-
Confirmed, working. Thanks.