[Mimedefang] filter_recipient questions

Jan Pieter Cornet johnpc at xs4all.nl
Fri Apr 28 09:50:15 EDT 2006


On Fri, Apr 28, 2006 at 08:41:22AM -0400, Dirk the Daring wrote:
> 	1) Is filter_recipient called for each RCPT TO: (as would
> 		appear to be the case), or at DATA?

At RCPT To:

>         2) The documentation states that if filter_recipient returns
> 		DISCARD, the message is discarded for ALL Recipients. Is
> 		this also true of REJECT (as would also appear to be
> 		the case)?

Nope, REJECT will reject that single recipient, not any other recipients.
We do that all the time, works fine. Why do you think a REJECT here
stops the entire email?

Some MUAs will abort the entire transmission, when one of the RCPT TOs
fail. That is to be construed as a feature. MTAs will do "the right
thing" and continue with the email for the other recipients (if any).

> 	3) Since it looks like filter_recipient can't be used to
> 		selectively (on a per-Recipient basis, allowing to some
> 		but not all) reject/discard a connection, can I have it
> 		alter a given Recipient envelope address so I can look
> 		for that "flag" in filter_begin and remove the
> 		Recipient there?

That's not necessary, and besides, you cannot alter a recipient within
filter_recipient. If you must pass flags to filter_begin, you have to
pass those flags via a file (for example by putting things in a hash
like %mysettings that you Storable::nstore(\%mysettings, "Settingsfile");

>    My idea is something like (where "recipient_valid" is a function
> I've written to check address validity, returning FALSE for a *valid*
> address and TRUE for an *invalid* one):
> 
> 	[....existing filter_recipient code...]
> 	if ( recipient_invalid($recipient) )
> 		{
> 		$recipient = "invalid\@domain.tld";

That won't work, just return('REJECT', "Recipient invalid");

> 		return ('CONTINUE', "OK");
> 		}
> 	[...existing filter_recipient code....]
> 
>    and then
> 
> 	[....existing filter_begin code...]
> 
> 	[start loop to step thru @Recipients; $check is index...]
> 	if ( $Recipients[$check] =~ "invalid" )

Ugh. You really do such stuff in production code? I hope nobody
has the idea to start a JoinValidation project at your site to
scrutinize SQL code, and creates an email address after the
project name.

But, anyway, this is not necessary.

> 	[...some code to check if there are any valid Recipients left...]
> 	if ( $no_valid )
> 		{
> 		return('REJECT', "Dictionary SPAM rejected");
> 		}

You don't ever get here if all recipients are REJECTed ;)

>    Feedback? Sane? Insane?

The latter :)

-- 
Jan-Pieter Cornet <johnpc at xs4all.nl>
!! Disc lamer: The addressee of this email is not the intended recipient. !!
!! This is only a test of the echelon and data retention systems. Please  !!
!! archive this message indefinately to allow verification of the logs.   !!



More information about the MIMEDefang mailing list