You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Gerald Richter <ri...@ecos.de> on 2001/03/05 10:01:52 UTC

PATCH: Fix SIGSEGV after subprocess_env

Hi,

here is a patch for a problem that has striked me for a long time. It occurs
only if a request has a path_info, an handler other than a content handler
is configured and you call subprocess_env. The subprocess_env call
ap_add_cgi_vars, which starts a subrequest when a path_info is present, to
translate the path_info to the PATH_TRANSLATED env var. If now also for
example an auth handler is configured, the auth handler set the gobal var
mp_request_rec to the request rec of this subrequest and it is never set
back. So any call to Apache -> request will return this subrequest, which
isn't valid anymore in the content handler, so Apache crashs...

The following patch (against the current cvs version) makes sure the
mp_request_rec is reseted correctly

Gerald

Index: perl_util.c
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/perl_util.c,v
retrieving revision 1.45
diff -u -r1.45 perl_util.c
--- perl_util.c 2001/02/16 23:30:28 1.45
+++ perl_util.c 2001/03/05 08:52:50
@@ -610,6 +610,8 @@

     add_common_vars(r);
     add_cgi_vars(r);
+    /* resetup global request rec, because it may set to an (invalid)
subrequest by ap_add_cgi_vars */
+    perl_request_rec(r);

     if (!table_get(envtab, "TZ")) {
  if ((tz = getenv("TZ")) != NULL) {


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



Re: PATCH: Fix SIGSEGV after subprocess_env

Posted by Doug MacEachern <do...@covalent.net>.
thanks gerald, applied.

On Mon, 5 Mar 2001, Gerald Richter wrote:

> Hi,
> 
> here is a patch for a problem that has striked me for a long time. It occurs
> only if a request has a path_info, an handler other than a content handler
> is configured and you call subprocess_env. The subprocess_env call
> ap_add_cgi_vars, which starts a subrequest when a path_info is present, to
> translate the path_info to the PATH_TRANSLATED env var. If now also for
> example an auth handler is configured, the auth handler set the gobal var
> mp_request_rec to the request rec of this subrequest and it is never set
> back. So any call to Apache -> request will return this subrequest, which
> isn't valid anymore in the content handler, so Apache crashs...
> 
> The following patch (against the current cvs version) makes sure the
> mp_request_rec is reseted correctly
> 
> Gerald
> 
> Index: perl_util.c
> ===================================================================
> RCS file: /home/cvs/modperl/src/modules/perl/perl_util.c,v
> retrieving revision 1.45
> diff -u -r1.45 perl_util.c
> --- perl_util.c 2001/02/16 23:30:28 1.45
> +++ perl_util.c 2001/03/05 08:52:50
> @@ -610,6 +610,8 @@
> 
>      add_common_vars(r);
>      add_cgi_vars(r);
> +    /* resetup global request rec, because it may set to an (invalid)
> subrequest by ap_add_cgi_vars */
> +    perl_request_rec(r);
> 
>      if (!table_get(envtab, "TZ")) {
>   if ((tz = getenv("TZ")) != NULL) {
> 
> 
> -------------------------------------------------------------
> Gerald Richter    ecos electronic communication services gmbh
> Internetconnect * Webserver/-design/-datenbanken * Consulting
> 
> Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
> E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
> WWW:        http://www.ecos.de      Fax:      +49 6133 925152
> -------------------------------------------------------------
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
> For additional commands, e-mail: dev-help@perl.apache.org
> 


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