Réf. : Re: mp2 Apache2.0.49 on HPUX11i : mod_perl does not load in Apache

2004-05-03 Thread olivier . blanc

Hey,

I managed to go further in the compilation and tests.
Here is the last test report :

Failed Test                          Stat Wstat Total Fail  Failed  List of Failed
--
t/api/module.t                       11    1   9.09%  6
t/apr/netlib.t                            5    1  20.00%  5
t/compat/conn_rec.t               4    1  25.00%  3
t/modperl/setupenv.t            63    6   9.52%  8 22 29 36 50 57
t/preconnection/note.t            1    1 100.00%  1
8 tests skipped.

I also attach the error_log file for this test.

 

The problem that I reported earlier is gone (I compiled the ARP::Bucket with the static mod_perl.la library).

So Could we say that this is almost good ?

Do you need me to report all the modifications that I made, and if so in what form ?

Thanks for the help you gave to me,

Olivier







Stas Bekman <[EMAIL PROTECTED]>
30/04/2004 19:03

        
        Pour :        [EMAIL PROTECTED]
        cc :        [EMAIL PROTECTED], "Philippe M. Chiasson" <[EMAIL PROTECTED]>
        Objet :        Re: mp2 Apache2.0.49 on HPUX11i : mod_perl does not load in Apache


[EMAIL PROTECTED] wrote:
> hello all,
> 
> I finally manage to recompile mod_perl in static mod and Apache to be 
> linked with mod_perl.
> It works correctly for now on.

Fantastic. You are the first user to try the static mod_perl 2!

Did the test suite pass 100%?

> I just found a problem that I have to work on :
> in Apache error_log file I found the following lines :

When did it happen? During the startup? Inside the test suite?

> /usr/lib/pa20_64/dld.sl: Unsatisfied code symbol 
> 'modperl_bucket_sv_create' in load module 
> '/opt/perl583/lib/site_perl/5.8.3/PA-RISC2.0-thread-multi-LP64/auto/APR/Bucket/Bucket.sl'.

That means that something was loading APR::Bucket w/o mod_perl environment. 
Try to set:

use Carp;
$SIG{__DIE__} = \&Carp::confess;

at the top of your startup file or  sections and it should show you 
where that code was invoked from.

__
Stas Bekman            JAm_pH --> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




error_log.2
Description: Binary data
-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Re: [MP2 CVS] make test errors under freebsd and perl5.8.4

2004-05-03 Thread Ruslan U. Zakirov
Stas Bekman wrote:
Ruslan U. Zakirov wrote:
Hello.
Failed Test Stat Wstat Total Fail  Failed  List of Failed
--- 

t/apr-ext/uuid.t   1   256 34 133.33%  2-3
t/filter/both_str_con_add.t43  75.00%  2-4
t/protocol/echo_block.t32  66.67%  2-3
t/protocol/echo_filter.t   32  66.67%  2-3

There are known errors, Ruslan. Thanks for the report.
The first one is irrelevant to modperl itself, the last 3 are due to a 
what seems to be a bug in Apache 2.0.49 pn bsd, solaris and a few other 
platforms. (you won't have this error with 2.0.48).
Ok, I'll test my apps with it and may be revert apache to 2.0.48 
state(now I use latest cvs).
If you don't use protocol handlers reading/writing directly to/from the 
socket
you can ignore them all.
I don't use them.
Thanks for info. Best regards. Ruslan.
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


[mp2] CONTENT_LENGTH & input filter

2004-05-03 Thread Micah Johnson
Hi,

I'm trying to use a pre-existing CGI script without
modification.  I'd like to use an input filter to tack
on something to the POST string.  My filter adds the
string, but the CGI sees a CONTENT_LENGTH
environmental variable that corresponds to its
original length.  How do I update the CONTENT_LENGTH?

Here's the filter code:

  package MyApache::AddConstraint;

  use strict;
  use warnings;

  use base qw(Apache::Filter);

  use Apache::Const -compile => 'OK';

  use constant BUFF_LEN => 1024;

  sub handler : FilterRequestHandler {
  my $f = shift;
 
  while ($f->read(my $buffer, BUFF_LEN)) {
  $f->print($buffer);
  }
  my $bparam = "&special=1";
  $f->print($bparam);
 
  Apache::OK;
  }
  1;

The relevant conf is:


  SetHandler perl-script
  PerlHandler ModPerl::PerlRun
  Options ExecCGI
  PerlSendHeader On


PerlModule MyApache::AddConstraint

 PerlInputFilterHandler MyApache::AddConstraint


I've tried setting %ENV in my filter, setting
CONTENT_LENGTH with $f->r->subprocess_env, and using
headers_out->set('Content-Length').  In the first two
cases, I see no effect, while the last applies to the
length of the entire request, not just the POST
string.
Any help is appreciated.

Thanks,
Micah







__
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: mp2 Apache2.0.49 on HPUX11i : mod_perl does not load in Apache

2004-05-03 Thread olivier . blanc

Hi all,

Sorry, I had a miss reading of the result. I was too excited when all compilation pass thru and when I saw that apache server started sucessfully...
All tests failure reported below are due to this  Bucket.sl problem.

How can I figure out what is going on, and How can I try to fix the problem ?

BTW, I had to modify a bit the "config_vars.mk" file from Apache. 
Also, during the Makefile.PL step, I had to modify the ldflags variable to remove the "+DD64" flag that the linker doesn't like at all.

I'll post all that when erverytings will work properly.


Thanks for help,

Olivier

Olivier Blanc
Bureau SI6 / DFPRO / ET
Ministère des Finances
Tel.: +33(0)240 128 909
mailto:[EMAIL PROTECTED]






Stas Bekman <[EMAIL PROTECTED]>
30/04/2004 19:29

        
        Pour :        
        cc :        [EMAIL PROTECTED], [EMAIL PROTECTED], "Philippe M. Chiasson" <[EMAIL PROTECTED]>
        Objet :        Re: mp2 Apache2.0.49 on HPUX11i : mod_perl does not load in Apache


[Olivier, please remember to keep the messages on the list. Thanks]

So your error log shows that there are quite a few problem. How is it possible 
that you did get 'make test' to pass. Or did it?

===
# Failed test 6 in /var/tmp/apache_perl/modperl-2.0/t/response/TestAPI/module.pm
  at line 87
/usr/lib/pa20_64/dld.sl: Unsatisfied code symbol 'modperl_bucket_sv_create' in 
load module '/var/tmp/apache_perl/modperl-2.0/blib/arch/auto/APR/Bucket/Bucket.sl
'.
[Fri Apr 30 17:51:06 2004] [notice] child pid 5003 exit signal Illegal 
instruction (4)
# Failed test 5 in /var/tmp/apache_perl/modperl-2.0/t/response/TestAPR/netlib.pm
  at line 46

[Fri Apr 30 17:53:38 2004] [error] [client 0.0.0.0] Can't dup STDIN: Bad file 
number at /var/tmp/apache_perl/modperl-2.0/t/response/TestModperl/io_with_closed_s
tds.pm line 24.\n

# Failed test 8 in 
/var/tmp/apache_perl/modperl-2.0/t/response/TestModperl/setupenv.pm at line 35
# Failed test 22 in 
/var/tmp/apache_perl/modperl-2.0/t/response/TestModperl/setupenv.pm at line 115
# Failed test 29 in 
/var/tmp/apache_perl/modperl-2.0/t/response/TestModperl/setupenv.pm at line 35 
fail #2
# Failed test 36 in 
/var/tmp/apache_perl/modperl-2.0/t/response/TestModperl/setupenv.pm at line 35 
fail #3
# Failed test 50 in 
/var/tmp/apache_perl/modperl-2.0/t/response/TestModperl/setupenv.pm at line 35 
fail #4
# Failed test 57 in 
/var/tmp/apache_perl/modperl-2.0/t/response/TestModperl/setupenv.pm at line 
115 fail #2
=

So you have a bunch of these errors:

/usr/lib/pa20_64/dld.sl: Unsatisfied code symbol 'modperl_bucket_sv_create' in

Is nm(1) working on your platform? If so, please try:

nm /path/to/your/httpd | grep modperl_bucket_sv_create


__
Stas Bekman            JAm_pH --> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html





Re: mod_perl File Extension Configuration instead of a Path Configuration

2004-05-03 Thread JupiterHost.Net
Sorry to top post...
So is it (the subject/original email below) impossible then?
Or is it possible just not advisable?
TIA
JupiterHost.Net wrote:
Hello group!
Super mod_perl newbie here :)
I was wondering if its possible to setup mod_perl in httpd.conf with a
File Extension Configuration instead of a Path Configuration.
IE - everything with the .mpl extension is run under mod_perl instead of 
everything in /perl/ being run under mod_perl...
Something like:
AddHandler mod_perl-script .mpl

