2002-09-10 13:00:31 +02:00
|
|
|
# this plugin checks the badrcptto config (like badmailfrom for rcpt address)
|
2006-01-25 03:59:31 +01:00
|
|
|
use Qpsmtpd::DSN;
|
2002-09-10 13:00:31 +02:00
|
|
|
|
2005-07-07 06:17:39 +02:00
|
|
|
sub hook_rcpt {
|
2006-04-07 20:58:02 +02:00
|
|
|
my ($self, $transaction, $recipient, %param) = @_;
|
2002-09-10 19:17:15 +02:00
|
|
|
my @badrcptto = $self->qp->config("badrcptto") or return (DECLINED);
|
2002-09-10 13:00:31 +02:00
|
|
|
return (DECLINED) unless $recipient->host && $recipient->user;
|
|
|
|
my $host = lc $recipient->host;
|
2004-06-18 07:47:45 +02:00
|
|
|
my $from = lc($recipient->user) . '@' . $host;
|
2002-09-10 13:00:31 +02:00
|
|
|
for my $bad (@badrcptto) {
|
2004-06-18 07:47:45 +02:00
|
|
|
$bad = lc $bad;
|
2002-09-10 13:00:31 +02:00
|
|
|
$bad =~ s/^\s*(\S+)/$1/;
|
2006-01-25 03:59:31 +01:00
|
|
|
return Qpsmtpd::DSN->no_such_user("mail to $bad not accepted here")
|
2002-09-10 13:00:31 +02:00
|
|
|
if $bad eq $from;
|
2006-01-25 03:59:31 +01:00
|
|
|
return Qpsmtpd::DSN->no_such_user("mail to $bad not accepted here")
|
2004-04-21 14:42:45 +02:00
|
|
|
if substr($bad,0,1) eq '@' && $bad eq "\@$host";
|
2002-09-10 13:00:31 +02:00
|
|
|
}
|
|
|
|
return (DECLINED);
|
|
|
|
}
|