You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@hyperreal.org on 1998/07/09 01:00:43 UTC

cvs commit: modperl/src/modules/perl mod_perl.h perl_config.c

dougm       98/07/08 16:00:43

  Modified:    .        ToDo
               lib/Apache ExtUtils.pm Registry.pm
               src/modules/perl mod_perl.h perl_config.c
  Log:
  plug leaks in directive handlers
  
  Revision  Changes    Path
  1.37      +3 -0      modperl/ToDo
  
  Index: ToDo
  ===================================================================
  RCS file: /export/home/cvs/modperl/ToDo,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- ToDo	1998/06/19 19:31:22	1.36
  +++ ToDo	1998/07/08 23:00:40	1.37
  @@ -123,6 +123,9 @@
   - remove Apache::Symbol::undef cruft, now that the mandatory const sub
     redefined warning is downgraded in 5.004_05-tobe
   
  +- stash POST data so $r->content works even after POST data is read
  +  from the client  
  +  
   - perl_clear_env() should skip those found in PerlPassEnv?
   
   - File::copy($file,*STDOUT) doesn't work (pp_syswrite needs tie support)
  
  
  
  1.11      +1 -0      modperl/lib/Apache/ExtUtils.pm
  
  Index: ExtUtils.pm
  ===================================================================
  RCS file: /export/home/cvs/modperl/lib/Apache/ExtUtils.pm,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ExtUtils.pm	1998/07/08 18:07:49	1.10
  +++ ExtUtils.pm	1998/07/08 23:00:41	1.11
  @@ -140,6 +140,7 @@
   	    palloc(p, sizeof (mod_perl_perl_dir_config));
       cld->obj = Nullsv;
       cld->class = "$class";
  +    register_cleanup(p, cld, perl_perl_cmd_cleanup, null_cleanup);
       return cld;
   }
   
  
  
  
  1.12      +9 -3      modperl/lib/Apache/Registry.pm
  
  Index: Registry.pm
  ===================================================================
  RCS file: /export/home/cvs/modperl/lib/Apache/Registry.pm,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Registry.pm	1998/06/23 21:25:39	1.11
  +++ Registry.pm	1998/07/08 23:00:41	1.12
  @@ -3,8 +3,8 @@
   #use strict; #eval'd scripts will inherit hints
   use Apache::Constants qw(:common &OPT_EXECCGI &REDIRECT);
   
  -#$Id: Registry.pm,v 1.11 1998/06/23 21:25:39 dougm Exp $
  -$Apache::Registry::VERSION = (qw$Revision: 1.11 $)[1];
  +#$Id: Registry.pm,v 1.12 1998/07/08 23:00:41 dougm Exp $
  +$Apache::Registry::VERSION = (qw$Revision: 1.12 $)[1];
   
   $Apache::Registry::Debug ||= 0;
   # 1 => log recompile in errorlog
  @@ -17,6 +17,9 @@
   unless (defined $Apache::Registry::NameWithVirtualHost) {
       $Apache::Registry::NameWithVirtualHost = 1;
   }
  +unless (defined $Apache::Registry::MarkLine) {
  +    $Apache::Registry::MarkLine = 1;
  +}
   
   sub handler {
       my $r = shift;
  @@ -109,13 +112,16 @@
   	    }
   	    $r->clear_rgy_endav($script_name);
   
  +	    my $line = $Apache::Registry::MarkLine ?
  +		"\n#line 1 $filename\n" : "";
  + 
   	    my $eval = join(
   			    '',
   			    'package ',
   			    $package,
    			    ';use Apache qw(exit);',
    			    'sub handler {',
  - 			    "\n#line 1 $filename\n",
  +			    $line,
   			    $sub,
   			    "\n}", # last line comment without newline?
   			   );
  
  
  
  1.30      +1 -0      modperl/src/modules/perl/mod_perl.h
  
  Index: mod_perl.h
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/mod_perl.h,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- mod_perl.h	1998/07/08 18:07:50	1.29
  +++ mod_perl.h	1998/07/08 23:00:42	1.30
  @@ -943,6 +943,7 @@
   void *perl_merge_dir_config(pool *p, void *basev, void *addv);
   void *perl_create_dir_config(pool *p, char *dirname);
   void *perl_create_server_config(pool *p, server_rec *s);
  +void perl_perl_cmd_cleanup(void *data);
   
   void perl_section_self_boot(cmd_parms *parms, void *dummy, const char *arg);
   CHAR_P perl_section (cmd_parms *cmd, void *dummy, CHAR_P arg);
  
  
  
  1.23      +22 -8     modperl/src/modules/perl/perl_config.c
  
  Index: perl_config.c
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/perl_config.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- perl_config.c	1998/07/08 18:07:50	1.22
  +++ perl_config.c	1998/07/08 23:00:42	1.23
  @@ -659,6 +659,7 @@
   	    *sv = POPs;
   	    ++SvREFCNT(*sv);
   	}
  +	PUTBACK;
   	FREETMPS;LEAVE;
   
   	return *sv;
  @@ -679,7 +680,7 @@
   void *perl_perl_merge_dir_config(pool *p, void *basev, void *addv)
   {
       GV *gv;
  -    mod_perl_perl_dir_config *new,
  +    mod_perl_perl_dir_config *new = NULL,
   	*basevp = (mod_perl_perl_dir_config *)basev,
   	*addvp  = (mod_perl_perl_dir_config *)addv;
       SV *sv, *basesv = basevp->obj, *addsv = addvp->obj;
  @@ -711,6 +712,7 @@
   	    new->obj = sv;
   	    new->class = SvCLASS(sv);
   	}
  +	PUTBACK;
   	FREETMPS;LEAVE;
       }
       else {
  @@ -720,12 +722,24 @@
       return (void *)new;
   }
   
  +void perl_perl_cmd_cleanup(void *data)
  +{
  +    mod_perl_perl_dir_config *cld = (mod_perl_perl_dir_config *)data;
  +
  +    if(cld->obj) {
  +	MP_TRACE_c(fprintf(stderr, 
  +			   "cmd_cleanup: SvREFCNT($%s::$obj) == %d\n",
  +			   cld->class, (int)SvREFCNT(cld->obj)));
  +	SvREFCNT_dec(cld->obj);
  +    }
  +}
  +
   CHAR_P perl_cmd_perl_TAKE123(cmd_parms *cmd, mod_perl_perl_dir_config *data,
   				  char *one, char *two, char *three)
   {
       dSP;
       mod_perl_cmd_info *info = (mod_perl_cmd_info *)cmd->info;
  -    char *subname = info->subname;
  +    char *subname = info->subname, *retval = NULL;
       int count = 0;
       CV *cv = perl_get_cv(subname, TRUE);
       SV *obj;
  @@ -752,16 +766,16 @@
       count = perl_call_sv((SV*)cv, G_EVAL | G_SCALAR);
       SPAGAIN;
       if(count == 1) {
  -	char *retval = POPp;
  -	if(strEQ(retval, DECLINE_CMD))
  -	    return DECLINE_CMD;
  +	if(strEQ(POPp, DECLINE_CMD))
  +	    retval = DECLINE_CMD;
  +	PUTBACK;
       }
       FREETMPS;LEAVE;
   
       if(SvTRUE(ERRSV))
  -	return SvPVX(ERRSV);
  -    else
  -	return NULL;
  +	retval = SvPVX(ERRSV);
  +
  +    return retval;
   }
   #endif /* PERL_DIRECTIVE_HANDLERS */