sieveshell aborts with "expected RPAREN"

John Wade jwade at oakton.edu
Mon Mar 10 12:05:57 EDT 2014


OK, hearing no response to my query on the bug status of:

"Error in Cyrus::SIEVE::managesieve package in the cyrus 2.4.11 and 
later code.   The "better response codes for timsieved" lead to
problems in the perl package if you try to "get" an nonexistent 
script.    managesieve and perl exits with the error: "Bad protocol from 
MANAGESIEVE server: expected RPARAN"

I wrote a fix for the managesieve parser.   Diff included below.   I can 
regenerate this with better relative directories if you prefer.      Can 
someone review and include in the next version of Cyrus?     Do you need 
me to send this through a different channel?

Note that my fix (and managesieve)  is not really RFC compliant, since 
RFC 5804 states "Client implementations MUST tolerate (ignore) response 
codes that they do not recognize." and managesieve is designed to die 
when it receives a response code it does not understand.   My fix will 
work with the current version of timsieved, since I grabbed all of the 
relevant response codes for the "NO" response from the source, but it 
should really be rewritten to be more compliant.    Given that 
managesieve does nothing with the response code anyway except validate 
that it is know, I wonder if a better approach might be to just ignore 
the response code, but I was afraid to do this without a full understanding.

Also, in keeping with the cyrus source, I included no comments :-)  All 
this fix does is add the known timsieved response codes for the "NO" 
response to the token_lookup function in lex.c  (and the enumerated list 
in lex.h)

Thoughts anyone?

Enjoy,
John Wade
Oakton Community College


=======================================================================
diff -Naur orig/cyrus-imapd-2.4.17/perl/sieve/lib/lex.c 
fixed/cyrus-imapd-2.4.17/perl/sieve/lib/lex.c
--- orig/cyrus-imapd-2.4.17/perl/sieve/lib/lex.c        2012-12-01 
13:57:54.000000000 -0600
+++ fixed/cyrus-imapd-2.4.17/perl/sieve/lib/lex.c       2014-03-10 
10:17:41.000000000 -0500
@@ -82,6 +82,9 @@
    if (strcmp(str,"active")==0) return TOKEN_ACTIVE;
    if (strcmp(str,"referral")==0) return TOKEN_REFERRAL;
    if (strcmp(str,"sasl")==0) return TOKEN_SASL;
+  if (strcmp(str,"nonexistent")==0) return TOKEN_NONEXISTENT;
+  if (strcmp(str,"quota/maxsize")==0) return TOKEN_QUOTAMAXSIZE;
+  if (strcmp(str,"quota/maxscripts")==0) return TOKEN_QUOTAMAXSCRIPTS;

    return -1;
  }
diff -Naur orig/cyrus-imapd-2.4.17/perl/sieve/lib/lex.h 
fixed/cyrus-imapd-2.4.17/perl/sieve/lib/lex.h
--- orig/cyrus-imapd-2.4.17/perl/sieve/lib/lex.h        2012-12-01 
13:57:54.000000000 -0600
+++ fixed/cyrus-imapd-2.4.17/perl/sieve/lib/lex.h       2014-03-10 
10:17:34.000000000 -0500
@@ -69,6 +69,9 @@
      TOKEN_BYE = 282,

      TOKEN_ACTIVE = 291,
+    TOKEN_NONEXISTENT = 292,
+    TOKEN_QUOTAMAXSIZE = 293,
+    TOKEN_QUOTAMAXSCRIPTS = 294,

      TOKEN_REFERRAL = 301,
      TOKEN_SASL = 302



More information about the Info-cyrus mailing list