cvs commit: qpsmtpd/plugins check_relay
[email protected] (Matt Sergeant)
| Newsgroups | perl.cvs.qpsmtpd |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 04/06/16 13:28:57
Modified: lib/Qpsmtpd Transaction.pm
plugins check_relay
Log:
Add a relaying() method to the transaction
Revision Changes Path
1.11 +11 -1 qpsmtpd/lib/Qpsmtpd/Transaction.pm
Index: Transaction.pm
===================================================================
RCS file: /cvs/public/qpsmtpd/lib/Qpsmtpd/Transaction.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -w -r1.10 -r1.11
--- Transaction.pm 7 Jun 2004 18:48:52 -0000 1.10
+++ Transaction.pm 16 Jun 2004 20:28:57 -0000 1.11
@@ -31,6 +31,12 @@
($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 @@
$self->{_body_file_writing} = 0;
my $line = $self->{_body_file}->getline;
return $line;
-
}
sub DESTROY {
@@ -164,6 +169,11 @@
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.
1.6 +7 -3 qpsmtpd/plugins/check_relay
Index: check_relay
===================================================================
RCS file: /cvs/public/qpsmtpd/plugins/check_relay,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -r1.5 -r1.6
--- check_relay 2 Nov 2003 11:14:44 -0000 1.5
+++ check_relay 16 Jun 2004 20:28:57 -0000 1.6
@@ -23,14 +23,18 @@
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
}