Add a relaying() method to the transaction
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@247 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
5d40964053
commit
8d07a36fcc
@ -31,6 +31,12 @@ sub recipients {
|
||||
($self->{_recipients} ? @{$self->{_recipients}} : ());
|
||||
}
|
||||
|
||||
sub relaying {
|
||||
my $self = shift;
|
||||
@_ and $self->{_relaying} = shift;
|
||||
$self->{_relaying};
|
||||
}
|
||||
|
||||
sub sender {
|
||||
my $self = shift;
|
||||
@_ and $self->{_sender} = shift;
|
||||
@ -112,7 +118,6 @@ sub body_getline {
|
||||
$self->{_body_file_writing} = 0;
|
||||
my $line = $self->{_body_file}->getline;
|
||||
return $line;
|
||||
|
||||
}
|
||||
|
||||
sub DESTROY {
|
||||
@ -164,6 +169,11 @@ This returns a list of the current recipients in the envelope.
|
||||
|
||||
Each recipient returned is a C<Mail::Address> object.
|
||||
|
||||
=head2 relaying( )
|
||||
|
||||
Returns true if this mail transaction is relaying. This value is set
|
||||
by the C<check_relay> plugin.
|
||||
|
||||
=head2 sender( [ ADDRESS ] )
|
||||
|
||||
Get or set the sender (MAIL FROM) address in the envelope.
|
||||
|
@ -23,14 +23,18 @@ sub check_relay {
|
||||
if ($host eq "" && (lc $user eq "postmaster" || lc $user eq "abuse"));
|
||||
|
||||
# Check if this IP is allowed to relay
|
||||
return (OK) if exists $ENV{RELAYCLIENT};
|
||||
my @relay_clients = $self->qp->config("relayclients");
|
||||
my $more_relay_clients = $self->qp->config("morerelayclients", "map");
|
||||
my %relay_clients = map { $_ => 1 } @relay_clients;
|
||||
my $client_ip = $self->qp->connection->remote_ip;
|
||||
while ($client_ip) {
|
||||
return (OK) if exists $relay_clients{$client_ip};
|
||||
return (OK) if exists $more_relay_clients->{$client_ip};
|
||||
if (exists($ENV{RELAYCLIENT}) or
|
||||
exists($relay_clients{$client_ip}) or
|
||||
exists($more_relay_clients->{$client_ip}))
|
||||
{
|
||||
$transaction->relaying(1);
|
||||
return (OK);
|
||||
}
|
||||
$client_ip =~ s/\d+\.?$//; # strip off another 8 bits
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user