Anod |int |perl_run |PerlInterpreter* interp
Anod |int |perl_parse |PerlInterpreter* interp|XSINIT_t xsinit \
|int argc|char** argv|char** env
-np |int |doing_taint |int argc|char** argv|char** env
+np |bool |doing_taint |int argc|char** argv|char** env
#if defined(USE_ITHREADS)
Anod |PerlInterpreter*|perl_clone|PerlInterpreter* interp, UV flags
# if defined(PERL_IMPLICIT_SYS)
#define PL_curinterp (PL_Vars.Gcurinterp)
#define PL_do_undump (PL_Vars.Gdo_undump)
#define PL_dollarzero_mutex (PL_Vars.Gdollarzero_mutex)
+#define PL_earlytaint (PL_Vars.Gearlytaint)
#define PL_hexdigit (PL_Vars.Ghexdigit)
#define PL_malloc_mutex (PL_Vars.Gmalloc_mutex)
#define PL_op_mutex (PL_Vars.Gop_mutex)
#define PL_Gcurinterp PL_curinterp
#define PL_Gdo_undump PL_do_undump
#define PL_Gdollarzero_mutex PL_dollarzero_mutex
+#define PL_Gearlytaint PL_earlytaint
#define PL_Ghexdigit PL_hexdigit
#define PL_Gmalloc_mutex PL_malloc_mutex
#define PL_Gop_mutex PL_op_mutex
/* noop unless Configure is given -Accflags=-DPERL_GPROF_CONTROL */
PERL_GPROF_MONCONTROL(0);
+ /* To be used instead PL_taining before perl_parse() */
+ PL_earlytaint = doing_taint(argc, argv, env);
+
PERL_SYS_INIT3(&argc,&argv,&env);
#if defined(USE_ITHREADS)
if (PL_perl_destruct_level > 0)
init_interp();
#endif
-
/* Init the real globals (and main thread)? */
if (!PL_linestr) {
#ifdef PERL_FLEXIBLE_EXCEPTIONS
/* This is used very early in the lifetime of the program,
* before even the options are parsed, so PL_tainting has
- * not been initialized properly.*/
-int
+ * not been initialized properly. The variable PL_earlytaint
+ * is set early in main() to the result of this function. */
+bool
Perl_doing_taint(int argc, char *argv[], char *envp[])
{
- int uid = PerlProc_getuid();
+ int uid = PerlProc_getuid();
int euid = PerlProc_geteuid();
- int gid = PerlProc_getgid();
+ int gid = PerlProc_getgid();
int egid = PerlProc_getegid();
#ifdef VMS
- uid |= gid << 16;
+ uid |= gid << 16;
euid |= egid << 16;
#endif
if (uid && (euid != uid || egid != gid))
return 1;
- /* This is a really primitive check; $ENV{PERL_MALLOC_OPT} is
- ignored only if -T are the first chars together; otherwise one
- gets "Too late" message. */
+ /* This is a really primitive check; environment gets ignored only
+ * if -T are the first chars together; otherwise one gets
+ * "Too late" message. */
if ( argc > 1 && argv[1][0] == '-'
&& (argv[1][1] == 't' || argv[1][1] == 'T') )
return 1;
if (newval) { \
panic_write2("panic: tainting with $ENV{PERL_MALLOC_OPT}\n");\
exit(1); })
-extern int Perl_doing_taint(int argc, char *argv[], char *envp[]);
# define MALLOC_CHECK_TAINT(argc,argv,env) STMT_START { \
- if (Perl_doing_taint(argc, argv, env)) { \
+ if (Perl_doing_taint(argc,argv,env)) { \
MallocCfg_ptr[MallocCfg_skip_cfg_env] = 1; \
}} STMT_END;
#else /* MYMALLOC */
#define PL_do_undump (*Perl_Gdo_undump_ptr(NULL))
#undef PL_dollarzero_mutex
#define PL_dollarzero_mutex (*Perl_Gdollarzero_mutex_ptr(NULL))
+#undef PL_earlytaint
+#define PL_earlytaint (*Perl_Gearlytaint_ptr(NULL))
#undef PL_hexdigit
#define PL_hexdigit (*Perl_Ghexdigit_ptr(NULL))
#undef PL_malloc_mutex
/* This is constant on most architectures, a global on OS/2 */
PERLVARI(Gsh_path, char *, SH_PATH)/* full path of shell */
+
+PERLVAR(Gearlytaint, bool) /* Early warning for taint, before PL_tainting is set */
+
PERL_CALLCONV void perl_free(PerlInterpreter* interp);
PERL_CALLCONV int perl_run(PerlInterpreter* interp);
PERL_CALLCONV int perl_parse(PerlInterpreter* interp, XSINIT_t xsinit, int argc, char** argv, char** env);
-PERL_CALLCONV int Perl_doing_taint(int argc, char** argv, char** env);
+PERL_CALLCONV bool Perl_doing_taint(int argc, char** argv, char** env);
#if defined(USE_ITHREADS)
PERL_CALLCONV PerlInterpreter* perl_clone(PerlInterpreter* interp, UV flags);
# if defined(PERL_IMPLICIT_SYS)