Apply the latest Sieve patches.
authorPhilip Hazel <ph10@hermes.cam.ac.uk>
Mon, 14 Nov 2005 11:41:23 +0000 (11:41 +0000)
committerPhilip Hazel <ph10@hermes.cam.ac.uk>
Mon, 14 Nov 2005 11:41:23 +0000 (11:41 +0000)
doc/doc-txt/ChangeLog
doc/doc-txt/README.SIEVE
src/src/sieve.c

index 131c0bf3ae49452c47d3126c6bc3c77af614390c..adf73796bda582aff22f3d83c4ab1328ff4d43a1 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.256 2005/11/14 11:32:16 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.257 2005/11/14 11:41:23 ph10 Exp $
 
 Change log file for Exim from version 4.21
 -------------------------------------------
 
 Change log file for Exim from version 4.21
 -------------------------------------------
@@ -74,6 +74,20 @@ PH/08 When the original message was included in an autoreply transport, it
       even if body_only or headers_only was set. It now gives an appropriate
       message.
 
       even if body_only or headers_only was set. It now gives an appropriate
       message.
 
+PH/09 Applied a patch from the Sieve maintainer which:
+
+      o  fixes some comments
+      o  adds the (disabled) notify extension core
+      o  adds some debug output for the result of if/elsif tests
+      o  points to the current vacation draft in the documentation
+         and documents the missing references header update
+
+      and most important:
+
+      o  fixes a bug in processing the envelope test (when testing
+         multiple envelope elements, the last element determinted the
+         result)
+
 
 Exim version 4.54
 -----------------
 
 Exim version 4.54
 -----------------
index 1c8a0ebc936559130164026a338436f89cf45c98..72f91da9c3969d8721f99cbc9c2fd94297c4889c 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/README.SIEVE,v 1.7 2005/08/30 10:55:52 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/README.SIEVE,v 1.8 2005/11/14 11:41:23 ph10 Exp $
 
               Notes on the Sieve implementation for Exim
 
 
               Notes on the Sieve implementation for Exim
 
@@ -23,7 +23,7 @@ Exim Implementation
 The Exim Sieve implementation offers the core as defined by draft
 3028bis-4 (next version of RFC 3028 that fixes specification mistakes),
 the "envelope" (3028bis), the "fileinto" (3028bis), the "copy" (RFC 3894)
 The Exim Sieve implementation offers the core as defined by draft
 3028bis-4 (next version of RFC 3028 that fixes specification mistakes),
 the "envelope" (3028bis), the "fileinto" (3028bis), the "copy" (RFC 3894)
-and the "vacation" (draft-ietf-sieve-vacation-02.txt) extension, the
+and the "vacation" (draft-ietf-sieve-vacation-04.txt) extension, the
 "i;ascii-numeric" comparator (RFC 2244).
 
 The Sieve filter is integrated in Exim and works very similar to the
 "i;ascii-numeric" comparator (RFC 2244).
 
 The Sieve filter is integrated in Exim and works very similar to the
@@ -120,6 +120,9 @@ Sieve script errors currently cause that messages are silently filed into
 This may be implemented in future by adding a header line to mails that
 are filed into "inbox" due to an error in the filter.
 
 This may be implemented in future by adding a header line to mails that
 are filed into "inbox" due to an error in the filter.
 
+The automatic replies generated by "vacation" do not contain an updated
+"references" header field.
+
 
 Semantics Of Keep
 
 
 Semantics Of Keep
 
index 32170a3378c1038347183d3a1efd5c6fb25b1ac5..b8ade713b6c004893f6435f64dea54e1fd72a6e8 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/sieve.c,v 1.13 2005/08/30 10:55:52 ph10 Exp $ */
+/* $Cambridge: exim/src/src/sieve.c,v 1.14 2005/11/14 11:41:23 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 /* Undefine it for UNIX-style \n end-of-line terminators (default). */
 #undef RFC_EOL
 
 /* Undefine it for UNIX-style \n end-of-line terminators (default). */
 #undef RFC_EOL
 
-/* Define this for development of the subaddress Sieve extension.   */
+/* Define this for development of the Sieve extension "notify".     */
+#undef NOTIFY
+
+/* Define this for the Sieve extension "subaddress".                */
 #define SUBADDRESS
 
 #define SUBADDRESS
 
-/* Define this for the vacation Sieve extension.                    */
+/* Define this for the Sieve extension "vacation".                  */
 #define VACATION
 
 /* Must be >= 1                                                     */
 #define VACATION
 
 /* Must be >= 1                                                     */
@@ -52,6 +55,9 @@ struct Sieve
   int keep;
   int require_envelope;
   int require_fileinto;
   int keep;
   int require_envelope;
   int require_fileinto;
+#ifdef NOTIFY
+  int require_notify;
+#endif
 #ifdef SUBADDRESS
   int require_subaddress;
 #endif
 #ifdef SUBADDRESS
   int require_subaddress;
 #endif
@@ -102,6 +108,10 @@ static uschar str_fileinto_c[]="fileinto";
 static const struct String str_fileinto={ str_fileinto_c, 8 };
 static uschar str_envelope_c[]="envelope";
 static const struct String str_envelope={ str_envelope_c, 8 };
 static const struct String str_fileinto={ str_fileinto_c, 8 };
 static uschar str_envelope_c[]="envelope";
 static const struct String str_envelope={ str_envelope_c, 8 };
+#ifdef NOTIFY
+static uschar str_notify_c[]="notify";
+static const struct String str_notify={ str_notify_c, 6 };
+#endif
 #ifdef SUBADDRESS
 static uschar str_subaddress_c[]="subaddress";
 static const struct String str_subaddress={ str_subaddress_c, 10 };
 #ifdef SUBADDRESS
 static uschar str_subaddress_c[]="subaddress";
 static const struct String str_subaddress={ str_subaddress_c, 10 };
