From 35b9b32895584410ff1b24e37ad2bf3039bdafd2 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Fri, 22 Jun 2012 23:54:54 -0400 Subject: [PATCH] relay: logging tweak --- plugins/relay | 7 +++++-- t/plugin_tests/relay | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/relay b/plugins/relay index c7890bc..e8b0743 100644 --- a/plugins/relay +++ b/plugins/relay @@ -105,7 +105,7 @@ use Qpsmtpd::Constants; use Net::IP qw(:PROC); sub register { - my ($self, $qp) = shift, shift; + my ($self, $qp) = ( shift, shift ); $self->log(LOGERROR, "Bad arguments") if @_ % 2; $self->{_args} = { @_ }; @@ -123,7 +123,7 @@ sub is_in_norelayclients { while ( $ip ) { if ( exists $no_relay_clients{$ip} ) { - $self->log(LOGNOTICE, "$ip in norelayclients"); + $self->log(LOGINFO, "$ip in norelayclients"); return 1; } $ip =~ s/(\d|\w)+(:|\.)?$// or last; # strip off another octet @@ -207,6 +207,7 @@ sub hook_connect { if ( $self->is_in_norelayclients() ) { $self->qp->connection->relay_client(0); delete $ENV{RELAYCLIENT}; + $self->log(LOGINFO, "fail, disabled by norelayclients"); return (DECLINED); } @@ -218,6 +219,8 @@ sub hook_connect { $self->populate_relayclients(); +# 95586 (connect) relay: pass, octet match in relayclients (127.0.0.) + if ( $self->is_in_cidr_block() || $self->is_octet_match() ) { $self->qp->connection->relay_client(1); return (DECLINED); diff --git a/t/plugin_tests/relay b/t/plugin_tests/relay index 988c184..cf14985 100644 --- a/t/plugin_tests/relay +++ b/t/plugin_tests/relay @@ -75,7 +75,7 @@ sub test_is_in_norelayclients { foreach ( @false ) { $self->qp->connection->remote_ip($_); - ok( ! $self->is_in_norelayclients(), "match, + ($_)"); + ok( ! $self->is_in_norelayclients(), "match, - ($_)"); }; };