summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/doc-txt/ChangeLog14
-rw-r--r--doc/doc-txt/README.SIEVE34
-rw-r--r--src/src/sieve.c50
3 files changed, 93 insertions, 5 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 8dce076fa..f9acb7dd3 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.264 2005/11/15 11:23:43 ph10 Exp $
+$Cambridge: 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
-------------------------------------------
@@ -136,6 +136,18 @@ PH/15 If the first argument of "${if match_address" was not empty, but did not
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
-----------------
diff --git a/doc/doc-txt/README.SIEVE b/doc/doc-txt/README.SIEVE
index 72f91da9c..9209dac88 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.8 2005/11/14 11:41:23 ph10 Exp $
+$Cambridge: 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 @@ implicit keep flag; there is no command to set it once it has
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 @@ that aspect using the appendfile transport options "create_directory",
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
diff --git a/src/src/sieve.c b/src/src/sieve.c
index f92ac0369..3fcb6413c 100644
--- a/src/src/sieve.c
+++ b/src/src/sieve.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/sieve.c,v 1.15 2005/11/15 10:08:25 ph10 Exp $ */
+/* $Cambridge: 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 @@ struct Sieve
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 uschar str_cc_c[]="Cc";
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 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 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 @@ else if (parse_identifier(filter,CUS "envelope"))
<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 @@ else if (parse_identifier(filter,CUS "envelope"))
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 @@ while (*filter->pc)
{
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 @@ while (*filter->pc)
{
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->line=1;
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 @@ 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 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