Files
perl-Apache-AuthNetLDAP/Apache-AuthzNetLDAP-0.07-apache2.diff

141 lines
6.3 KiB
Diff

--- Apache-AuthzNetLDAP-0.07/AuthzNetLDAP.pm
+++ Apache-AuthzNetLDAP-0.07/AuthzNetLDAP.pm
@@ -9,7 +9,7 @@
require AutoLoader;
use Net::LDAP;
-use mod_perl;
+use mod_perl2;
@ISA = qw(Exporter DynaLoader);
# Items to export into callers namespace by default. Note: do not export
@@ -23,20 +23,20 @@
# 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;
+ require Apache2::Const;
+ require Apache2::Access;
+ require Apache2::Connection;
+ require Apache2::Log;
+ require Apache2::RequestRec;
+ require Apache2::RequestUtil;
require URI;
require URI::ldap;
- Apache::Const->import(-compile => 'HTTP_UNAUTHORIZED','OK', 'DECLINED');
+ Apache2::Const->import(-compile => 'HTTP_UNAUTHORIZED','OK', 'DECLINED');
} else {
require Apache::Constants;
require URI;
@@ -63,7 +63,7 @@
my $requires = $r->requires;
- return MP2 ? Apache::DECLINED : Apache::Constants::DECLINED unless $requires;
+ return MP2 ? Apache2::Const::DECLINED : Apache::Constants::DECLINED unless $requires;
my $username = MP2 ? $r->user : $r->connection->user;
@@ -88,7 +88,7 @@
{
$r->note_basic_auth_failure;
MP2 ? $r->log_error("user $username: LDAP Connection Failed: $error",$r->uri) : $r->log_reason("user $username: 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;
}
#first let's get the user's DN
@@ -105,7 +105,7 @@
{
$r->note_basic_auth_failure;
MP2 ? $r->log_error("user $username: LDAP Connection Failed: $error",$r->uri) : $r->log_reason("user $username: 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;
}
my $entry = $mesg->shift_entry();
@@ -120,7 +120,7 @@
my ($requirement,@rest) = split(/\s+/, $req->{requirement});
if (lc $requirement eq 'user')
{
- foreach (@rest) {return MP2 ? Apache::OK : Apache::Constants::OK if $username eq $_;}
+ foreach (@rest) {return MP2 ? Apache2::Const::OK : Apache::Constants::OK if $username eq $_;}
}
elsif (lc $requirement eq 'group')
{
@@ -129,23 +129,23 @@
my ($foo,$group) = split(/"/,$req->{requirement});
my $isMember = Apache::AuthzNetLDAP::_getIsMember($ldap,$r,$group,$entry->dn());
MP2 ? $r->log_error("user $username: group($group) DEBUG - isMember: $isMember",$r->uri) : $r->log_reason("user $username: group($group) DEBUG - isMember: $isMember",$r->uri);
- return MP2 ? Apache::OK : Apache::Constants::OK if $isMember;
+ return MP2 ? Apache2::Const::OK : Apache::Constants::OK if $isMember;
}
elsif (lc $requirement eq 'ldap-url')
{
my ($foo,$url) = split (/ldap-url/,$req->{requirement});
my $isMember = Apache::AuthzNetLDAP::_checkURL($r,$ldap,$entry->dn(),$url);
MP2 ? $r->log_error("user $username: group($url) DEBUG - isMember: $isMember",$r->uri) : $r->log_reason("user $username: group($url) DEBUG - isMember: $isMember",$r->uri);
- return MP2 ? Apache::OK : Apache::Constants::OK if $isMember;
+ return MP2 ? Apache2::Const::OK : Apache::Constants::OK if $isMember;
}
elsif (lc $requirement eq 'valid-user') {
- return MP2 ? Apache::OK : Apache::Constants::OK;
+ return MP2 ? Apache2::Const::OK : Apache::Constants::OK;
}
}
$r->note_basic_auth_failure;
MP2 ? $r->log_error("user $username: group (test) LDAP membership check failed with ismember: DEBUG REMOVE COMMENT",$r->uri) : $r->log_reason("user $username: group (test) LDAP membership check failed with ismember: DEBUG REMOVE COMMENT",$r->uri);
- return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
+ return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
@@ -206,7 +206,7 @@
{
$r->note_basic_auth_failure;
MP2 ? $r->log_error("user $userDN: group ($groupDN) LDAP search Failed: $error",$r->uri) : $r->log_reason("user $userDN: group ($groupDN) LDAP search Failed: $error",$r->uri);
- return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
+ return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
}
my $entry = $mesg->pop_entry();
@@ -236,7 +236,7 @@
{
$r->note_basic_auth_failure;
MP2 ? $r->log_error("user $userDN: group ($groupDN) LDAP search Failed: $error",$r->uri) : $r->log_reason("user $userDN: group ($groupDN) LDAP search Failed: $error",$r->uri);
- return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
+ return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
}
#if we find an entry it returns true
@@ -280,7 +280,7 @@
{
$r->note_basic_auth_failure;
MP2 ? $r->log_error("user $userDN: group ($groupDN) LDAP search Failed: $error",$r->uri) : $r->log_reason("user $userDN: group ($groupDN) LDAP search Failed: $error",$r->uri);
- return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
+ return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
}
#if make it this far then you must be a member
@@ -312,7 +312,7 @@
{
$r->note_basic_auth_failure;
MP2 ? $r->log_error("user $userDN: group ($urlval) LDAP search Failed: $error",$r->uri) : $r->log_reason("user $userDN: group ($urlval) LDAP search Failed: $error",$r->uri);
- return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
+ return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
}
#if we find an entry it returns true