summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-01-18 09:40:02 +0000
committerNicholas Clark <nick@ccl4.org>2008-01-18 09:40:02 +0000
commit7191f387c0fa6065ef0d358ee594d31676dff988 (patch)
tree7a302894c495199ee0b98a95aa917c1d3e2f32bd /perl.c
parent69867b4e28ea835a3b328f99facbba4462e28c83 (diff)
downloadperl-7191f387c0fa6065ef0d358ee594d31676dff988.tar.gz
Collect all the S_validate_suid() unused argument logic in one place.
p4raw-id: //depot/perl@32997
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/perl.c b/perl.c
index 17a5eb011e..89dc73a783 100644
--- a/perl.c
+++ b/perl.c
@@ -3767,6 +3767,24 @@ S_validate_suid(pTHX_ const char *validarg, const char *scriptname,
int fdscript, int suidscript, SV *linestr_sv, PerlIO *rsfp)
{
dVAR;
+#ifdef DOSUID
+ const char *s, *s2;
+#endif
+
+#ifdef DOSUID
+# ifdef IAMSUID
+ PERL_UNUSED_ARG(scriptname);
+# endif
+#else
+ PERL_UNUSED_ARG(validarg);
+ PERL_UNUSED_ARG(scriptname);
+ PERL_UNUSED_ARG(linestr_sv);
+ PERL_UNUSED_ARG(fdscript);
+ PERL_UNUSED_ARG(suidscript);
+# ifdef SETUID_SCRIPTS_ARE_SECURE_NOW
+ PERL_UNUSED_ARG(rsfp);
+# endif
+#endif
/* do we need to emulate setuid on scripts? */
@@ -3796,7 +3814,6 @@ S_validate_suid(pTHX_ const char *validarg, const char *scriptname,
*/
#ifdef DOSUID
- const char *s, *s2;
if (PerlLIO_fstat(PerlIO_fileno(rsfp),&PL_statbuf) < 0) /* normal stat is insecure */
Perl_croak(aTHX_ "Can't stat script \"%s\"",PL_origfilename);
@@ -4140,12 +4157,8 @@ FIX YOUR KERNEL, OR PUT A C WRAPPER AROUND THIS SCRIPT!\n");
Perl_croak(aTHX_ "Can't do setuid (suidperl cannot exec perl)\n");
# endif /* IAMSUID */
#else /* !DOSUID */
- PERL_UNUSED_ARG(fdscript);
- PERL_UNUSED_ARG(suidscript);
if (PL_euid != PL_uid || PL_egid != PL_gid) { /* (suidperl doesn't exist, in fact) */
-# ifdef SETUID_SCRIPTS_ARE_SECURE_NOW
- PERL_UNUSED_ARG(rsfp);
-# else
+# ifndef SETUID_SCRIPTS_ARE_SECURE_NOW
PerlLIO_fstat(PerlIO_fileno(rsfp),&PL_statbuf); /* may be either wrapped or real suid */
if ((PL_euid != PL_uid && PL_euid == PL_statbuf.st_uid && PL_statbuf.st_mode & S_ISUID)
||
@@ -4158,9 +4171,6 @@ FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n");
/* not set-id, must be wrapped */
}
#endif /* DOSUID */
- PERL_UNUSED_ARG(validarg);
- PERL_UNUSED_ARG(scriptname);
- PERL_UNUSED_ARG(linestr_sv);
}
STATIC void