[Avcheck] Patch: Preventing use of emtpy from

Thomas Weiss avcheck@unbunt.org
Tue, 24 Sep 2002 22:23:52 +0200


* On Tue, Sep 24 you wrote:
> Two questions.
> 
> First, out of curiosity, what exim does with empty from address
> (i.e. -f "") ?

# exim -f "" root
exim:  - bad address: empty address

> And, why this strange method of determining if from address is
> empty:
> 
> 
> >+      p = from;
> >+      while (*p != 0) {
> >+	   if (!isspace(*p)) {
> >+	     from_empty = 0;
> >+	     break;
> >+	   }
> >+	   p++;
> >+      }
> 
> That is, why test for spaces (tabs, newlines), instead
> of just using (*from != '\0') ?  Bare spaces are illegal
> in email address, a space should be either quoted (") or
> escaped (\) or else it's an illegal character.  Where such
> addresses with spaces comes from at your site (I assume
> such situation happens there as you wrote this).

This is because for exim the value given with the -f switch on the
command line is _exactly_ the same value as the value given via smtp
with the "mail from:" command (that is, everything after the colon).
This value goes into the address parser and that one croaks if it's
emtpy (i.e. contains not a single non-space character) - the same with
-f and "mail from:". sendmail and postfix seem to handle this another
way.

> (BTW, this all just can't happen with postfix _at all_ if
> it is configured properly, with flags=q in pipe(8) mailer.
> Moreover, postfix never exports empty address as well, it
> always changes it to be MAILER-DAEMON@$myorigin (with more
> troubles like determining if it was bounce or not)).

Yes. It seems exim just applies this change (MAILER-DAEMON) very late
in the delivery.

> BTW, do you use avcheck with exim?

Yes. That is why I ran into this problem. Generally, of course, it is
a really good and stable solution. Only the installation was a bit hard,
since when I first installed the exim+avcheck combination (not very long
ago) I was new to exim (I had mostly used postfix before). And with the
documentation in README.Exim I had a real hard time getting it to work.
I finally had to use a totally different solution as described there.
But at least it was a good introduction to exim.

Thomas