Files
perl-Apache-AuthNetLDAP/Apache-AuthNetLDAP-0.29-apache2.diff

109 lines
4.0 KiB
Diff

--- Apache-AuthNetLDAP-0.29/AuthNetLDAP.pm
+++ Apache-AuthNetLDAP-0.29/AuthNetLDAP.pm
@@ -4,7 +4,7 @@
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
use Net::LDAP;
-use mod_perl;
+use mod_perl2;
require Exporter;
@@ -19,18 +19,18 @@
# setting the constants to help identify which version of mod_perl
# is installed
-use constant MP2 => ($mod_perl::VERSION >= 1.99);
+use constant MP2 => 1;
# test for the version of mod_perl, and use the appropriate libraries
BEGIN {
if (MP2) {
- require Apache::Const;
- require Apache::Access;
- require Apache::Connection;
- require Apache::Log;
- require Apache::RequestRec;
- require Apache::RequestUtil;
- Apache::Const->import(-compile => 'HTTP_UNAUTHORIZED','OK','DECLINED');
+ require Apache2::Const;
+ require Apache2::Access;
+ require Apache2::Connection;
+ require Apache2::Log;
+ require Apache2::RequestRec;
+ require Apache2::RequestUtil;
+ Apache2::Const->import(-compile => 'HTTP_UNAUTHORIZED','OK','DECLINED');
} else {
require Apache::Constants;
Apache::Constants->import('HTTP_UNAUTHORIZED','OK','DECLINED');
@@ -72,7 +72,7 @@
if ($password eq "") {
$r->note_basic_auth_failure;
MP2 ? $r->log_error("user $user: no password supplied",$r->uri) : $r->log_reason("user $user: no password supplied",$r->uri);
- return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
+ return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
}
@@ -128,7 +128,7 @@
{
$r->note_basic_auth_failure;
MP2 ? $r->log_error("user $user: LDAP Connection Failed: $error",$r->uri) : $r->log_reason("user $user: LDAP Connection Failed: $error",$r->uri);
- return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
+ return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
}
unless ($mesg->count())
@@ -138,11 +138,11 @@
# If user is not found in ldap database, check for the next auth handler before failing
if (lc($allowaltauth) eq "yes")
{
- return MP2 ? Apache::DECLINED : Apache::Constants::DECLINED;
+ return MP2 ? Apache2::Const::DECLINED : Apache::Constants::DECLINED;
}
else
{
- return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
+ return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
}
}
@@ -156,18 +156,18 @@
$altfieldvalue =~ s/\s+$//;
if ($altfieldvalue eq $password)
{
- return MP2 ? Apache::OK : Apache::Constants::OK;
+ return MP2 ? Apache2::Const::OK : Apache::Constants::OK;
}
else
{
# If user is not found in ldap database, check for the next auth handler before failing
if (lc($allowaltauth) eq "yes")
{
- return MP2 ? Apache::DECLINED : Apache::Constants::DECLINED;
+ return MP2 ? Apache2::Const::DECLINED : Apache::Constants::DECLINED;
}
else
{
- return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
+ return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
}
}
}
@@ -180,13 +180,13 @@
{
$r->note_basic_auth_failure;
MP2 ? $r->log_error("user $user: failed bind: $error",$r->uri) : $r->log_reason("user $user: failed bind: $error",$r->uri);
- return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
+ return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
}
my $error = $mesg->code();
my $dn = $entry->dn();
# MP2 ? $r->log_error("AUTHDEBUG user $dn:$password bind: $error",$r->uri) : $r->log_reason("AUTHDEBUG user $dn:$password bind: $error",$r->uri);
- return MP2 ? Apache::OK : Apache::Constants::OK;
+ return MP2 ? Apache2::Const::OK : Apache::Constants::OK;
}
# Autoload methods go after =cut, and are processed by the autosplit program.