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 1999/07/02 00:07:24 UTC

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

dougm       99/07/01 15:07:23

  Modified:    .        Changes ToDo
               src/modules/perl mod_perl.h perl_util.c
  Log:
  fix some problems with %ENV (e.g. SetEnv PATH cause mangled value)
  
  Revision  Changes    Path
  1.314     +2 -0      modperl/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /export/home/cvs/modperl/Changes,v
  retrieving revision 1.313
  retrieving revision 1.314
  diff -u -r1.313 -r1.314
  --- Changes	1999/07/01 18:48:03	1.313
  +++ Changes	1999/07/01 22:07:11	1.314
  @@ -8,6 +8,8 @@
   
   =item 1.20_01-dev
   
  +fix some problems with %ENV (e.g. SetEnv PATH cause mangled value)
  +
   loosen module/cookie tests
   
   fix bug in register_cleanup() [Chip Turner <ch...@ZFx.com>]
  
  
  
  1.188     +0 -2      modperl/ToDo
  
  Index: ToDo
  ===================================================================
  RCS file: /export/home/cvs/modperl/ToDo,v
  retrieving revision 1.187
  retrieving revision 1.188
  diff -u -r1.187 -r1.188
  --- ToDo	1999/06/24 02:24:00	1.187
  +++ ToDo	1999/07/01 22:07:12	1.188
  @@ -3,8 +3,6 @@
                    (well, close to it anyhow)
   ---------------------------------------------------------------------------
   
  -- SetEnv PATH is broken
  -
   - need to check return value from ap_setup_client_block
   
   - mod_perl_version.h should not be directly written to
  
  
  
  1.80      +4 -9      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.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- mod_perl.h	1999/06/07 21:01:23	1.79
  +++ mod_perl.h	1999/07/01 22:07:19	1.80
  @@ -257,21 +257,15 @@
       SvTAINTED_on(*hv_fetch(hv, key, klen, 0)) 
   
   #define mp_setenv(key, val) \
  -{ \
  -    int klen = strlen(key); \
  -    hv_store(GvHV(envgv), key, klen, newSVpv(val,0), FALSE); \
  -    HV_SvTAINTED_on(GvHV(envgv), key, klen); \
  -    my_setenv(key, val); \
  -}
  +mp_magic_setenv(key, val, 1)
   
   #define mp_SetEnv(key, val) \
  -    hv_store(GvHV(envgv), key, strlen(key), newSVpv(val,0), FALSE); \
  -    my_setenv(key, val)
  +mp_magic_setenv(key, val, 0)
   
   #define mp_PassEnv(key) \
   { \
       char *val = getenv(key); \
  -    hv_store(GvHV(envgv), key, strlen(key), newSVpv(val?val:"",0), FALSE); \
  +    mp_magic_setenv(key, val?val:"", 0); \
   }
   
   #define mp_debug mod_perl_debug_flags
  @@ -1120,6 +1114,7 @@
   int perl_load_startup_script(server_rec *s, pool *p, char *script, I32 my_warn);
   array_header *perl_cgi_env_init(request_rec *r);
   void perl_clear_env(void);
  +void mp_magic_setenv(char *key, char *val, int is_tainted);
   void mod_perl_init_ids(void);
   int perl_eval_ok(server_rec *s);
   int perl_sv_is_http_code(SV *sv, int *status);
  
  
  
  1.31      +12 -0     modperl/src/modules/perl/perl_util.c
  
  Index: perl_util.c
  ===================================================================
  RCS file: /export/home/cvs/modperl/src/modules/perl/perl_util.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- perl_util.c	1999/06/04 17:50:47	1.30
  +++ perl_util.c	1999/07/01 22:07:20	1.31
  @@ -571,6 +571,18 @@
       return perl_eval_ok(s);
   } 
   
  +void mp_magic_setenv(char *key, char *val, int is_tainted)
  +{
  +    int klen = strlen(key);
  +    SV **ptr = hv_fetch(GvHV(envgv), key, klen, TRUE);
  +    if (ptr) {
  +	SvSetMagicSV(*ptr, newSVpv(val,0));
  +	if (is_tainted) {
  +	    SvTAINTED_on(*ptr);
  +	}
  +    }
  +}
  +
   array_header *perl_cgi_env_init(request_rec *r)
   {
       table *envtab = r->subprocess_env;