If it is possible what benefits/problems/issues would there be to think 
about vs a Path configuration?

Where might I find good documentation about how to do this and what 
issues you'd encounter/have to consider (I didn't see anything at 
perl.apache.org... which I'm sure is my fault ;p )?

TIA
Lee.M - JupiterHost.Net

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: mod_perl File Extension Configuration instead of a Path Configuration

2004-05-03 Thread petersm
If you want to do something like this ... every file ending in .pl is run as
an Apache::Registry (mod_perl 1) script you could do something like this in
your httpd.conf

[snip]

PerlModule Apache::Registry
AddHandler perl-script .mpl
PerlHandler Apache::Registry

[/snip]

This kind of setup is dangerous if you have users who can put .mpl scripts
anywhere inside of the document tree 'cause those scripts will run with the
same permissions that your own scripts run with. If you can control the whole
document tree it's not that bad. 

Michael Peters
Venzia

-- Original Message ---
From: "JupiterHost.Net" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Mon, 03 May 2004 10:31:56 -0500
Subject: Re: mod_perl File Extension Configuration instead of a Path Configuration

> Sorry to top post...
> 
> So is it (the subject/original email below) impossible then?
> 
> Or is it possible just not advisable?
> 
> TIA
> 
> JupiterHost.Net wrote:
> > Hello group!
> > 
> > Super mod_perl newbie here :)
> > 
> > I was wondering if its possible to setup mod_perl in httpd.conf with a
> > File Extension Configuration instead of a Path Configuration.
> > 
> > IE - everything with the .mpl extension is run under mod_perl instead of 
> > everything in /perl/ being run under mod_perl...
> > Something like:
> > AddHandler mod_perl-script .mpl
> > 
> > If it is possible what benefits/problems/issues would there be to think 
> > about vs a Path configuration?
> > 
> > Where might I find good documentation about how to do this and what 
> > issues you'd encounter/have to consider (I didn't see anything at 
> > perl.apache.org... which I'm sure is my fault ;p )?
> > 
> > TIA
> > 
> > Lee.M - JupiterHost.Net
> > 
> > 
> 
> -- 
> Report problems: http://perl.apache.org/bugs/
> Mail list info: http://perl.apache.org/maillist/modperl.html
> List etiquette: http://perl.apache.org/maillist/email-etiquette.html
--- End of Original Message ---


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: mod_perl File Extension Configuration instead of a Path Configuration

2004-05-03 Thread JupiterHost.Net

petersm wrote:
If you want to do something like this ... every file ending in .pl is run as
an Apache::Registry (mod_perl 1) script you could do something like this in
your httpd.conf
[snip]
PerlModule Apache::Registry
AddHandler perl-script .mpl
PerlHandler Apache::Registry
[/snip]
Excellent thanks!
This kind of setup is dangerous if you have users who can put .mpl scripts
anywhere inside of the document tree 'cause those scripts will run with the
If they only have access to /home/user it would be cool right?
IE: it would be just as dangerouse as running a regular perl or shell or 
OTHER_LANGUAGE_HERE script in their home dir, correct?

same permissions that your own scripts run with. If you can control the whole
document tree it's not that bad. 
mod_perl scripts are run with the permissions of the user correct?
IE if Apache its 'nobody' or otherwsie (getpwuid($>))[0]
Michael Peters
Venzia
-- Original Message ---
From: "JupiterHost.Net" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Mon, 03 May 2004 10:31:56 -0500
Subject: Re: mod_perl File Extension Configuration instead of a Path Configuration

