ph10 2005/11/21 10:09:13 GMT
Modified files:
exim-doc/doc-txt ChangeLog README.SIEVE
exim-src/src sieve.c
Log:
Further Sieve patches (tidies and documentation).
Revision Changes Path
1.265 +12 -0 exim/exim-doc/doc-txt/ChangeLog
1.9 +30 -2 exim/exim-doc/doc-txt/README.SIEVE
1.16 +48 -0 exim/exim-src/src/sieve.c
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.264
retrieving revision 1.265
diff -u -r1.264 -r1.265
--- ChangeLog 15 Nov 2005 11:23:43 -0000 1.264
+++ ChangeLog 21 Nov 2005 10:09:12 -0000 1.265
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.264 2005/11/15 11:23:43 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.265 2005/11/21 10:09:12 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -135,6 +135,18 @@
and treats the condition as false.
PH/16 In autoreply, treat an empty string for "once" the same as unset.
+
+PH/17 A further patch from the Sieve maintainer: "Introduce the new Sieve
+ extension "envelope-auth". The code is finished and in agreement with
+ other implementations, but there is no documentation so far and in fact,
+ nobody wrote the draft yet. This extension is currently #undef'ed, thus
+ not changing the active code.
+
+ Print executed "if" and "elsif" statements when debugging is used. This
+ helps a great deal to understand what a filter does.
+
+ Document more things not specified clearly in RFC3028. I had all this
+ sorted out, when out of a sudden new issues came to my mind. Oops."
Exim version 4.54
Index: README.SIEVE
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/README.SIEVE,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- README.SIEVE 14 Nov 2005 11:41:23 -0000 1.8
+++ README.SIEVE 21 Nov 2005 10:09:13 -0000 1.9
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/README.SIEVE,v 1.8 2005/11/14 11:41:23 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/README.SIEVE,v 1.9 2005/11/21 10:09:13 ph10 Exp $
Notes on the Sieve implementation for Exim
@@ -132,7 +132,7 @@
been reset.
-Semantics of Fileinto
+Semantics Of Fileinto
RFC 3028 does not specify if "fileinto" tries to create a mail folder,
in case it does not exist. This implementation allows to configure
@@ -141,7 +141,35 @@
the Exim specification for details.
-Sieve Syntax and Semantics
+Allof And Anyof Test
+
+RFC 3028 does not specify if these tests use shortcut/lazy evaluation.
+Exim uses shortcut evaluation.
+
+
+Action Reordering
+
+RFC 3028 does not specify if actions may be executed out of order.
+Exim may execute them out of order, e.g. messages may be filed to
+folders or forwarded in a different order than specified, because
+those actions only setup delivery, but do not execute it themselves.
+
+
+Wildcard Matching
+
+RFC 3028 is not exactly clear if comparators act on unicode characters
+or on octets containing their UTF-8 representation. As it turns out,
+many implementations go the second way. This does not make a difference
+but for wildcard matching and octet-wise comparison. Working on unicode
+means a dot matches a character. Working on UTF-8 means the dot matches
+a single octet of a multi-octet sequence. For octet-wise comparisons,
+working on UTF-8 means arbitrary byte sequences in headers can not be
+matches, as they are rarely correct UTF-8 sequences and can thus not be
+expressed as string literal. This implementation works on unicode, but
+this may be changed in case RFC3028bis specifies this issue safe and sound.
+
+
+Sieve Syntax And Semantics
RFC 3028 confuses syntax and semantics sometimes. It uses a generic
grammar as syntax for commands and tests and performs many checks during
Index: sieve.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/sieve.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- sieve.c 15 Nov 2005 10:08:25 -0000 1.15
+++ sieve.c 21 Nov 2005 10:09:13 -0000 1.16
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/sieve.c,v 1.15 2005/11/15 10:08:25 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/sieve.c,v 1.16 2005/11/21 10:09:13 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -28,6 +28,9 @@
/* Undefine it for UNIX-style \n end-of-line terminators (default). */
#undef RFC_EOL
+/* Define this for development of the Sieve extension "envelope-auth". */
+#undef ENVELOPE_AUTH
+
/* Define this for development of the Sieve extension "notify". */
#undef NOTIFY
@@ -55,6 +58,9 @@
int keep;
int require_envelope;
int require_fileinto;
+#ifdef ENVELOPE_AUTH
+ int require_envelope_auth;
+#endif
#ifdef NOTIFY
int require_notify;
#endif
@@ -98,6 +104,8 @@
static const struct String str_cc={ str_cc_c, 2 };
static uschar str_bcc_c[]="Bcc";
static const struct String str_bcc={ str_bcc_c, 3 };
+static uschar str_auth_c[]="auth";
+static const struct String str_auth={ str_auth_c, 4 };
static uschar str_sender_c[]="Sender";
static const struct String str_sender={ str_sender_c, 6 };
static uschar str_resent_from_c[]="Resent-From";
@@ -108,6 +116,10 @@
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 ENVELOPE_AUTH
+static uschar str_envelope_auth_c[]="envelope-auth";
+static const struct String str_envelope_auth={ str_envelope_auth_c, 13 };
+#endif
#ifdef NOTIFY
static uschar str_notify_c[]="notify";
static const struct String str_notify={ str_notify_c, 6 };
@@ -1834,6 +1846,9 @@
<envelope-part: string-list> <key-list: string-list>
envelope-part is case insensitive "from" or "to"
+#ifdef ENVELOPE_AUTH
+ envelope-part =/ "auth"
+#endif
*/
enum Comparator comparator=COMP_EN_ASCII_CASEMAP;
@@ -1929,6 +1944,23 @@
case ADDRPART_DOMAIN: envelopeExpr=CUS "$domain"; break;
}
}
+#ifdef ENVELOPE_AUTH
+ else if (eq_asciicase(e,&str_auth,0))
+ {
+ switch (addressPart)
+ {
+ case ADDRPART_ALL: envelopeExpr=CUS "$authenticated_sender"; break;
+#ifdef SUBADDRESS
+ case ADDRPART_USER:
+#endif
+ case ADDRPART_LOCALPART: envelopeExpr=CUS "${local_part:$authenticated_sender}"; break;
+ case ADDRPART_DOMAIN: envelopeExpr=CUS "${domain:$authenticated_sender}"; break;
+#ifdef SUBADDRESS
+ case ADDRPART_DETAIL: envelopeExpr=CUS 0; break;
+#endif
+ }
+ }
+#endif
else
{
filter->errmsg=CUS "invalid envelope string";
@@ -2069,6 +2101,11 @@
{
if (exec) debug_printf("if %s\n",cond?"true":"false");
}
+ 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)
@@ -2095,6 +2132,11 @@
{
if (exec) debug_printf("elsif %s\n",cond?"true":"false");
}
+ 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)
@@ -2616,6 +2658,9 @@
filter->keep=1;
filter->require_envelope=0;
filter->require_fileinto=0;
+#ifdef ENVELOPE_AUTH
+filter->require_envelope_auth=0;
+#endif
#ifdef NOTIFY
filter->require_notify=0;
#endif
@@ -2684,6 +2729,9 @@
{
if (eq_octet(check,&str_envelope,0)) filter->require_envelope=1;
else if (eq_octet(check,&str_fileinto,0)) filter->require_fileinto=1;
+#ifdef ENVELOPE_AUTH
+ else if (eq_octet(check,&str_envelope_auth,0)) filter->require_envelope_auth=1;
+#endif
#ifdef NOTIFY
else if (eq_octet(check,&str_notify,0)) filter->require_notify=1;
#endif