relay: logging tweak

This commit is contained in:
Matt Simerson 2012-06-22 23:54:54 -04:00
parent c150f5a8cc
commit 6020949551
2 changed files with 6 additions and 3 deletions

View File

@ -105,7 +105,7 @@ use Qpsmtpd::Constants;
use Net::IP qw(:PROC); use Net::IP qw(:PROC);
sub register { sub register {
my ($self, $qp) = shift, shift; my ($self, $qp) = ( shift, shift );
$self->log(LOGERROR, "Bad arguments") if @_ % 2; $self->log(LOGERROR, "Bad arguments") if @_ % 2;
$self->{_args} = { @_ }; $self->{_args} = { @_ };
@ -123,7 +123,7 @@ sub is_in_norelayclients {
while ( $ip ) { while ( $ip ) {
if ( exists $no_relay_clients{$ip} ) { if ( exists $no_relay_clients{$ip} ) {
$self->log(LOGNOTICE, "$ip in norelayclients"); $self->log(LOGINFO, "$ip in norelayclients");
return 1; return 1;
} }
$ip =~ s/(\d|\w)+(:|\.)?$// or last; # strip off another octet $ip =~ s/(\d|\w)+(:|\.)?$// or last; # strip off another octet
@ -207,6 +207,7 @@ sub hook_connect {
if ( $self->is_in_norelayclients() ) { if ( $self->is_in_norelayclients() ) {
$self->qp->connection->relay_client(0); $self->qp->connection->relay_client(0);
delete $ENV{RELAYCLIENT}; delete $ENV{RELAYCLIENT};
$self->log(LOGINFO, "fail, disabled by norelayclients");
return (DECLINED); return (DECLINED);
} }
@ -218,6 +219,8 @@ sub hook_connect {
$self->populate_relayclients(); $self->populate_relayclients();
# 95586 (connect) relay: pass, octet match in relayclients (127.0.0.)
if ( $self->is_in_cidr_block() || $self->is_octet_match() ) { if ( $self->is_in_cidr_block() || $self->is_octet_match() ) {
$self->qp->connection->relay_client(1); $self->qp->connection->relay_client(1);
return (DECLINED); return (DECLINED);

View File

@ -75,7 +75,7 @@ sub test_is_in_norelayclients {
foreach ( @false ) { foreach ( @false ) {
$self->qp->connection->remote_ip($_); $self->qp->connection->remote_ip($_);
ok( ! $self->is_in_norelayclients(), "match, + ($_)"); ok( ! $self->is_in_norelayclients(), "match, - ($_)");
}; };
}; };