Sorry to top post...
So is it (the subject/original email below) impossible then?
Or is it possible just not advisable?
TIA
JupiterHost.Net wrote:
Hello group!
Super mod_perl newbie here :)
I was wondering if its possible to setup mod_perl in httpd.conf with a
File Extension Configuration instead of a Path Configuration.
IE - everything with the .mpl extension is run under mod_perl instead of 
everything in /perl/ being run under mod_perl...
Something like:
   AddHandler mod_perl-script .mpl

If it is possible what benefits/problems/issues would there be to think 
about vs a Path configuration?

Where might I find good documentation about how to do this and what 
issues you'd encounter/have to consider (I didn't see anything at 
perl.apache.org... which I'm sure is my fault ;p )?

TIA
Lee.M - JupiterHost.Net

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
--- End of Original Message ---


--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: mod_perl File Extension Configuration instead of a Path Configuration

2004-05-03 Thread Perrin Harkins
On Mon, 2004-05-03 at 12:39, JupiterHost.Net wrote:
> IE: it would be just as dangerouse as running a regular perl or shell or 
> OTHER_LANGUAGE_HERE script in their home dir, correct?
[...]
> mod_perl scripts are run with the permissions of the user correct?
> IE if Apache its 'nobody' or otherwsie (getpwuid($>))[0]

No, when you run things with mod_perl, they run in the apache server
process.  They will always have the same permissions as the apache
server.  It is not safe to run untrusted scripts under mod_perl.  (There
is all kinds of hand-waving about using Safe or something, but the only
thing I would trust is an entirely separate server running as an
unprivileged user.)

More info on configuration options is available here:
http://perl.apache.org/docs/1.0/guide/config.html

If you want to just run .pl scripts under specific directories through
mod_perl, the docs there will tell you how (using a 
directive).

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: mp2 Apache2.0.49 on HPUX11i : mod_perl does not load in Apache

2004-05-03 Thread Stas Bekman
[EMAIL PROTECTED] wrote:
Hi all,
Sorry, I had a miss reading of the result. I was too excited when all 
compilation pass thru and when I saw that apache server started 
sucessfully...
All tests failure reported below are due to this  Bucket.sl problem.

How can I figure out what is going on, and How can I try to fix the 
problem ?
Please re-read my reply to you, it includes:
---
So you have a bunch of these errors:
/usr/lib/pa20_64/dld.sl: Unsatisfied code symbol 'modperl_bucket_sv_create' in
Is nm(1) working on your platform? If so, please try:
nm /path/to/your/httpd | grep modperl_bucket_sv_create
---
BTW, I had to modify a bit the "config_vars.mk" file from Apache. 
Also, during the Makefile.PL step, I had to modify the ldflags variable to 
remove the "+DD64" flag that the linker doesn't like at all.
That doesn't sounds right. You need to build perl and apache/modperl with the 
same compiler. Your perl was compiled with "+DD64", so your compiler must like 
it. If it doesn't rebuild perl with the compiler you use to compile 
apache/modperl.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Réf. : Re: mp2 Apache2.0.49 on HPUX11i : mod_perl does not load in Apache

2004-05-03 Thread Stas Bekman
[EMAIL PROTECTED] wrote:
Hey,
I managed to go further in the compilation and tests.
Here is the last test report :
Failed Test  Stat Wstat Total Fail  Failed  List 
of Failed
--
t/api/module.t   111   9.09%  6
t/apr/netlib.t51  20.00%  5
t/compat/conn_rec.t   41  25.00%  3
t/modperl/setupenv.t636   9.52%  8 22 29 36 50 57
t/preconnection/note.t11 100.00%  1
8 tests skipped.

I also attach the error_log file for this test.
Please run these in the verbose mode and only then please post here the output 
of the run and error_log, inlined (not attached, so we can comment on it).

t/TEST -clean
t/TEST -v t/api/module.t t/apr/netlib.t t/compat/conn_rec.t 
t/modperl/setupenv.t  t/preconnection/note.t

The problem that I reported earlier is gone (I compiled the ARP::Bucket 
with the static mod_perl.la library).
That shouldn't be like that, see my other reply to you.
So Could we say that this is almost good ?
Sure, it's better than before :)
Do you need me to report all the modifications that I made, and if so in 
what form ?
Absolutely. Checkout the cvs version (if you didn't already), apply your 
changes, run:

cvs -u diff > patch
and post the patch here
Thanks for the help you gave to me,
;)
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [mp2] CONTENT_LENGTH & input filter

2004-05-03 Thread Stas Bekman
Micah Johnson wrote:
Hi,
I'm trying to use a pre-existing CGI script without
modification.  I'd like to use an input filter to tack
on something to the POST string.  My filter adds the
string, but the CGI sees a CONTENT_LENGTH
environmental variable that corresponds to its
original length.  How do I update the CONTENT_LENGTH?
You can do that only in the Connection level filter, Request level filter is 
too late.

I've tried setting %ENV in my filter, setting
CONTENT_LENGTH with $f->r->subprocess_env, and using
headers_out->set('Content-Length').  In the first two
 
That's headers *out* (==response), you want headers_in. I haven't tried that, 
but it may work in any phase before the response handler (instead of 
connection filter).

--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [MP2] eval and exit(0) : problem

2004-05-03 Thread Arnaud Blancher
Stas Bekman a écrit :
Arnaud Blancher wrote:
Stas Bekman a écrit :
ydnar wrote:
The eval() is unecessary. The named sub can be used:
&$func(); 


yes but not with
 use strict
...

try:
  {
no strict 'refs';
&$func();
  }

yes, it's work.
i'don't realy like this solution, just because i always  try to use 'use 
strict'
to avoid problem with mod_perl 

so, could you tell me if the final mp2, will have a solution for exit in 
eval function ?
in this case i'll wait and keep my complete 'use strict'
in the other case .. may be i will change all my script, and lost a part 
of 'strict'.

Thanks
Arnaud.

FWIW, I find $func->() to be a more readable syntax.

You don't need to load anything. Indeed under mp2:
  *CORE::GLOBAL::exit = \&ModPerl::Util::exit;
And you don't need to load anything for this to work.
in mp2 exit is implemented via a special die() call, therefore if 
you call it inside eval { } block (and eval "STRING" behaves 
identically) an exception is being thrown, but caught by eval.


for me, both solution don't work :-((
maybe me installation is wrong ...
the output is always the sum of &first &second

