From 87fcc8b991cb2c6fb33e78593230685d104c6800 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Mon, 14 Nov 2005 11:41:23 +0000 Subject: [PATCH] Apply the latest Sieve patches. --- doc/doc-txt/ChangeLog | 16 +++++++- doc/doc-txt/README.SIEVE | 7 +++- src/src/sieve.c | 84 +++++++++++++++++++++++++++++++++++++--- 3 files changed, 99 insertions(+), 8 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 131c0bf3a..adf73796b 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -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 ------------------------------------------- @@ -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. +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 ----------------- diff --git a/doc/doc-txt/README.SIEVE b/doc/doc-txt/README.SIEVE index 1c8a0ebc9..72f91da9c 100644 --- a/doc/doc-txt/README.SIEVE +++ b/doc/doc-txt/README.SIEVE @@ -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 @@ -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) -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 @@ -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. +The automatic replies generated by "vacation" do not contain an updated +"references" header field. + Semantics Of Keep diff --git a/src/src/sieve.c b/src/src/sieve.c index 32170a337..b8ade713b 100644 --- a/src/src/sieve.c +++ b/src/src/sieve.c @@ -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 * @@ -28,10 +28,13 @@ /* 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 this for the vacation Sieve extension. */ +/* Define this for the Sieve extension "vacation". */ #define VACATION /* Must be >= 1 */ @@ -52,6 +55,9 @@ struct Sieve int keep; int require_envelope; int require_fileinto; +#ifdef NOTIFY + int require_notify; +#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 }; +#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 }; @@ -1886,7 +1896,7 @@ else if (parse_identifier(filter,CUS "envelope")) 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; @@ -2054,6 +2064,11 @@ while (*filter->pc) 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) @@ -2075,6 +2090,11 @@ while (*filter->pc) 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) @@ -2187,7 +2207,7 @@ while (*filter->pc) fileinto-command = "fileinto" { fileinto-options } string ";" fileinto-options = fileinto-options =) [ ":copy" ] - */ + */ struct String folder; uschar *s; @@ -2241,6 +2261,54 @@ while (*filter->pc) } 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")) { @@ -2548,6 +2616,9 @@ filter->line=1; 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 @@ -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; +#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 -- 2.30.2