Subject: | Use of uninitialized value in pattern match (m//) at /usr/local/share/perl/5.8.8/Net/Server.pm line 600. |
When reverse_lookups is OFF, there is still a check of the peerhost
in:
return 0 if $prop->{'peerhost'} =~ /^$_$/ && defined
$prop->{'reverse_lookups'};
Because $prop->{'peerhost'} =~ /^$_$/ preceeds
$prop->{'reverse_lookups'}.
In my case, $prop->{'peerhost'} is undef anyway, so the match will
trigger the warning regardless of reverse_lookups currently. I suggest
to change the line into:
return 0
if defined($prop->{'reverse_lookups'})
&& defined($prop->{peerhost})
&& $prop->{'peerhost'} =~ /^$_$/;
Attached patch changes both deny and allow.
Subject: | Net-Server-2.006_peerhost_undef_value.diff |
diff -r d0f109fd4dd8 Net/Server.pm
--- a/Net/Server.pm Tue Aug 07 10:38:50 2012 +0200
+++ b/Net/Server.pm Tue Aug 07 10:44:26 2012 +0200
@@ -587,7 +587,10 @@
# if the addr or host matches a deny, reject it immediately
foreach (@{ $prop->{'deny'} }) {
- return 0 if $prop->{'peerhost'} =~ /^$_$/ && defined $prop->{'reverse_lookups'};
+ return 0
+ if defined($prop->{'reverse_lookups'})
+ && defined($prop->{peerhost})
+ && $prop->{'peerhost'} =~ /^$_$/;
return 0 if $peeraddr =~ /^$_$/;
}
if (@{ $prop->{'cidr_deny'} }) {
@@ -597,7 +600,10 @@
# if the addr or host isn't blocked yet, allow it if it is allowed
foreach (@{ $prop->{'allow'} }) {
- return 1 if $prop->{'peerhost'} =~ /^$_$/ && defined $prop->{'reverse_lookups'};
+ return 1
+ if defined($prop->{'reverse_lookups'})
+ && defined($prop->{peerhost})
+ && $prop->{'peerhost'} =~ /^$_$/;
return 1 if $peeraddr =~ /^$_$/;
}
if (@{ $prop->{'cidr_allow'} }) {