You mean one solution. Indeed, I tried it and it doesn't, since $@ is 
set to '', which is the same as if eval {} didn't die.

You didn't try the second solution: CORE::exit(0), but you probably 
don't want to use it as it's not efficient. But it'll work exactly as 
mod_cgi does.

I consider the inability to exit when called from eval as a problem, 
so we need to think of finding a better way to emulate 
exit-but-don't-exit functionality.


--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


OT[maybe] IPC or broke:)

2004-05-03 Thread [EMAIL PROTECTED]
Hi,
  I have a handler that currently simply authenticates 
a user. Then once they are authenticated they are able to 
run a specific program with diff args living on the server. 

The thing is the program can take from 10 to like 60 seconds
to complete results. 
This means that:
page never really loads since it is waiting for 
results that take far too long to get. Just looking for 
other opinions on handling this cleanly. 

TIA,
[EMAIL PROTECTED]

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: [MP2] eval and exit(0) : problem

2004-05-03 Thread Stas Bekman
Arnaud Blancher wrote:
[...]
try:
  {
no strict 'refs';
&$func();
  }
yes, it's work.
i'don't realy like this solution, just because i always  try to use 'use 
strict'
to avoid problem with mod_perl 
But in this case, it disables strict refs only for a very small scope! It 
doesn't affect anything else, so you perfectly fine.

so, could you tell me if the final mp2, will have a solution for exit in 
eval function ?
in this case i'll wait and keep my complete 'use strict'
in the other case .. may be i will change all my script, and lost a part 
of 'strict'.
I have a working solution (haven't committed yet), but I'm not 100% sure yet 
that it's going to stay, I have received no feedback so far on this proposal [1].

At the moment looks like:
use ModPerl::Const -compile => 'EXIT';
eval {
 my $whatever = 1;
 exit();
};
exit if $@ && ref $@ && $@ == ModPerl::EXIT;
The same will work for eval $string.
What happens here is that exit calls die with an exception object, which you 
can observe outside the eval block (the numerical context of $@ will return 
ModPerl::EXIT value) and rethrow exit (or do return or else) to cleanly quit 
the handler w/o killing the process.

If you wish, you can get the current cvs, apply my patch [1] and try the 
thing. You can see t/response/TestModperl/exit.pm which exercises this 
functionality.

[1] http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=108354831109582&w=2
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: OT[maybe] IPC or broke:)

2004-05-03 Thread Perrin Harkins
On Mon, 2004-05-03 at 13:23, [EMAIL PROTECTED] wrote:
> The thing is the program can take from 10 to like 60 seconds
> to complete results. 
> This means that:
> page never really loads since it is waiting for 
> results that take far too long to get. Just looking for 
> other opinions on handling this cleanly. 

This is a solved problem.  Either fork or use a queue.  Randal has a
column that shows the forking technique well:

http://www.stonehenge.com/merlyn/WebTechniques/col20.html

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: some children not returning newly-inserted data

2004-05-03 Thread Perrin Harkins
On Mon, 2004-05-03 at 13:15, Dave Boodman wrote:
> OK, here's some code:

This is a little too much code to look at without any direction.  The
best thing to do would be to remove as much code as possible to get
things down to the smallest example that demonstrates the problem.  You
should also tell us which variables seem to be having the updating
problem.

I don't see any obvious scoping problems (closures) here, and you do
seem to be updating your Class::DBI objects.  I did notice that you are
creating a new Template Toolkit object on every request, which is a bad
idea because it breaks the built-in template cache and slows things down
a lot, but that's not related to the problem you're having.

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: some children not returning newly-inserted data

