fcrdns: document the is_valid_localhost skip
with a logdebug line
This commit is contained in:
parent
07fad0ffd0
commit
4226dfaa3e
@ -165,13 +165,15 @@ sub is_valid_localhost {
|
|||||||
|
|
||||||
if ($self->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(LOGINFO, "pass, is localhost");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $rh = $self->qp->connection->remote_host;
|
my $rh = $self->qp->connection->remote_host;
|
||||||
return 0 if ! $rh;
|
if (! $rh || lc $self->qp->connection->remote_host ne 'localhost') {
|
||||||
return 0 if lc $self->qp->connection->remote_host ne 'localhost';
|
$self->log(LOGDEBUG, "skip, not pretending to be localhost");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
$self->adjust_karma(-1);
|
$self->adjust_karma(-1);
|
||||||
$self->log(LOGINFO, "fail, not localhost");
|
$self->log(LOGINFO, "fail, not localhost");
|
||||||
|
@ -26,20 +26,18 @@ sub _is_valid_localhost {
|
|||||||
cmp_ok( $self->is_valid_localhost(), '==', 1, "$pass, true");
|
cmp_ok( $self->is_valid_localhost(), '==', 1, "$pass, true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$self->qp->connection->remote_host('localhost');
|
||||||
foreach my $fail (@fails) {
|
foreach my $fail (@fails) {
|
||||||
$self->qp->connection->remote_ip($fail);
|
$self->qp->connection->remote_ip($fail);
|
||||||
cmp_ok( $self->is_valid_localhost(), '==', 0, "$fail, false");
|
cmp_ok( $self->is_valid_localhost(), '==', 0, "$fail, false");
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->qp->connection->remote_host('localhost');
|
|
||||||
cmp_ok( $self->is_valid_localhost(), '==', 0, "localhost, non-loopback IP, false");
|
cmp_ok( $self->is_valid_localhost(), '==', 0, "localhost, non-loopback IP, false");
|
||||||
|
|
||||||
$self->qp->connection->remote_ip('127.0.0.1');
|
$self->qp->connection->remote_ip('127.0.0.1');
|
||||||
$self->qp->connection->remote_host('localhost');
|
|
||||||
cmp_ok( $self->is_valid_localhost(), '==', 1, "localhost, loop IP, true");
|
cmp_ok( $self->is_valid_localhost(), '==', 1, "localhost, loop IP, true");
|
||||||
|
|
||||||
$self->qp->connection->remote_ip('::1');
|
$self->qp->connection->remote_ip('::1');
|
||||||
$self->qp->connection->remote_host('localhost');
|
|
||||||
cmp_ok( $self->is_valid_localhost(), '==', 1, "localhost, IPv6 loop, true");
|
cmp_ok( $self->is_valid_localhost(), '==', 1, "localhost, IPv6 loop, true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user