You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Philippe M. Chiasson" <go...@cpan.org> on 2004/02/09 23:35:02 UTC

[Patch mp2] Was : mp2 acl support?

On Sun, 2004-02-08 at 04:03 -0500, Andres Salomon wrote:
> Hi Stas,
> 
> I was wondering about the status of ACL support for modperl2.  The
> following two urls contain info and patches:
> 
> http://www.gossamer-threads.com/archive/mod_perl_C1/modperl_F7/%5BPATCH%5D_acl_support_P58252/
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=230439
> 
> However, I haven't seen any patches that have been verified to work w/ ACL
> setups, and don't break w/ non-ACL setups.  Have you gotten any success
> reports on your patch?
> 

Could someone running the ModPerl-Registry tests on Win32 or something
similarly non-POSIX with this ACL patch ?

Index: ModPerl-Registry/lib/ModPerl/RegistryCooker.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v
retrieving revision 1.41
diff -u -I$Id -r1.41 RegistryCooker.pm
--- ModPerl-Registry/lib/ModPerl/RegistryCooker.pm	25 Jan 2004 01:04:16 -0000	1.41
+++ ModPerl-Registry/lib/ModPerl/RegistryCooker.pm	9 Feb 2004 22:32:11 -0000
@@ -232,11 +232,16 @@
     return Apache::DECLINED if -d _;
 
     $self->{MTIME} = -M _;
-
-    unless (-x _ or IS_WIN32) {
-        $r->log_error("file permissions deny server execution",
-                       $self->{FILENAME});
-        return Apache::FORBIDDEN;
+    
+    {
+        #Allow correct detection even under ACLs
+        use filetest qw(access);
+    
+        unless (-x _ or IS_WIN32) {
+            $r->log_error("file permissions deny server execution",
+                           $self->{FILENAME});
+            return Apache::FORBIDDEN;
+        }
     }
 
     if (!($r->allow_options & Apache::OPT_EXECCGI)) {


> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
> For additional commands, e-mail: dev-help@perl.apache.org
-- 
--------------------------------------------------------------------------------
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B)
http://gozer.ectoplasm.org/    F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so ingenious.
perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'

Re: [Patch mp2] Was : mp2 acl support?

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> On Wed, 2004-02-11 at 15:15 -0500, Andres Salomon wrote:
> 
>>-----BEGIN PGP SIGNED MESSAGE-----
>>Hash: SHA1
>>
>>Philippe M. Chiasson wrote:
>>[...]
>>|
>>| Can you try this and confirm that it works the way it should for your
>>| setup ?
>>|
>>
>>It looks like there's still an issue with the way filetest is being
>>used.  As Damon Buckwalters pointed out to me, filetest::access requires
>>the filename; a filehandle won't work.  I've attached his patch, which
>>looks correct.
>>
> 
> 
> Problem with that approach is that it will add the cost of 2 stat calls
> for each and every single ModPerl::Registry scripts ;-(
> 
> I think it might be worth considering a new ModPerl::RegistryCooker
> subclass just for ACL support. Since most people don't use ACLs, it
> seems unjustified to me to incur the overhead to everybody.

Seconded.

> People with need for ACL support could just be made to use ModPerl::
> RegistryACL, for example ...

I'm also thinking that all these new M-RC subclasses should probably go to 
CPAN. I don't think we should supply a bunch of subclasses in the core. Only 
if some subclasses get very popular we should consider including them in the 
core later on.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [Patch mp2] Was : mp2 acl support?

Posted by "Philippe M. Chiasson" <go...@cpan.org>.
On Wed, 2004-02-11 at 15:15 -0500, Andres Salomon wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Philippe M. Chiasson wrote:
> [...]
> |
> | Can you try this and confirm that it works the way it should for your
> | setup ?
> |
> 
> It looks like there's still an issue with the way filetest is being
> used.  As Damon Buckwalters pointed out to me, filetest::access requires
> the filename; a filehandle won't work.  I've attached his patch, which
> looks correct.
> 

Problem with that approach is that it will add the cost of 2 stat calls
for each and every single ModPerl::Registry scripts ;-(

I think it might be worth considering a new ModPerl::RegistryCooker
subclass just for ACL support. Since most people don't use ACLs, it
seems unjustified to me to incur the overhead to everybody.

People with need for ACL support could just be made to use ModPerl::
RegistryACL, for example ...

Re: [Patch mp2] Was : mp2 acl support?

Posted by "Philippe M. Chiasson" <go...@cpan.org>.
On Tue, 2004-02-10 at 03:28 -0500, Andres Salomon wrote:
> Philippe M. Chiasson wrote:
> [...]
> 
> |
> | Could someone running the ModPerl-Registry tests on Win32 or something
> | similarly non-POSIX with this ACL patch ?
> |
> [...]
> 
> Shouldn't this also touch the -r test a few lines earlier, as well?
> Even better, why not put the "use filetest" at the beginning of the
> function, as it seems that it should affect all file permission tests.

Yes, I missed that indeed. This simpler patches most likely does the
trick.

Index: ModPerl-Registry/lib/ModPerl/RegistryCooker.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v
retrieving revision 1.41
diff -u -I$Id -r1.41 RegistryCooker.pm
--- ModPerl-Registry/lib/ModPerl/RegistryCooker.pm      25 Jan 2004 01:04:16 -0000      1.41
+++ ModPerl-Registry/lib/ModPerl/RegistryCooker.pm      10 Feb 2004 21:10:49 -0000
@@ -224,6 +224,9 @@
     my $self = shift;
     my $r = $self->{REQ};

+    #Allow correct detection even under ACLs-enable filesystems (i.e. ext3)
+    use filetest qw(access);
+
     unless (-r $r->my_finfo && -s _) {
         $self->log_error("$self->{FILENAME} not found or unable to stat");
         return Apache::NOT_FOUND;


Can you try this and confirm that it works the way it should for your
setup ?

-- 
--------------------------------------------------------------------------------
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B)
http://gozer.ectoplasm.org/    F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so ingenious.
perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'