[Avcheck] Patch: Preventing use of emtpy from

Michael Tokarev mjt@tls.msk.ru
Tue, 24 Sep 2002 22:10:14 +0400


Thomas Weiss wrote:
> Hi all,
> 
> here is a trivial patch against avcheck-0.9 that prevents avcheck from
> using an empty from address when sending mail via pipe. Using an empty
> from (as with bounce messages) causes problems with exim, while using
> <> as from address (indicating a bounce message) does work with exim
> 3.35, postfix 1.11 and sendmail 8.11.3. Also the example shell scripts
> should be modified to use <> instead of an empty argument to sendmail,
> but I've not yet come around to do this.

Two questions.

First, out of curiosity, what exim does with empty from address
(i.e. -f "") ?

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).

(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)).

BTW, do you use avcheck with exim?

/mjt