Subject: | mod_perl2 and build pre-requisites |
See attached diff for mod_perl2 compatibility.
Apache::Constants is now Apache::Const.
Also added module pre-requisites for Makefile.PL.
Enjoy.
Michael King/
diff -Naur Apache-MSIISProbes-1.08/MSIISProbes.pm Apache-MSIISProbes-1.09/MSIISProbes.pm
--- Apache-MSIISProbes-1.08/MSIISProbes.pm 2001-12-06 15:11:38.000000000 -0600
+++ Apache-MSIISProbes-1.09/MSIISProbes.pm 2003-08-14 21:44:34.000000000 -0500
@@ -3,14 +3,26 @@
use strict;
use vars qw($VERSION $VERSION_DATE);
-use Apache::Constants qw(OK DECLINED FORBIDDEN);
use Mail::Sendmail;
use Net::DNS;
use Cache::FileCache;
use Time::Zone;
-$VERSION = 1.08;
-$VERSION_DATE = 'December 6, 2001';
+$VERSION = 1.09;
+$VERSION_DATE = 'August 14, 2003';
+
+use mod_perl;
+use constant MP2 => $mod_perl::VERSION >= 1.99;
+BEGIN {
+ if (MP2) {
+ require Apache::Const;
+ Apache::Const->import(-compile => qw(OK DECLINED FORBIDDEN));
+ }
+ else {
+ require Apache::Constants;
+ Apache::Constants->import(qw(OK DECLINED FORBIDDEN));
+ }
+}
# ----------------------------------------------------------
# BEGIN USER-CONFIGURABLE OPTIONS
@@ -76,7 +88,7 @@
print "$ip\t$count{$ip}\n";
}
print "</PRE></HTML>";
- return OK;
+ return OK();
}
# Create a DNS resolver, which we'll need no matter what.
@@ -95,7 +107,7 @@
unless ($file_cache) {
$r->log_error("MSIISProbes: Could not instantiate FileCache. Exiting.");
- return DECLINED;
+ return DECLINED();
}
# Get the HTTP client's IP address. We'll use this to
@@ -106,7 +118,7 @@
# to the remote server, can we? Let's just stop now, while we're at it.
unless (defined $remote_ip_address) {
$r->warn("MSIISProbes: Undefined remote IP address! Exiting.");
- return DECLINED;
+ return DECLINED();
}
# If we have the remote IP address, then check to see
@@ -123,7 +135,7 @@
$DEBUG && $r->warn("MSIISProbes: Attack number [$count] with [$worm_name] from [$remote_ip_address]. Re-mailing.");
} else {
$DEBUG && $r->warn("MSIISProbes: Attack number [$count] with [$worm_name] in the current cache period from [$remote_ip_address]. Exiting.");
- return FORBIDDEN;
+ return FORBIDDEN();
}
} else {
$DEBUG && $r->warn("MSIISProbes: Attack number [$count] with [$worm_name] from [$remote_ip_address]. Mailing.");
@@ -133,7 +145,7 @@
foreach my $ignore_ip (@ignore_ip) {
if ($remote_ip_address =~ /^$ignore_ip$/) {
$DEBUG && $r->warn("MSIISProbes: Detected known IP [$remote_ip_address] (matched [$ignore_ip]). Exiting.");
- return FORBIDDEN;
+ return FORBIDDEN();
}
}
@@ -194,7 +206,7 @@
$DEBUG > 1 && $r->warn("MSIISProbes: Mail::Sendmail returned [$Mail::Sendmail::error]. Exiting.");
# We want to make sure Security Focus gets the report, so clear the cache entry for this IP
$file_cache->set($remote_ip_address, 0);
- return DECLINED;
+ return DECLINED();
} else {
$DEBUG > 2 && $r->warn("MSIISProbes: Sent mail to Security Focus for IP [$remote_ip_address]");
}
@@ -262,10 +274,10 @@
}
if (! @mx and ! $admin_address) {
- # If we still haven't found any records, then simply return FORBIDDEN, and log an error message
+ # If we still haven't found any records, then simply return FORBIDDEN(), and log an error message
my $dns_error = $res->errorstring;
$DEBUG > 1 && $r->warn("MSIISProbes: No MX records or SOA address for [$remote_hostname](error: [$dns_error]). Exiting.");
- return FORBIDDEN;
+ return FORBIDDEN();
} elsif (@mx) {
# Grab the first MX record, and assume that it'll work.
my $mx_host = $mx[0]->exchange;
@@ -318,10 +330,10 @@
if ($sendmail_success) {
$DEBUG > 2 && $r->warn("MSIISProbes: Sent mail to [$admin_address] for IP [$remote_ip_address]");
- return FORBIDDEN;
+ return FORBIDDEN();
} else {
$DEBUG > 1 && $r->warn("MSIISProbes: Mail::Sendmail returned [$Mail::Sendmail::error]. Exiting.");
- return DECLINED;
+ return DECLINED();
}
}
@@ -456,6 +468,10 @@
=head1 CHANGES
+ v1.09
+ Added module prerequisites to Makefile.PL.
+ Added mod_perl1 and mod_perl2 compatibility.
+
v1.08
Added the requested URI to the body of the e-mail message sent to
server admins, since some apparently refuse to take action without
diff -Naur Apache-MSIISProbes-1.08/Makefile.PL Apache-MSIISProbes-1.09/Makefile.PL
--- Apache-MSIISProbes-1.08/Makefile.PL 2001-12-04 16:14:09.000000000 -0600
+++ Apache-MSIISProbes-1.09/Makefile.PL 2003-08-14 21:42:54.000000000 -0500
@@ -2,6 +2,13 @@
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
- 'NAME' => 'Apache::MSIISProbes',
+ 'NAME' => 'Apache::MSIISProbes',
'VERSION_FROM' => 'MSIISProbes.pm', # finds $VERSION
+ 'PREREQ_PM' => {
+ 'mod_perl' => 0,
+ 'Mail::Sendmail' => 0,
+ 'Net::DNS' => 0,
+ 'Cache::FileCache' => 0,
+ 'Time::Zone' => 0,
+ },
);