Skip Menu |

This queue is for tickets about the Net-DNSBL-Monitor CPAN distribution.

Report information
The Basics
Id: 41816
Status: rejected
Worked: 5 min
Priority: 0/
Queue: Net-DNSBL-Monitor

People
Owner: michael [...] bizsystems.com
Requestors: croco [...] openwall.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Strange line within Monitor.pm, might be a bug
Date: Fri, 19 Dec 2008 01:02:57 +0300
To: "michael [...] arangen.net via RT" <bug-Net-DNSBL-Monitor [...] rt.cpan.org>
From: "Andrey V. Stolyarov" <croco [...] openwall.com>
Hi Michael, first of all, thank you for the great job you do and specially for adding the option 'acceptany' upon my request. We do use your module and the script in production, and it helps, so your job is appreciated. Now, one thing to mention. One of my coworkers noticed the following in Monitor.pm: Show quoted text
>> # if (grep($ip eq $_,keys %{$conf->{"$bl"}->{accept}})) { >> >> It did not make sense to me - >> I think it should have been using either "grep" or "eq", not both. >> Unless I am misreading it, the reason why it worked at all is that "1", >> when treated as a regexp, would happen to match strings like "127..." >> (these contain the digit "1").
I myself don't feel like an expert in Perl programming, but the line really looks strange, as far as I understand what does it mean. May be you take an additional look at it? -- With the best regards, Andrey "Croco" Stolyarov Openwall, Inc.
Show quoted text
> Hi Michael, > > > first of all, thank you for the great job you do and specially for > adding the option 'acceptany' upon my request. We do use your module > and the script in production, and it helps, so your job is > appreciated. > > Now, one thing to mention. One of my coworkers noticed the following > in Monitor.pm: >
> >> # if (grep($ip eq $_,keys %{$conf->{"$bl"}->{accept}})) > >> # { > >> > >> It did not make sense to me - > >> I think it should have been using either "grep" or "eq", not both. > >> Unless I am misreading it, the reason why it worked at all is that > >> "1", when treated as a regexp, would happen to match strings like > >> "127..." (these contain the digit "1").
> > I myself don't feel like an expert in Perl programming, but the line > really looks strange, as far as I understand what does it mean. May > be you take an additional look at it? > > > -- > With the best regards, > Andrey "Croco" Stolyarov > Openwall, Inc.
if (grep($ip eq $_,keys %{$conf->{"$bl"}->{accept}})) grep returns true if any of the conditions match. The above test compares the string in $ip to each of the keys in the hash %{$conf->{"$bl"}->{accept}} .... in english... each of the keys in the "accept" array found in the config file. It is looking for a match of the form: "127.0.0.2" eq "127.0.0.2" Take a look at the sample configuration file in the distro.. Michael