Merge pull request #153 from jaredj/base
New convention for calling Qpsmtpd::Base stuff
This commit is contained in:
commit
a20ced01f6
@ -1,10 +1,8 @@
|
|||||||
package Qpsmtpd::Transaction;
|
package Qpsmtpd::Transaction;
|
||||||
use Qpsmtpd;
|
|
||||||
@ISA = qw(Qpsmtpd);
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Qpsmtpd::Base;
|
use parent 'Qpsmtpd';
|
||||||
use Qpsmtpd::Constants;
|
use Qpsmtpd::Constants;
|
||||||
|
|
||||||
use IO::File qw(O_RDWR O_CREAT);
|
use IO::File qw(O_RDWR O_CREAT);
|
||||||
|
@ -164,7 +164,7 @@ sub connect_handler {
|
|||||||
sub is_valid_localhost {
|
sub is_valid_localhost {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
if (Qpsmtpd::Base->is_localhost($self->qp->connection->remote_ip)) {
|
if ($self->is_localhost($self->qp->connection->remote_ip)) {
|
||||||
$self->adjust_karma(1);
|
$self->adjust_karma(1);
|
||||||
$self->log(LOGDEBUG, "pass, is localhost");
|
$self->log(LOGDEBUG, "pass, is localhost");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -255,7 +255,7 @@ sub exclude_host {
|
|||||||
if ( $pattern =~ /^\/(.*)\/$/ ) {
|
if ( $pattern =~ /^\/(.*)\/$/ ) {
|
||||||
push @{ $self->{_exclude_re} }, qr/$1/;
|
push @{ $self->{_exclude_re} }, qr/$1/;
|
||||||
}
|
}
|
||||||
elsif ( Qpsmtpd::Base->is_valid_ip($pattern) ) {
|
elsif ( $self->is_valid_ip($pattern) ) {
|
||||||
$self->{_exclude_ip}{$pattern} = 1;
|
$self->{_exclude_ip}{$pattern} = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -229,7 +229,6 @@ use warnings;
|
|||||||
|
|
||||||
use Net::IP;
|
use Net::IP;
|
||||||
|
|
||||||
use Qpsmtpd::Base;
|
|
||||||
use Qpsmtpd::Constants;
|
use Qpsmtpd::Constants;
|
||||||
|
|
||||||
sub register {
|
sub register {
|
||||||
@ -342,7 +341,7 @@ sub is_regex_match {
|
|||||||
|
|
||||||
sub invalid_localhost {
|
sub invalid_localhost {
|
||||||
my ($self, $host) = @_;
|
my ($self, $host) = @_;
|
||||||
if (Qpsmtpd::Base->is_localhost($self->qp->connection->remote_ip)) {
|
if ($self->is_localhost($self->qp->connection->remote_ip)) {
|
||||||
$self->log(LOGDEBUG, "pass, is localhost");
|
$self->log(LOGDEBUG, "pass, is localhost");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -357,7 +356,7 @@ sub invalid_localhost {
|
|||||||
|
|
||||||
sub is_plain_ip {
|
sub is_plain_ip {
|
||||||
my ($self, $host) = @_;
|
my ($self, $host) = @_;
|
||||||
return if !Qpsmtpd::Base->is_valid_ip($host);
|
return if ! $self->is_valid_ip($host);
|
||||||
|
|
||||||
$self->log(LOGDEBUG, "fail, plain IP");
|
$self->log(LOGDEBUG, "fail, plain IP");
|
||||||
return "Plain IP is invalid HELO hostname (RFC 2821)", "plain IP";
|
return "Plain IP is invalid HELO hostname (RFC 2821)", "plain IP";
|
||||||
@ -369,7 +368,7 @@ sub is_address_literal {
|
|||||||
my ($ip) = $host =~ /^\[(.*)\]/; # strip off any brackets
|
my ($ip) = $host =~ /^\[(.*)\]/; # strip off any brackets
|
||||||
return if !$ip; # no brackets, not a literal
|
return if !$ip; # no brackets, not a literal
|
||||||
|
|
||||||
return if !Qpsmtpd::Base->is_valid_ip($ip);
|
return if ! $self->is_valid_ip($ip);
|
||||||
|
|
||||||
$self->log(LOGDEBUG, "fail, bracketed IP");
|
$self->log(LOGDEBUG, "fail, bracketed IP");
|
||||||
return "RFC 2821 allows an address literal, but we do not","bracketed IP";
|
return "RFC 2821 allows an address literal, but we do not","bracketed IP";
|
||||||
@ -377,7 +376,7 @@ sub is_address_literal {
|
|||||||
|
|
||||||
sub is_forged_literal {
|
sub is_forged_literal {
|
||||||
my ($self, $host) = @_;
|
my ($self, $host) = @_;
|
||||||
return if !Qpsmtpd::Base->is_valid_ip($host);
|
return if ! $self->is_valid_ip($host);
|
||||||
|
|
||||||
# should we add exceptions for reserved internal IP space? (192.168,10., etc)
|
# should we add exceptions for reserved internal IP space? (192.168,10., etc)
|
||||||
$host = substr $host, 1, -1;
|
$host = substr $host, 1, -1;
|
||||||
|
@ -404,7 +404,7 @@ sub set_asn {
|
|||||||
my ($self, $ip) = @_;
|
my ($self, $ip) = @_;
|
||||||
$ip ||= $self->qp->connection->remote_ip;
|
$ip ||= $self->qp->connection->remote_ip;
|
||||||
|
|
||||||
if (Qpsmtpd::Base->is_ipv6($ip)) {
|
if ($self->is_ipv6($ip)) {
|
||||||
return $self->set_asn_ipv6($ip);
|
return $self->set_asn_ipv6($ip);
|
||||||
}
|
}
|
||||||
return if ! $self->{GeoIPASNum};
|
return if ! $self->{GeoIPASNum};
|
||||||
|
Loading…
Reference in New Issue
Block a user