qpsmtpd/plugins/check_badrcptto_patterns
Ask Bjørn Hansen 48059c122c r4215@g5: ask | 2006-01-24 23:11:01 -0800
From:   gordonr@gormand.com.au
 Subject: Re: Submitting plugins (was Re: New plugin: denybounce)
 Date: January 24, 2006 9:02:35 PM PST
 To:   ask@develooper.com
 Cc:   gavin@openfusion.com.au, qpsmtpd@perl.org
 Message-Id: <43D7066B.3050106@gormand.com.au>
 
 Ask Bjørn Hansen wrote:
 On Jan 24, 2006, at 1:08 PM, Gordon Rowell wrote:
 - License statement - either as per qpsmtpd or as per Perl or  similar open license
 No, it really should be MIT licensed ("as per qpsmtpd") to go in the  distribution.
 There are a few exceptions (only your plugins at a cursory glance),  but those are mistakes.  :-)
 
 I don't have an issue with my qpsmtpd plugins being changed to state:
 
 
 =head1 AUTHOR
 
 Copyright 2005 Gordon Rowell <gordonr@gormand.com.au>
 
 This software is free software and may be distributed under the same
 terms as qpsmtpd itself.
 
 
 Though as a distro maintainer, we do have a sizeable issue with license proliferation. It really is a bit of a nightmare when two licenses are almost, but not completely, the same.
 
 Thanks,
 
 Gordon
 
 r4216@g5:  ask | 2006-01-24 23:12:21 -0800
 merge license fix from trunk


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@603 958fd67b-6ff1-0310-b445-bb7760255be9
2006-01-25 07:12:34 +00:00

48 lines
1.1 KiB
Plaintext

=pod
=head1 SYNOPSIS
This plugin checks the badrcptto_patterns config. This allows
special patterns to be denied (e.g. percent hack, bangs,
double ats).
=head1 CONFIG
config/badrcptto_patterns
Patterns are stored in the format pattern\sresponse, where pattern
is a Perl pattern expression. Don't forget to anchor the pattern if
you want to restrict it from matching anywhere in the string.
qpsmtpd already ensures that the address contains an @, with something
to the left and right of the @.
=head1 AUTHOR
Copyright 2005 Gordon Rowell <gordonr@gormand.com.au>
This software is free software and may be distributed under the same
terms as qpsmtpd itself.
=cut
sub hook_rcpt
{
my ($self, $transaction, $recipient) = @_;
return (DECLINED) if $self->qp->connection->relay_client();
my @badrcptto = $self->qp->config("badrcptto_patterns") or return (DECLINED);
my $host = lc $recipient->host;
my $to = lc($recipient->user) . '@' . $host;
for (@badrcptto)
{
my ($pattern, $response) = split /\s+/, $_, 2;
return (DENY, $response) if ($to =~ /$pattern/);
}
return (DECLINED);
}