You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Doug MacEachern <do...@covalent.net> on 2000/09/26 23:00:09 UTC

Re: PerlModule in .htaccess (for auth) faults (possible patch for perl_config.c)

On 22 Aug 2000, Andrew Gideon wrote:
... 
> My .htaccess file contains:
> 
> 	PerlModule          Apache::TAGXSessionAuth 
> 	PerlAuthenHandler   Apache::TAGXSessionAuth->authen 
> 	PerlAuthzHandler    Apache::TAGXSessionAuth->authz 
> 
> After attaching to a child process and getting the segv, 
> the stack looks like:
> 
> 	(gdb) where 
> 	#0  0x107810 in ap_push_array ()

thanks for digging into this andrew.
i think the problem is related to the perl_merge_server_config routine:
#if 0
    /* We don't merge these because they're inlined */
    mrg->PerlModule = append_arrays(p, add->PerlModule, base->PerlModule);
    mrg->PerlRequire = append_arrays(p, add->PerlRequire, base->PerlRequire);
#endif

this means that VirtualHost configs have NULL for both arrays.  this is
fine at startup time, since mod_perl only uses the base_server config.
a simple fix is to not push if either is NULL:

Index: src/modules/perl/perl_config.c
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/perl_config.c,v
retrieving revision 1.103
diff -u -u -r1.103 perl_config.c
--- src/modules/perl/perl_config.c	2000/09/26 20:05:22	1.103
+++ src/modules/perl/perl_config.c	2000/09/26 20:59:48
@@ -587,8 +587,11 @@
 	    return NULL;
 	}
     }
-    *(char **)push_array(cls->PerlModule) = pstrdup(parms->pool, arg);
 
+    if (cld->PerlModule) {
+        *(char **)push_array(cls->PerlModule) = pstrdup(parms->pool, arg);
+    }
+
 #ifdef PERL_SECTIONS
     if(CAN_SELF_BOOT_SECTIONS)
 	perl_section_self_boot(parms, dummy, arg);
@@ -618,7 +621,9 @@
 	}
     }
 
-    *(char **)push_array(cls->PerlRequire) = pstrdup(parms->pool, arg);
+    if (cls->PerlRequire) {
+        *(char **)push_array(cls->PerlRequire) = pstrdup(parms->pool, arg);
+    }
 
 #ifdef PERL_SECTIONS
     if(CAN_SELF_BOOT_SECTIONS)