Re: ezmlm-get: fatal: I do not reply to bounce messages

Bruce Guenter <[email protected]> Thu, 7 Feb 2008 07:41:32 -0600
Newsgroups gmane.mail.ezmlm
Message-ID <[email protected]>
On Thu, Feb 07, 2008 at 08:57:37AM +0100, Tobias Carlsson wrote:
> mx1
> ----
> @4000000047aab14f0ac2c4b4 new msg 539491
> @4000000047aab14f0ac2dc24 info msg 539491: bytes 1927 from <[email protected]> qp 28699 uid 1006
>
> mx2
> ----
> @4000000047aaae2c06c7fc1c new msg 2459523
> @4000000047aaae2c06c803ec info msg 2459523: bytes 2099 from <> qp 6385 uid 1002

Here is the obvious problem.  When the mail is forwarded, the sender
address is truncated, which is why ezmlm thinks that it is trying to
respond to a bounce.

Looking at your posted script, I see some issues:

> #!/usr/bin/perl
>
> $argslen = scalar @ARGV;
>
> if ($argslen != 3){
>       print "qmail-remote-invoke.pl must be called as: 
> qmail-remote-invoke.pl host sender recip";
>       exit 111;
> }
>
>
> @email = <STDIN>;
> $file = "/tmp/".generate_random_string(11);
>
> open(tmpfile, ">>$file");
>
> foreach $line (@email){
>       print tmpfile $line;
> }
>
> close(tmpfile);

Copying the original message to a file appears to be completely
unnecessary.  You're not adding anything to the message, and programs
invoked in .qmail files already have a file as standard input, not a
pipe.  Besides, by reading in the whole file into memory, the first
person to send you an email larger than available memory will reliably
blow up your system.

> $sender =~ s/["]//g;

Here's the real problem.  $sender is never set anywhere.  You need:

	$sender = $ARGV[1];

or

	$sender = $ENV['SENDER'];

somewhere.

> $status = `/var/qmail/bin/qmail-remote $ARGV[0] "$sender" "$ARGV[2]" < $file`;

Safer would be:

	open(PIPE, '-|', '/var/qmail/bin/qmail-remote', $ARGV[0], $sender, $ARGV[2]);
	$status = <PIPE>;
	close(PIPE);

-- 
Bruce Guenter <[email protected]>                http://untroubled.org/
	I do custom software development.  Email me for details.
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFHqwqL6W+y3GmZgOgRArWLAJ4nB13Hf4TnhPq9ul68VzJXCiSDsACgi/Uh
DLLONChXiucycWOQkqp8Z88=
=SzBT
-----END PGP SIGNATURE-----