You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Garrett, Philip (MAN-Corporate)" <Ph...@manheim.com> on 2006/08/17 19:56:48 UTC

Precedence problem in Apache::AuthDBI - patch

Hi folks,

I am using Apache::AuthDBI v1.02 on Apache/1.3.29 (Linux/SUSE)
mod_perl/1.29.  Perl v5.8.3.

I received this error, and found it's due to an operator precedence
problem:
  Undefined subroutine &Apache2::Const::OK called at
  /usr/lib/perl5/site_perl/5.8.3/Apache/AuthDBI.pm line 906.

This expression:
  $user_result != MP2 ? Apache2::Const::OK() : Apache::Constants::OK()

Was being treated as:
  ($user_result != MP2) ? Apache2::Const::OK() : Apache::Constants::OK()

The patch below parenthesizes the expression to apply the intended
meaning:
  $user_result != (MP2 ? Apache2::Const::OK() : Apache::Constants::OK())

Could you please include it in the next release to CPAN?

Thanks,
Philip

--- AuthDBI.pm.orig     2006-08-02 12:38:54.000000000 +0200
+++ AuthDBI.pm  2006-08-17 19:45:22.117748000 +0200
@@ -719,8 +719,8 @@
     }
 
     # check for users
-    if (($user_result != MP2 ? Apache2::Const::OK() :
-         Apache::Constants::OK()) && $user_requirements) {
+    if (($user_result != (MP2 ? Apache2::Const::OK() :
+         Apache::Constants::OK())) && $user_requirements) {
 
         $user_result = MP2 ? Apache2::Const::AUTH_REQUIRED() :
             Apache::Constants::AUTH_REQUIRED();
@@ -905,9 +905,9 @@
     # check the results of the requirement checks
     if ($Attr->{authoritative} eq 'on' &&
         (
-         $user_result != MP2 ?
+         $user_result != (MP2 ?
          Apache2::Const::OK() :
-         Apache::Constants::OK()
+         Apache::Constants::OK())
         )
         && (
             $group_result != MP2 ? Apache2::Const::OK() :