new plugins from Jim Winstead
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@63 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
f2bcad4da8
commit
e9b02cb730
5
CREDITS
5
CREDITS
@ -7,3 +7,8 @@ Andrew Pam <xanni@glasswings.com.au>: fixing the maximum message size
|
|||||||
|
|
||||||
Marius Kjeldahl <marius@kjeldahl.net>, Zukka Zitting
|
Marius Kjeldahl <marius@kjeldahl.net>, Zukka Zitting
|
||||||
<jukka.zitting@iki.fi>: Patches for supporting $ENV{RELAYCLIENT}
|
<jukka.zitting@iki.fi>: Patches for supporting $ENV{RELAYCLIENT}
|
||||||
|
|
||||||
|
Jim Winstead <jimw@trainedmonkey.com>: the core "command dispatch"
|
||||||
|
system in qpsmtpd is taken from his colobus nntp server. The
|
||||||
|
check_badmailfrom and check_mailrcptto plugins.
|
||||||
|
|
||||||
|
3
Changes
3
Changes
@ -1,4 +1,7 @@
|
|||||||
2002/09/10
|
2002/09/10
|
||||||
|
check_badmailfrom and check_badrcptto plugins (Jim Winstead
|
||||||
|
<jimw@trainedmonkey.com>)
|
||||||
|
|
||||||
Better RFC conformance. (Reset transactions after the DATA command and
|
Better RFC conformance. (Reset transactions after the DATA command and
|
||||||
when the MAIL command is being done)
|
when the MAIL command is being done)
|
||||||
|
|
||||||
|
29
plugins/check_badmailfrom
Normal file
29
plugins/check_badmailfrom
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# this plugin checks the standard badmailfrom config
|
||||||
|
|
||||||
|
sub register {
|
||||||
|
my ($self, $qp) = @_;
|
||||||
|
$self->register_hook("mail", "mail_handler");
|
||||||
|
$self->register_hook("rcpt", "rcpt_handler");
|
||||||
|
}
|
||||||
|
|
||||||
|
sub mail_handler {
|
||||||
|
my ($self, $transaction, $recipient) = @_;
|
||||||
|
return (DECLINED) unless $recipient->host && $recipient->user;
|
||||||
|
my $host = lc $recipient->host;
|
||||||
|
my $from = $recipient->user . '@' . $host;
|
||||||
|
my @badmailfrom = $self->qp->config("badmailfrom");
|
||||||
|
for my $bad (@badmailfrom) {
|
||||||
|
$bad =~ s/^\s*(\S+)/$1/;
|
||||||
|
$transaction->notes('badmailfrom', "Mail from $bad not accepted here")
|
||||||
|
if ($bad eq $from)
|
||||||
|
|| (substr($bad,0,1) eq '@' && $bad eq "\@$host");
|
||||||
|
}
|
||||||
|
return (DECLINED);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub rcpt_handler {
|
||||||
|
my ($self, $transaction, $rcpt) = @_;
|
||||||
|
my $note = $transaction->notes('badmailfrom');
|
||||||
|
return (DENY, $note) if $note;
|
||||||
|
return (DECLINED);
|
||||||
|
}
|
22
plugins/check_badrcptto
Normal file
22
plugins/check_badrcptto
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# this plugin checks the badrcptto config (like badmailfrom for rcpt address)
|
||||||
|
|
||||||
|
sub register {
|
||||||
|
my ($self, $qp) = @_;
|
||||||
|
$self->register_hook("rcpt", "check_for_badrcptto");
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_for_badrcptto {
|
||||||
|
my ($self, $transaction, $recipient) = @_;
|
||||||
|
return (DECLINED) unless $recipient->host && $recipient->user;
|
||||||
|
my $host = lc $recipient->host;
|
||||||
|
my $from = $recipient->user . '@' . $host;
|
||||||
|
my @badrcptto = $self->qp->config("badrcptto");
|
||||||
|
for my $bad (@badrcptto) {
|
||||||
|
$bad =~ s/^\s*(\S+)/$1/;
|
||||||
|
return (DENY, "mail to $bad not accepted here")
|
||||||
|
if $bad eq $from;
|
||||||
|
return (DENY, "mail to $bad not accepted here")
|
||||||
|
if substr($bad,0,1) eq '@' && $bad eq "@$host";
|
||||||
|
}
|
||||||
|
return (DECLINED);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user