Hello,

i had problems with the Cyrus::SIEVE::managesieve package in the new
cyrus 2.4.11 code. The "better response codes for timsieved" lead to
problems in the perl package if you try to "get" an nonexistent
script:

sieveshell ...
> get nonexistant
Bad protocol from MANAGESIEVE server: expected RPARAN

The perl package expects quoted strings inside the parantheses and
these quotes are missing.

There are two possible solutions: fix the parser or put quotes
around the strings. A possible patch for timsieved using the
second alternative is appended.


Stefan

-- 
+---------------------+------------------------------------+
| Stefan Rapp         | E-Mail: stefan.r...@tu-dortmund.de |
| TU Dortmund         | Phone:  +49 231 755 4668           |
| IT & Medien Centrum | Fax:    +49 231 755 2731           |
| D-44221 Dortmund    |                                    |
+---------------------+------------------------------------+
*** cyrus-imapd-2.4.11//timsieved/actions.c	Thu Sep  8 20:57:42 2011
--- cyrus-imapd-mx2//timsieved/actions.c	Wed Sep 21 11:49:09 2011
***************
*** 235,241 ****
  
    result = stat(path, &filestats);
    if (result != 0) {
!     prot_printf(conn,"NO (NONEXISTENT) \"Script doesn't exist\"\r\n");
      return TIMSIEVE_NOEXIST;
    }
    size = filestats.st_size;
--- 235,241 ----
  
    result = stat(path, &filestats);
    if (result != 0) {
!     prot_printf(conn,"NO (\"NONEXISTENT\") \"Script doesn't exist\"\r\n");
      return TIMSIEVE_NOEXIST;
    }
    size = filestats.st_size;
***************
*** 343,349 ****
        if (countscripts(string_DATAPTR(name))+1 > maxscripts)
        {
  	  prot_printf(conn,
! 		      "NO (QUOTA/MAXSCRIPTS) \"You are only allowed %d scripts on this server\"\r\n",
  		      maxscripts);
  	  return TIMSIEVE_FAIL;
        }
--- 343,349 ----
        if (countscripts(string_DATAPTR(name))+1 > maxscripts)
        {
  	  prot_printf(conn,
! 		      "NO (\"QUOTA/MAXSCRIPTS\") \"You are only allowed %d scripts on this server\"\r\n",
  		      maxscripts);
  	  return TIMSIEVE_FAIL;
        }
***************
*** 507,513 ****
    snprintf(path, 1023, "%s.script", string_DATAPTR(name));
  
    if (isactive(string_DATAPTR(name))) {
!     prot_printf(conn, "NO (ACTIVE) \"Active script cannot be deleted\"\r\n");
      return TIMSIEVE_FAIL;
    }
  
--- 507,513 ----
    snprintf(path, 1023, "%s.script", string_DATAPTR(name));
  
    if (isactive(string_DATAPTR(name))) {
!     prot_printf(conn, "NO (\"ACTIVE\") \"Active script cannot be deleted\"\r\n");
      return TIMSIEVE_FAIL;
    }
  
***************
*** 515,521 ****
  
    if (result != 0) {
        if (result == ENOENT)
!           prot_printf(conn, "NO (NONEXISTENT) \"Script %s does not exist.\"\r\n", string_DATAPTR(name));
        else
            prot_printf(conn,"NO \"Error deleting script\"\r\n");
        return TIMSIEVE_FAIL;
--- 515,521 ----
  
    if (result != 0) {
        if (result == ENOENT)
!           prot_printf(conn, "NO (\"NONEXISTENT\") \"Script %s does not exist.\"\r\n", string_DATAPTR(name));
        else
            prot_printf(conn,"NO \"Error deleting script\"\r\n");
        return TIMSIEVE_FAIL;
***************
*** 624,630 ****
  
      if (exists(string_DATAPTR(name))==FALSE)
      {
! 	prot_printf(conn,"NO (NONEXISTENT) \"Script does not exist\"\r\n");
  	return TIMSIEVE_NOEXIST;
      }
  
--- 624,630 ----
  
      if (exists(string_DATAPTR(name))==FALSE)
      {
! 	prot_printf(conn,"NO (\"NONEXISTENT\") \"Script does not exist\"\r\n");
  	return TIMSIEVE_NOEXIST;
      }
  
***************
*** 681,687 ****
      if (num > maxscriptsize)
      {
  	prot_printf(conn,
! 		    "NO (QUOTA/MAXSIZE) \"Script size is too large. "
  		    "Max script size is %ld bytes\"\r\n",
  		    maxscriptsize);
  	return TIMSIEVE_FAIL;
--- 681,687 ----
      if (num > maxscriptsize)
      {
  	prot_printf(conn,
! 		    "NO (\"QUOTA/MAXSIZE\") \"Script size is too large. "
  		    "Max script size is %ld bytes\"\r\n",
  		    maxscriptsize);
  	return TIMSIEVE_FAIL;
***************
*** 693,699 ****
      if (countscripts(string_DATAPTR(sieve_name))+1 > maxscripts)
      {
  	prot_printf(conn,
! 		    "NO (QUOTA/MAXSCRIPTS) \"You are only allowed %d scripts on this server\"\r\n",
  		    maxscripts);
  	return TIMSIEVE_FAIL;
      }
--- 693,699 ----
      if (countscripts(string_DATAPTR(sieve_name))+1 > maxscripts)
      {
  	prot_printf(conn,
! 		    "NO (\"QUOTA/MAXSCRIPTS\") \"You are only allowed %d scripts on this server\"\r\n",
  		    maxscripts);
  	return TIMSIEVE_FAIL;
      }

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to