Re: Possible Sieve vacation bug (Was: [exim] Sieve vacation)

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Michael Haardt
Data:  
Para: exim-users
Asunto: Re: Possible Sieve vacation bug (Was: [exim] Sieve vacation)
On Thu, Feb 17, 2005 at 10:56:58AM +0100, Bob Johannessen wrote:
> From draft-showalter-sieve-vacation-06:
> "Vacation responses are not just per address, but are per address per
> set of arguments to the vacation command."


I just saw that 06 is finally online, because I sent my comments about
05 ages ago and 06 was announced, but I could not get afterwards.

Now that the draft specifies what it just intended to before, I
think it is clear how to write the code.

> "The 'per set of arguments' described above is intended to ensure that
> a respondee gets all of the various possible responses, not merely the
> first one. So, if the :subject or :mime parameters would result in a
> different message, a different message MUST be sent by the
> implementation."
>
> If you look at the first statement, it would seem you need to add the
> addresses from :addresses to the hash. But the second statement seems
> to indicate that this is only required if the Subject: or message
> content would be different (which is what the current code does).


The draft is the reference, not my code. :-) Indeed I MUST add the
":addresses" value to the key, as specified by the first sentence.
Patch below.

> One "problem" if you where to add :addresses to the hash would be that
> the following two scripts would (in my opinion) violate the "principal
> of least astonishment", whereas my patch would result in (again in my
> opinion) the expected (though probably not standard compliant) behavior.


If ":addresses" is part of the key, it ensures that the user gets all of
the various possible responses.

> vacation :addresses "a@b" "I'll be back for newyears";
> vacation :addresses "c@d" "I'll be back for newyears";


Again: That is not a valid Sieve script, because two vacation actions
would be executed. You must use:

> vacation :addresses ["a@b","c@d"] "I'll be back for newyears";


So no surprise here.

> Do you have any plans to
> implement some of the other Sieve extensions? If so, please feel free
> to ask for help with testing or a review...


I hope to add the subaddress extension sometimes. What's missing is
code in Exim that does not only store the local suffix to a variable,
but also the "*" part of the local suffix to another one. The subaddress
extension does not include the fixed separator, and there may be more
than one separator and separators longer than one character, so we really
need what "*" matches. Oh well, so much to hack, so little time.

Michael
----------------------------------------------------------------------
--- sieve.c.ph    2005-02-02 12:16:56.000000000 +0100
+++ sieve.c    2005-02-17 11:48:49.000000000 +0100
@@ -2423,7 +2422,7 @@


     int m;
     unsigned long days;
-    struct String *addresses=(struct String*)0;
+    struct String *addresses;
     struct String subject;
     int reason_is_mime;
     string_item *aliases;
@@ -2444,6 +2443,7 @@
       filter->vacation_ran=1;
       }
     days=VACATION_MIN_DAYS>7 ? VACATION_MIN_DAYS : 7;
+    addresses=(struct String*)0;
     subject.character=(uschar*)0;
     subject.length=-1;
     aliases=NULL;
@@ -2508,6 +2508,7 @@
       uschar *buffer;
       int buffer_capacity;
       struct String key;
+      struct String *a;
       md5 base;
       uschar digest[16];
       uschar hexdigest[33];
@@ -2529,6 +2530,11 @@
         if (subject.length!=-1) key.character=string_cat(key.character,&capacity,&key.length,subject.character,subject.length);
         key.character=string_cat(key.character,&capacity,&key.length,reason_is_mime?US"1":US"0",1);
         key.character=string_cat(key.character,&capacity,&key.length,reason.character,reason.length);
+        if (addresses!=(struct String*)0) for (a=addresses; a->length!=-1; ++a)
+          {
+          key.character=string_cat(key.character,&capacity,&key.length,":",1);
+          key.character=string_cat(key.character,&capacity,&key.length,a->character,a->length);
+          }
         md5_start(&base);
         md5_end(&base, key.character, key.length, digest);
         for (i = 0; i < 16; i++) sprintf(CS (hexdigest+2*i), "%02X", digest[i]);