@@ -1886,7 +1896,7 @@ else if (parse_identifier(filter,CUS "envelope"))
     return -1;
     }
   *cond=0;
     return -1;
     }
   *cond=0;
-  for (e=env; e->character; ++e)
+  for (e=env; e->length!=-1 && !*cond; ++e)
     {
     const uschar *envelopeExpr=CUS 0;
     uschar *envelope=US 0;
     {
     const uschar *envelopeExpr=CUS 0;
     uschar *envelope=US 0;
@@ -2054,6 +2064,11 @@ while (*filter->pc)
       filter->errmsg=CUS "missing test";
       return -1;
       }
       filter->errmsg=CUS "missing test";
       return -1;
       }
+    if ((filter_test != FTEST_NONE && debug_selector != 0) ||
+        (debug_selector & D_filter) != 0)
+      {
+      if (exec) debug_printf("if %s\n",cond?"true":"false");
+      }
     m=parse_block(filter,exec ? cond : 0, generated);
     if (m==-1 || m==2) return m;
     if (m==0)
     m=parse_block(filter,exec ? cond : 0, generated);
     if (m==-1 || m==2) return m;
     if (m==0)
@@ -2075,6 +2090,11 @@ while (*filter->pc)
           filter->errmsg=CUS "missing test";
           return -1;
           }
           filter->errmsg=CUS "missing test";
           return -1;
           }
+        if ((filter_test != FTEST_NONE && debug_selector != 0) ||
+            (debug_selector & D_filter) != 0)
+          {
+          if (exec) debug_printf("elsif %s\n",cond?"true":"false");
+          }
         m=parse_block(filter,exec && unsuccessful ? cond : 0, generated);
         if (m==-1 || m==2) return m;
         if (m==0)
         m=parse_block(filter,exec && unsuccessful ? cond : 0, generated);
         if (m==-1 || m==2) return m;
         if (m==0)
@@ -2187,7 +2207,7 @@ while (*filter->pc)
     fileinto-command =  "fileinto" { fileinto-options } string ";"
     fileinto-options =
     fileinto-options =) [ ":copy" ]
     fileinto-command =  "fileinto" { fileinto-options } string ";"
     fileinto-options =
     fileinto-options =) [ ":copy" ]
-   */
+    */
 
     struct String folder;
     uschar *s;
 
     struct String folder;
     uschar *s;
@@ -2241,6 +2261,54 @@ while (*filter->pc)
       }
     if (parse_semicolon(filter)==-1) return -1;
     }
       }
     if (parse_semicolon(filter)==-1) return -1;
     }
+#ifdef NOTIFY
+  else if (parse_identifier(filter,CUS "notify"))
+    {
+    /*
+    notify-command =  "notify" { notify-options } ";"
+    notify-options =  [":method" string]
+                      [":message" string]
+    */
+
+    int m;
+    struct String method;
+    struct String message;
+
+    if (!filter->require_notify)
+      {
+      filter->errmsg=CUS "missing previous require \"notify\";";
+      return -1;
+      }
+    method.character=(uschar*)0;
+    method.length=-1;
+    message.character=(uschar*)0;
+    message.length=-1;
+    for (;;)
+      {
+      if (parse_white(filter)==-1) return -1;
+      if (parse_identifier(filter,CUS ":method")==1)
+        {
+        if (parse_white(filter)==-1) return -1;
+        if ((m=parse_string(filter,&method))!=1)
+          {
+          if (m==0) filter->errmsg=CUS "method string expected";
+          return -1;
+          }
+        }
+      else if (parse_identifier(filter,CUS ":message")==1)
+        {
+        if (parse_white(filter)==-1) return -1;
+        if ((m=parse_string(filter,&message))!=1)
+          {
+          if (m==0) filter->errmsg=CUS "message string expected";
+          return -1;
+          }
+        }
+      else break;
+      }
+    if (parse_semicolon(filter)==-1) return -1;
+    }
+#endif
 #ifdef VACATION
   else if (parse_identifier(filter,CUS "vacation"))
     {
 #ifdef VACATION
   else if (parse_identifier(filter,CUS "vacation"))
     {
@@ -2548,6 +2616,9 @@ filter->line=1;
 filter->keep=1;
 filter->require_envelope=0;
 filter->require_fileinto=0;
 filter->keep=1;
 filter->require_envelope=0;
 filter->require_fileinto=0;
+#ifdef NOTIFY
+filter->require_notify=0;
+#endif
 #ifdef SUBADDRESS
 filter->require_subaddress=0;
 #endif
 #ifdef SUBADDRESS
 filter->require_subaddress=0;
 #endif
@@ -2613,6 +2684,9 @@ while (parse_identifier(filter,CUS "require"))
     {
     if (eq_octet(check,&str_envelope,0)) filter->require_envelope=1;
     else if (eq_octet(check,&str_fileinto,0)) filter->require_fileinto=1;
     {
     if (eq_octet(check,&str_envelope,0)) filter->require_envelope=1;
     else if (eq_octet(check,&str_fileinto,0)) filter->require_fileinto=1;
+#ifdef NOTIFY
+    else if (eq_octet(check,&str_notify,0)) filter->require_notify=1;
+#endif
 #ifdef SUBADDRESS
     else if (eq_octet(check,&str_subaddress,0)) filter->require_subaddress=1;
 #endif
 #ifdef SUBADDRESS
     else if (eq_octet(check,&str_subaddress,0)) filter->require_subaddress=1;
 #endif