2004-05-03 Thread Dave Boodman
OK, here's some code:
# systems
my @statuses;
my (@systems) = Lib::Systems->search( cid => $cid );
unless (@systems) { $self->model->log('debug', "systems for '$cid' not 
found"); $self->context->throw( 'systems.not_found', 'Systems not found' ); };
my $systems_profile = Lib::Profiles->system;
foreach my $sys (@systems) {
# reassign params from form names
my %tmp = map { $_ => $params{$_.'_'.$sys->sysid} } 
Lib::Systems->columns;
my ($data, $errors) = $self->model->validate($systems_profile, \%tmp);
if (@$errors) {
$self->context->throw( 'required', { fields => [EMAIL PROTECTED] } );
} else {
my (@relen_ips, @add_ips);
# establish status
my $status = 1;
if ($sys->cancel_date) { $status = 3; }
if ($sys->stop_date) { $status = 9; }

# process a change in status
my $newstatus;
if ($sys->cancel_date < 1 && $tmp{'cancel_date'}) {
$self->model->log('info', 'cancelling system '.$sys->sysid);
$newstatus = 3;
$status = 3;
}
if ($sys->stop_date < 1 && $tmp{'stop_date'}) {
$self->model->log('info', 'stopping system '.$sys->sysid);
$newstatus = 9;
$status = 9;
}
# store status so we can look at all and determine a cust status
push @statuses, $status;
# if status 9, add existing system's IPs to relen list
if ($newstatus == 9) {
my @ipobj = Lib::Ipmap->search( sysid => $sys->sysid, 
status => 1 );
foreach (@ipobj) { push @relen_ips, $_->ip; }
}

$self->model->log('info', "updating values for system 
".$sys->sysid);
while (my($key, $value) = each %$data) {
# we add this next line in case the client sends extra
# fields which we don't want to update. like the web
# client does
next unless ( Lib::Systems->find_column( $key ) );
$self->model->log('info', "setting $key to $value" );

eval { $sys->$key( $value ) };
if ($@) { $self->context->throw( 'set value', $@ ); }
} # end while
push @toupdate, $sys;
# IPs
# add new
if ($params{'ip_'.$sys->sysid.'_new'}) {
my $assign_date = $self->model->{'time'}->ymd;
my $relen_date = 0;
# REMOVE WHEN WE GO LIVE AND ALL 2nd SYSTEMS ARE ADDED TO RECORDS #
$assign_date = $sys->start_date;
# END REMOVE #
# if stopping server at same time assigning new ips
# we assume they were supposed to be there all the time so 
we set
# assign date to sys start date. also, set relen_date
if ($newstatus == 9) { $assign_date = $sys->start_date; 
$relen_date = $self->model->{'time'}->ymd; }
push @toupdate, update_ip($self, $sys->sysid, $cid, 
$assign_date, $relen_date, split /[\s\,]/, $params{'ip_'.$sys->sysid.'_new'});
$self->model->set('ip_'.$sys->sysid.'_new','');
} # end new ip if

# get rid of ips
my $relen_date = $self->model->{'time'}->ymd;
push @relen_ips, $self->model->input('ip_'.$sys->sysid);
push @toupdate, update_ip($self, $sys->sysid, $cid, undef, 
$relen_date, @relen_ips);
} # end update sys else
} # end sys foreach

---SNIP---
# process updates
foreach my $obj (@toupdate) {
$self->model->log('info', "updating obj:");
$self->model->log_dumper('info', $obj);
eval { $obj->update };
if ($@) {
$self->model->log('info', 'update failed, rolling back');
foreach my $o (@created) { $o->dbi_rollback; }
$self->context->throw( 'update', $@ );
} else {
push @created, $obj;
}
}
# if we made it this far, commit everything
foreach my $obj (@toupdate) { $obj->dbi_commit; }
$self->model->set('addsystem','');
$self->model->set('addcontact','');
$self->model->set('do_update','');
return;
Thanks!
At 03:40 PM 5/1/2004, Perrin Harkins wrote:
Dave Boodman wrote:
I'm seeing an issue where I do an insert and upon subsequent requests, 
certain children are not returning the newly-inserted data (row), while 
others are. Restarting apache fixes this as does waiting for some length 
of time.
Sounds like you have a scoping problem.  You are probably accidentally 
creating a closure somewhere that is holding onto old values.  If you can 
reduce your code down to an example small enough to post here, we can try 
to spot it for you.

- Perrin

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillis

Re: [MP2] eval and exit(0) : problem

2004-05-03 Thread Glenn
On Mon, May 03, 2004 at 07:17:54PM +0200, Arnaud Blancher wrote:
> Stas Bekman a ?crit :
> 
> >Arnaud Blancher wrote:
> >
> >>Stas Bekman a ?crit :
> >>
> >>>ydnar wrote:
> >>>
> The eval() is unecessary. The named sub can be used:
> 
> &$func(); 
> >>>
> >>>
> >>>
> >>yes but not with
> >> use strict
> >>...
> >
> >
> >try:
> >
> >  {
> >no strict 'refs';
> >&$func();
> >  }
> 
> 
> yes, it's work.
> i'don't realy like this solution, just because i always  try to use 'use 
> strict'
> to avoid problem with mod_perl 

As Stas mentioned previously, you should be using coderefs: $func->()
instead of eval() with &$func().   If you use eval () with &$func(),
then I think you are bypassing some compile-time 'strict' checks on
that code.  If you want the compiler to enforce maximum strictness
(a good thing), and you always try to 'use strict', as you say above,
then you should be using coderefs instead of &$func().  An example
will better illustrate proper usage:

e.g. if you have the subroutines

sub routine_1 { ... }
sub routine_2 { ... }

then instead of doing:

my $func = 'routine_1';
[ ... ]
&$func();

try the following:

my $func = \&routine_1;
[ ... ]
$func->();

That will compile cleanly with 'strict' in effect.

If you do not know the routine name in advance, then you can
create a hash of 'routine_name' => coderef and look up the
routines to get the proper coderef:

%valid_routines = ('routine_1'=>\&routine_1, 'routine_2'=>\&routine_2);

$func = $valid_routines{$routine_name} || die "invalid routine name";

OT for the mod_perl list, but HTH.
Cheers,
Glenn

> so, could you tell me if the final mp2, will have a solution for exit in 
> eval function ?
> in this case i'll wait and keep my complete 'use strict'
> in the other case .. may be i will change all my script, and lost a part 
> of 'strict'.
> 
> 
> Thanks
> Arnaud.
> 
> 
> >
> >FWIW, I find $func->() to be a more readable syntax.
> >
> >
> >>>You don't need to load anything. Indeed under mp2:
> >>>
> >>>  *CORE::GLOBAL::exit = \&ModPerl::Util::exit;
> >>>
> >>>And you don't need to load anything for this to work.
> >>>
> >>>in mp2 exit is implemented via a special die() call, therefore if 
> >>>you call it inside eval { } block (and eval "STRING" behaves 
> >>>identically) an exception is being thrown, but caught by eval.
> >>
> >>
> >>
> >>
> >>for me, both solution don't work :-((
> >>maybe me installation is wrong ...
> >>the output is always the sum of &first &second
> >
> >
> >You mean one solution. Indeed, I tried it and it doesn't, since $@ is 
> >set to '', which is the same as if eval {} didn't die.
> >
> >You didn't try the second solution: CORE::exit(0), but you probably 
> >don't want to use it as it's not efficient. But it'll work exactly as 
> >mod_cgi does.
> >
> >I consider the inability to exit when called from eval as a problem, 
> >so we need to think of finding a better way to emulate 
> >exit-but-don't-exit functionality.
> 
> 
> 
> 
> -- 
> Report problems: http://perl.apache.org/bugs/
> Mail list info: http://perl.apache.org/maillist/modperl.html
> List etiquette: http://perl.apache.org/maillist/email-etiquette.html

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



[mp2] default handler

2004-05-03 Thread Udlei Nattis
Hi,
I have problem to set default handler when enter in my website
httpd.conf:
   $Location{"/"} = {
   SetHandler  => "perl-script",
   PerlHandler => "eShop::Web::Shop::home",
   PerlOptions => "+SetupEnv",
   };
but when i access /image.gif, apache open module Shop::home
exist one solution for dont use module when i open another file
or for exemplo i rename location for /default and apache
load this modulos when i set DirectoryIndex
i look for one ModuleIndex...
thanks all and sorry my english
--
Udlei Nattis
Gerente de desenvolvimento
-
www.linuxmall.com.br
+55 11 5087-9441 

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [MP2] eval and exit(0) : problem

2004-05-03 Thread Stas Bekman
Glenn wrote:
On Mon, May 03, 2004 at 07:17:54PM +0200, Arnaud Blancher wrote:
Stas Bekman a ?crit :

Arnaud Blancher wrote:

Stas Bekman a ?crit :

ydnar wrote:

The eval() is unecessary. The named sub can be used:
&$func(); 


yes but not with
use strict
...

try:
{
  no strict 'refs';
  &$func();
}

yes, it's work.
i'don't realy like this solution, just because i always  try to use 'use 
strict'
to avoid problem with mod_perl 

As Stas mentioned previously, you should be using coderefs: $func->()
instead of eval() with &$func().   If you use eval () with &$func(),
then I think you are bypassing some compile-time 'strict' checks on
that code.  If you want the compiler to enforce maximum strictness
(a good thing), and you always try to 'use strict', as you say above,
then you should be using coderefs instead of &$func().  An example
will better illustrate proper usage:
e.g. if you have the subroutines
sub routine_1 { ... }
sub routine_2 { ... }
then instead of doing:
my $func = 'routine_1';
[ ... ]
&$func();
try the following:
my $func = \&routine_1;
[ ... ]
$func->();
That will compile cleanly with 'strict' in effect.
If you do not know the routine name in advance, then you can
create a hash of 'routine_name' => coderef and look up the
routines to get the proper coderef:
%valid_routines = ('routine_1'=>\&routine_1, 'routine_2'=>\&routine_2);
$func = $valid_routines{$routine_name} || die "invalid routine name";
Good point, Glenn. But it's actually not the style:
  &$func() and $func->() are the same strictness-checking-wise.
but the coderef vs. eval "string" that makes the difference. You can just as 
well do:

perl -wle 'use strict; sub foo { print "X" }; my $func = \&foo; &$func'
X
It's personal preference of whether to use $func->() vs &$func, with an added 
potential pitfall of &$func passing @_ along to the $func function, when () 
are forgotten. I prefer $func->() since it's clear that no arguments are 
passed. It's not clear in this code:

use strict;
sub foo { print @_ };
sub bar {
my $func = \&foo;
&$func;
};
bar("a")'
as you can see it prints "a", which you may not expect from &$func, unless you 
remember that &foo is special (this feature is there for 'goto &foo' 
constructs usually used in AUTOLOAD).

On the other hand:
sub bar {
my $func = \&foo;
$func->();
};
prints nada. and you can clearly see that no args are passed.
Certainly, you could write:
sub bar {
my $func = \&foo;
&$func();
};
and @_ won't be passed, but you may forget to add (), you can't forget them in 
$func->(). :)

--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


[ANNOUNCE] Apache-AuthNetLDAP-0.29

2004-05-03 Thread Shannon Eric Peevey
The uploaded file
   Apache-AuthNetLDAP-0.29.tar.gz
has entered CPAN as
 file: $CPAN/authors/id/S/SP/SPEEVES/Apache-AuthNetLDAP-0.29.tar.gz
 size: 6952 bytes
  md5: 66f557af1f2c443d8219be32200bed60
This release incorporates the ability to specify an alternative attribute as the 
password field...
--
Shannon Eric Peevey =>  "speeves"
Dyno-Mite! System Administrator =>  [EMAIL PROTECTED]
Central Web Support =>  (940) 369-8876
University of North Texas   =>  http://web2.unt.edu
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [mp2] default handler

2004-05-03 Thread Stas Bekman
Udlei Nattis wrote:
Hi,
I have problem to set default handler when enter in my website
httpd.conf:
   $Location{"/"} = {
   SetHandler  => "perl-script",
   PerlHandler => "eShop::Web::Shop::home",
   PerlOptions => "+SetupEnv",
   };
but when i access /image.gif, apache open module Shop::home
exist one solution for dont use module when i open another file
or for exemplo i rename location for /default and apache
load this modulos when i set DirectoryIndex
i look for one ModuleIndex...
thanks all and sorry my english
Let's see whether I understood you correctly. You want to have 
Shop::Web::Shop::home to handle everything but a few other resources, for 
which you want to run the default handler (like images).
In which case, take a look at:

http://perl.apache.org/docs/1.0/guide/config.html#Overriding_E_lt_LocationE_gt__Setting_in__Sub_Location_
Since you use  sections, you need to ensure that things are kept in the 
correct order, so / won't override other setting. So you will probably need to 
use Tie::IxHash...

Philippe, could you please update
http://perl.apache.org/docs/2.0/api/Apache/PerlSections.html
with examples on how to keep things in the order? Thanks!
--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [mp2] default handler

2004-05-03 Thread Udlei Nattis
Thanks Stas,
That is my problem,
subdirectoy is ok now
but in directory index problem persist
exists for example:
   # Modulo home default
   $Location{"/"} = {
   SetHandler  => "modperl",
   PerlHandler => "eShop::Web::Shop::home",
   PerlOptions => "+SetupEnv",
   };
>$Location{"/*"} = { # or != "/"
>SetHandler  => "default-handler",
>};
because i have /file.js and /file.css
or i need change all files to one directory in default handler?
thanks
Stas Bekman wrote:
Udlei Nattis wrote:
Hi,
I have problem to set default handler when enter in my website
httpd.conf:
   $Location{"/"} = {
   SetHandler  => "perl-script",
   PerlHandler => "eShop::Web::Shop::home",
   PerlOptions => "+SetupEnv",
   };
but when i access /image.gif, apache open module Shop::home
exist one solution for dont use module when i open another file
or for exemplo i rename location for /default and apache
load this modulos when i set DirectoryIndex
i look for one ModuleIndex...
thanks all and sorry my english

Let's see whether I understood you correctly. You want to have 
Shop::Web::Shop::home to handle everything but a few other resources, 
for which you want to run the default handler (like images).
In which case, take a look at:

http://perl.apache.org/docs/1.0/guide/config.html#Overriding_E_lt_LocationE_gt__Setting_in__Sub_Location_ 

Since you use  sections, you need to ensure that things are kept 
in the correct order, so / won't override other setting. So you will 
probably need to use Tie::IxHash...

Philippe, could you please update
http://perl.apache.org/docs/2.0/api/Apache/PerlSections.html
with examples on how to keep things in the order? Thanks!


--
Udlei Nattis
Gerente de desenvolvimento
-
www.linuxmall.com.br
+55 11 5087-9441 

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [mp2] $r->auth_name

2004-05-03 Thread Fred Moyer
Is there an mp2 implementation of $r->auth_name?  I'm working with
Apache::AuthCookie in a native mp2 environment and am getting an error
message of:
I believe this module has been ported to mp2 already.  you might want 
to
check the archives so you don't end up doing more work than you need.
I followed the threads to 
http://marc.theaimsgroup.com/?l=apache-modperl&m=105264164428847&w=2

Most of this I got working.
Can't locate class method 'Apache::RequestRec::auth_name' via package
'Apache::ReqestRec' at Apache/AuthCookie.pm line 18
I've found references to $r->auth_name and ap_auth_name in the source
but have not come across it in the api docs.
you need to
  use Apache::Access ();
first.
Aha, the missing piece. Thanks!
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [mp2] default handler

2004-05-03 Thread Stas Bekman
Udlei Nattis wrote:
Thanks Stas,
That is my problem,
subdirectoy is ok now
but in directory index problem persist
exists for example:
   # Modulo home default
   $Location{"/"} = {
   SetHandler  => "modperl",
   PerlHandler => "eShop::Web::Shop::home",
   PerlOptions => "+SetupEnv",
   };
 >$Location{"/*"} = { # or != "/"
 >SetHandler  => "default-handler",
 >};
because i have /file.js and /file.css
or i need change all files to one directory in default handler?
I guess something like:

SetHandler  => "default-handler",

You should read the Apache docs. It's not really a mod_perl specific issue.
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: mod_perl File Extension Configuration instead of a Path Configuration

2004-05-03 Thread JupiterHost.Net
Thanks for your input! I really appreciate it!
Perrin Harkins wrote:
On Mon, 2004-05-03 at 12:39, JupiterHost.Net wrote:
IE: it would be just as dangerouse as running a regular perl or shell or 
OTHER_LANGUAGE_HERE script in their home dir, correct?
[...]
mod_perl scripts are run with the permissions of the user correct?
IE if Apache its 'nobody' or otherwsie (getpwuid($>))[0]

No, when you run things with mod_perl, they run in the apache server
process.  They will always have the same permissions as the apache
So if I did it the .mpl way then /usr/foo/bar.mpl and /usr/foo/baz.mpl 
will run as nobody (IE untrusted user with less privileges)

(Regular .pl scripts currently run under suexec which I know mod_perl 
can't do since you can't split up a single process like that, will that 
hiinder mod_perl from running?)

Which is just as [in]secure as /home/foo/bar.pl , 
/home/foo/stuff/baz.sh, /home/foo/public_html/luz.py, correct?

(Maybe more secure since 'nobody' has less privs than 'foo', correct?)
server.  It is not safe to run untrusted scripts under mod_perl.  (There
is all kinds of hand-waving about using Safe or something, but the only
thing I would trust is an entirely separate server running as an
unprivileged user.)
More info on configuration options is available here:
http://perl.apache.org/docs/1.0/guide/config.html
I'll definately take a look thanks!
If you want to just run .pl scripts under specific directories through
mod_perl, the docs there will tell you how (using a 
directive).
Oh, good idea! then I can limit it to cgi-bin and .mpl... h excellent :)
- Perrin 
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


[mp1] subprocess_env and non-mod_perl handlers

2004-05-03 Thread John Wittkoski
Greetings all,

So I've been trying to find an answer to this in both the archives and 
in the available mod_perl books, but I have not had any luck, so I was 
hoping someone on the list would know the answer.

Generally: how does subprocess_env in mod_perl 1.x behave with 
non-mod_perl handlers?

It seems from the details I can find that subprocess_env is tied to the 
"live" table of the apache process. However, I am seeing behavior that 
seems to indicate otherwise.

Example 1:

I have mod_perl handlers defined for the TypeHandler and FixupHandler 
phases. If in the TypeHandler code I do this:

$r->subprocess_env("TEST" => "value");

Then in FixupHandler I can "see" TEST using:

$something = $r->subprocess_env("TEST");

Which is what you would expect.


Example 2:

Basically the same except I have a C handler defined for TypeHandler and 
  a mod_perl handler defined for FixupHandler. When the C code does:

ap_table_set(r->subprocess_env, "TEST", "value");

The mod_perl handler for FixupHandler doesn't see it using:

$something = $r->subprocess_env("TEST");


If I do the void subprocess_env trick:

$r->subprocess()

before retrieving $something, then it's populated along with the rest of 
the environment.

However, as mentioned in many of the docs/books, this is expensive and I 
really only need the one variable.

I've also tried walking the subprocess_env table in the perl handler, 
but the value set in the C handler is not there.

Are the C API subprocess_env table and the mod_perl API subprocess_env 
table distict until something (like the void call) merges the tables? Is 
this some sort of scoping issue between C and Perl?


Thanks,

--John




-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: mod_perl File Extension Configuration instead of a Path Configuration

2004-05-03 Thread Perrin Harkins
On Mon, 2004-05-03 at 17:24, JupiterHost.Net wrote:
> So if I did it the .mpl way then /usr/foo/bar.mpl and /usr/foo/baz.mpl 
> will run as nobody (IE untrusted user with less privileges)

If that's who your server runs as, then yes.  The "nobody" user has the
same privileges as any other user the systems I'm familiar with.  That
user typically has no login, but may have permission to write to certain
directories, etc.

> (Regular .pl scripts currently run under suexec which I know mod_perl 
> can't do since you can't split up a single process like that, will that 
> hiinder mod_perl from running?)

I'm not sure what you're asking.  If you add something to your conf to
make all of your .pl scripts run through mod_perl, they won't run
through suexec anymore.  You would have to keep them as CGI for that to
work.  If you set it up to run some directories through CGI and some
through mod_perl, that will work fine.

> Which is just as [in]secure as /home/foo/bar.pl , 
> /home/foo/stuff/baz.sh, /home/foo/public_html/luz.py, correct?

Running them under mod_perl is less secure in the sense that anyone can
write a script that messes around with globals, redefines core perl
fuctions, etc. and messes up other people's scripts, since they are all
running in the same interpreter.  You really should not run untrusted
code under mod_perl without isolating it to its own apache server.

> (Maybe more secure since 'nobody' has less privs than 'foo', correct?)

Again, "nobody" is just another user.

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: mod_perl File Extension Configuration instead of a Path Configuration

2004-05-03 Thread JupiterHost.Net

Perrin Harkins wrote:
On Mon, 2004-05-03 at 17:24, JupiterHost.Net wrote:
So if I did it the .mpl way then /usr/foo/bar.mpl and /usr/foo/baz.mpl 
will run as nobody (IE untrusted user with less privileges)

If that's who your server runs as, then yes.  The "nobody" user has the
same privileges as any other user the systems I'm familiar with.  That
user typically has no login, but may have permission to write to certain
directories, etc.
cool, gotcha
(Regular .pl scripts currently run under suexec which I know mod_perl 
can't do since you can't split up a single process like that, will that 
hiinder mod_perl from running?)

I'm not sure what you're asking.  If you add something to your conf to
make all of your .pl scripts run through mod_perl, they won't run
through suexec anymore.  You would have to keep them as CGI for that to
work.  If you set it up to run some directories through CGI and some
through mod_perl, that will work fine.
That's it exactly :)
If .pl run as regular scripts under suexec they'll be run as 'foo' 
instead of 'nobody' but any mod_perl scripts will be run as 'nobody'
but neither will break the other...


Which is just as [in]secure as /home/foo/bar.pl , 
/home/foo/stuff/baz.sh, /home/foo/public_html/luz.py, correct?

Running them under mod_perl is less secure in the sense that anyone can
write a script that messes around with globals, redefines core perl
fuctions, etc. and messes up other people's scripts, since they are all
running in the same interpreter.  You really should not run untrusted
code under mod_perl without isolating it to its own apache server.
I see, perhaps I need to look into setting it up to run theri own 
mod_perl apache so they can shoot them self in the foot instead of others :)

