Subject: Is envelope missing :comparator arguement?

From: Gregory Sereda <[email-masked]>
Date: Mon, 22 Feb 1999 14:29:55 -0500

Filter list memebers,

I was reviewing the "address" and "envelope" tests in the latest sieve
draft, I found that "envelope" seems to be missing a comparator argument.
Both "address" and "envelope" tests deal with internet e-mail addresses.
The "address" test spec points out...

   Internet email-addresses have the somewhat awkward characteristic
   that the mailbox-part [IMAIL] to the left of the at-sign is
   considered case sensitive, and the domain-part to the right of the
   at-sign is case insensitive.  The "address" command does not deal
   with this itself, but provides the ADDRESS-PART argument for allowing
   users to deal with it.

It appears to me that the ADDRESS-PART arugment, in conjunction with
the COMPARATOR argument, allows a script to do the "right thing".
If so, the "envelope" should include the COMPARATOR arugment.

As an aside, a sieve that wants to do the "right thing" when checking
for an e-mail address would look like the following....

 # localpart of address is case-sensitive, domain is not.
 if allof ( address :is :localpart :comparator "i;octet" "from" "tim",
    address :is :domain "from" "example.com" ) {
    discard;
 }

Hmm, looks like ADDRESS-PART and COMPARATOR can't really do what is
intended.  Maybe its OK for a single "From" line, but checking the
address in the multiple "To" lines is broken.  The following message
header will give a false positive:

	To: [email-masked]
	To: [email-masked]

Neither one of these user's address match "[email-masked]", but the
script thinks so.  The problem is the that the ADDRESS-PART cannot be
related to another "address" test so both the :localpart and :domain
parts are operating on the same address.

It seems to me that this can be fixed by having the "envelope" and
"address" tests deal (correctly) with the case of the localpart and
domain part.  The COMPARATOR argument could be dropped from both of
these commands.

Greg Sereda

---

From: Tim Showalter <[email-masked]>
Date: 22 Feb 1999 15:57:10 -0500

> Date: Mon, 22 Feb 1999 14:29:55 -0500
> From: Gregory Sereda <[email-masked]>

> If so, the "envelope" should include the COMPARATOR arugment.

I think this is what was intended.  I have added a COMPARATOR argument
to the envelope test.

Given your argument, which I'm going to attempt to discuss below, there
are three things that we can do:

	(1) nothing
	(2) add COMPARATOR to envelope
	(3) make envelope and address responsible for more address
	    parsing

(1) is dumb.  (2) is easy, so I've done (2).  We can revise the draft to
(3) later if we want.  I'm going to put out a draft real soon now and
(2) is an improvement, if nothing else.

> script thinks so.

That script, in particular, is easily fixed:

 if allof ( address :matches :all :comparator "i;octet" "from" "tim@*",
    address :matches :all "from" "[email-masked]" ) {
    discard;

I am not sure if this solution generalizes, but I think "match" lets it
do so rather reasonably.

> The problem is the that the ADDRESS-PART cannot be
> domain part.

That is very difficult to nail down.  Consider this test:

if address :contains "from" "andrew" { ...

Does "andrew" refer to the local-part or the domain-part?

What about the large number of MTAs where local-parts are
case-insensitive? On rare occasions, I get mail to [email-masked],
and filtering on that is a reasonable thing to do.

What about UTF-8 in mail addresses, which is going to happen?

If we're going to go this route, we should just require that the domain-part
be canonicalized to lower (or upper) case, then STILL allow COMPARATOR
to cover case-insensitive local-parts.

-- 
Tim Showalter <[email-masked]>