[Mimedefang] Question about skipping checks on trusted hosts

David F. Skoll dfs at roaringpenguin.com
Mon Feb 16 22:18:37 EST 2004


On Mon, 16 Feb 2004, Jim Crippen wrote:

> sub filter_relay
> {
> 	my($ip,$name,$helo) = @_;
> 	if ( index($ip,"192.168.12.") >= 0 ) {

That will work, but I would write it as:

	if ($ip =~ /^192\.168\.12\./) {

> 		add_recipient("spam at localhost");

You cannot call add_recipient from filter_relay.  And Perl will choke on
a "@" inside double quotes.

There is no way to do both ACCEPT_AND_NO_MORE_FILTERING and
add_recipient; you'll have to rewrite your filter to do the add_recipient
in filter_begin or filter_end, and simply not call SpamAssassin if the
relay host is trusted.

> 		return ('ACCEPT_AND_NO_MORE_FILTERING',"$ip whitelisted");
> 	}
> 	return('ACCEPT_AND_NO_MORE_FILTERING',"$ip whitelisted");
> }

You always return ACCEPT_AND_NO_MORE_FILTERING, which will simply disable
MIMEDefang. :-)

Regards,

David.



More information about the MIMEDefang mailing list