(Maybe more secure since 'nobody' has less privs than 'foo', correct?)

Again, "nobody" is just another user.
- Perrin
Thanks for the great info!
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [mp1] subprocess_env and non-mod_perl handlers

2004-05-03 Thread Geoffrey Young

> Example 1:
> 
> I have mod_perl handlers defined for the TypeHandler and FixupHandler 
> phases. If in the TypeHandler code I do this:
> 
> $r->subprocess_env("TEST" => "value");
> 
> Then in FixupHandler I can "see" TEST using:
> 
> $something = $r->subprocess_env("TEST");
> 
> Which is what you would expect.

indeed.

> 
> 
> Example 2:
> 
> Basically the same except I have a C handler defined for TypeHandler and 
>   a mod_perl handler defined for FixupHandler. When the C code does:
> 
> ap_table_set(r->subprocess_env, "TEST", "value");
> 
> The mod_perl handler for FixupHandler doesn't see it using:
> 
> $something = $r->subprocess_env("TEST");

that's not right.  however, I can't reproduce this with the attached minimal
test case.  see

  http://perl.apache.org/~geoff/subprocess-env.tar.gz

> 
> 
> If I do the void subprocess_env trick:
> 
> $r->subprocess()
> 
> before retrieving $something, then it's populated along with the rest of 
> the environment.

