X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=taint.c;h=c25ff778ef490bafdcbe897aa986dded226aeb77;hb=92e830a9086d75f086574c378b1c63ff2e00edcf;hp=7a8baac7b0ff4f3f607ccae0bb39d86a4bea855f;hpb=411caa507cab4ba311ec4000c486ad2592d51146;p=p5sagit%2Fp5-mst-13.2.git diff --git a/taint.c b/taint.c index 7a8baac..c25ff77 100644 --- a/taint.c +++ b/taint.c @@ -13,9 +13,26 @@ Perl_taint_proper(pTHX_ const char *f, const char *s) { char *ug; -#ifdef HAS_SETEUID - DEBUG_u(PerlIO_printf(Perl_debug_log, - "%s %d %"Uid_t_f" %"Uid_t_f"\n", s, PL_tainted, PL_uid, PL_euid)); +#if defined(HAS_SETEUID) && defined(DEBUGGING) +# if Uid_t_size == 1 + { + UV uid = PL_uid; + UV euid = PL_euid; + + DEBUG_u(PerlIO_printf(Perl_debug_log, + "%s %d %"UVuf" %"UVuf"\n", + s, PL_tainted, uid, euid)); + } +# else + { + IV uid = PL_uid; + IV euid = PL_euid; + + DEBUG_u(PerlIO_printf(Perl_debug_log, + "%s %d %"IVdf" %"IVdf"\n", + s, PL_tainted, uid, euid)); + } +# endif #endif if (PL_tainted) { @@ -25,12 +42,17 @@ Perl_taint_proper(pTHX_ const char *f, const char *s) ug = " while running setuid"; else if (PL_egid != PL_gid) ug = " while running setgid"; - else + else if (PL_taint_warn) + ug = " while running with -t switch"; + else ug = " while running with -T switch"; - if (!PL_unsafe) - Perl_croak(aTHX_ f, s, ug); - else if (ckWARN(WARN_TAINT)) - Perl_warner(aTHX_ WARN_TAINT, f, s, ug); + if (PL_unsafe || PL_taint_warn) { + if(ckWARN(WARN_TAINT)) + Perl_warner(aTHX_ WARN_TAINT, f, s, ug); + } + else { + Perl_croak(aTHX_ f, s, ug); + } } } @@ -66,7 +88,7 @@ Perl_taint_env(pTHX) TAINT; taint_proper("Insecure %s%s", "$ENV{DCL$PATH}"); } - if ((mg = mg_find(*svp, 'e')) && MgTAINTEDDIR(mg)) { + if ((mg = mg_find(*svp, PERL_MAGIC_envelem)) && MgTAINTEDDIR(mg)) { TAINT; taint_proper("Insecure directory in %s%s", "$ENV{DCL$PATH}"); } @@ -81,7 +103,7 @@ Perl_taint_env(pTHX) TAINT; taint_proper("Insecure %s%s", "$ENV{PATH}"); } - if ((mg = mg_find(*svp, 'e')) && MgTAINTEDDIR(mg)) { + if ((mg = mg_find(*svp, PERL_MAGIC_envelem)) && MgTAINTEDDIR(mg)) { TAINT; taint_proper("Insecure directory in %s%s", "$ENV{PATH}"); }