From: Gurusamy Sarathy Date: Fri, 12 Feb 1999 07:38:16 +0000 (+0000) Subject: PERL5OPT=-T enables taint mode (suggested by Jason Riedy ) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=74288ac80044d4682050dc85f8309429977cc884;p=p5sagit%2Fp5-mst-13.2.git PERL5OPT=-T enables taint mode (suggested by Jason Riedy ) p4raw-id: //depot/perl@2880 --- diff --git a/perl.c b/perl.c index c91c960..9d47e22 100644 --- a/perl.c +++ b/perl.c @@ -891,19 +891,25 @@ print \" \\@INC:\\n @INC\\n\";"); switch_end: if (!PL_tainting && (s = PerlEnv_getenv("PERL5OPT"))) { - while (s && *s) { - while (isSPACE(*s)) - s++; - if (*s == '-') { - s++; - if (isSPACE(*s)) - continue; + while (isSPACE(*s)) + s++; + if (*s == '-' && *(s+1) == 'T') + PL_tainting = TRUE; + else { + while (s && *s) { + while (isSPACE(*s)) + s++; + if (*s == '-') { + s++; + if (isSPACE(*s)) + continue; + } + if (!*s) + break; + if (!strchr("DIMUdmw", *s)) + croak("Illegal switch in PERL5OPT: -%c", *s); + s = moreswitches(s); } - if (!*s) - break; - if (!strchr("DIMUdmw", *s)) - croak("Illegal switch in PERL5OPT: -%c", *s); - s = moreswitches(s); } } diff --git a/pod/perlrun.pod b/pod/perlrun.pod index 6ea5a1d..8a57257 100644 --- a/pod/perlrun.pod +++ b/pod/perlrun.pod @@ -686,7 +686,8 @@ Command-line options (switches). Switches in this variable are taken as if they were on every Perl command line. Only the B<-[DIMUdmw]> switches are allowed. When running taint checks (because the script was running setuid or setgid, or the B<-T> switch was used), this -variable is ignored. +variable is ignored. If PERL5OPT begins with B<-T>, tainting will be +enabled, and any subsequent options ignored. =item PERLLIB