that only affects %ENV, not the ability of $r->subprocess_env to grab
something from the subprocess_env table.  %ENV is not automatically
populated with the contents of subprocess_env, so if you're really talking
about %ENV then your Example 2 + subprocess_env() trick sounds right.

> 
> However, as mentioned in many of the docs/books, this is expensive and I 
> really only need the one variable.
> 
> I've also tried walking the subprocess_env table in the perl handler, 
> but the value set in the C handler is not there.

that's really strange.  are you sure that you are not removing it in your
application someplace?  try tweaking the test tarball I mentioned bit by bit
until it has the relevant logic from your code in it.  I can't tell you the
number of bugs I've "fixed" by trying to reproduce the bug, only to find I
was the bug :)

> 
> Are the C API subprocess_env table and the mod_perl API subprocess_env 
> table distict until something (like the void call) merges the tables? Is 
> this some sort of scoping issue between C and Perl?

it shouldn't be, so long as you're hitting the tables directly with
$r->subprocess_env.  %ENV is another matter entirely.

--Geoff

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: [mp2] $r->auth_name

2004-05-03 Thread Geoffrey Young


Fred Moyer wrote:
> Greetings,
> 
> Is there an mp2 implementation of $r->auth_name?  I'm working with
> Apache::AuthCookie in a native mp2 environment and am getting an error
> message of:

I believe this module has been ported to mp2 already.  you might want to
check the archives so you don't end up doing more work than you need.

> 
> Can't locate class method 'Apache::RequestRec::auth_name' via package
> 'Apache::ReqestRec' at Apache/AuthCookie.pm line 18
> 
> I've found references to $r->auth_name and ap_auth_name in the source
> but have not come across it in the api docs.

you need to

  use Apache::Access ();

first.

HTH

--Geoff

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



[mp2] $r->auth_name

2004-05-03 Thread Fred Moyer
Greetings,
Is there an mp2 implementation of $r->auth_name?  I'm working with 
Apache::AuthCookie in a native mp2 environment and am getting an error 
message of:

Can't locate class method 'Apache::RequestRec::auth_name' via package 
'Apache::ReqestRec' at Apache/AuthCookie.pm line 18

I've found references to $r->auth_name and ap_auth_name in the source 
but have not come across it in the api docs.

TIA,
Fred
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


mason/mod_perl debugging help needed

2004-05-03 Thread Andrew Waegel
Hello,
Andrew Waegel here, popping over from the HTML::Mason list with a 
request for help. I've reached the limit of my debugging ability and am 
now looking for an experienced Apache/mod_perl/mason developer to help 
me debug a problem I'm having with my system.

Some more details on the problem:
A client of mine has been using Mason for years now, and after a recent 
system upgrade we have an issues with Mason-powered pages 
intermittently causing their apache processes to hang indefinitely. I 
can reproduce the problem easily, and upon closer inspection with 
strace and gdb I can tell that Apache is hanging in the same place 
every time. The problem is, I don't know enough about C/Apache/mod_perl 
coding to go any further with these results.

Can anyone help out? Soon :) ? If interested, please email me a bit 
about yourself, your experience, and your billing rate for short jobs 
like this.

Thanks,
- Andrew
PS if this in an inappropriate forum for such solicitations, please 
accept my apologies and let me know where to look.

   --- Andrew Waegel Benevolent Technologies, LLC ---
--- 510 418 5137  [EMAIL PROTECTED] ---
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html