summaryrefslogtreecommitdiffstats
path: root/contrib/perl5
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>1998-09-24 17:20:46 +0000
committermarkm <markm@FreeBSD.org>1998-09-24 17:20:46 +0000
commiteb50082071593e9000b032685eb4510e4f6a510e (patch)
tree5b84caf51ae4d761f5553370ebd3874237dcb882 /contrib/perl5
parente7f748a814746f2fe276557bc8549cd106c0016a (diff)
downloadFreeBSD-src-eb50082071593e9000b032685eb4510e4f6a510e.zip
FreeBSD-src-eb50082071593e9000b032685eb4510e4f6a510e.tar.gz
Part #1 of suidperl repair.
Diffstat (limited to 'contrib/perl5')
-rw-r--r--contrib/perl5/perl.c14
-rw-r--r--contrib/perl5/perl.h9
2 files changed, 23 insertions, 0 deletions
diff --git a/contrib/perl5/perl.c b/contrib/perl5/perl.c
index e76d83a..d86e774 100644
--- a/contrib/perl5/perl.c
+++ b/contrib/perl5/perl.c
@@ -2123,6 +2123,20 @@ validate_suid(char *validarg, char *scriptname, int fdscript)
croak("Can't swap uid and euid"); /* really paranoid */
if (PerlLIO_stat(SvPVX(GvSV(PL_curcop->cop_filegv)),&tmpstatbuf) < 0)
croak("Permission denied"); /* testing full pathname here */
+#if (defined(BSD) && (BSD >= 199306))
+#ifdef IAMSUID
+ {
+ struct statfs stfs;
+
+ if (fstatfs(fileno(PL_rsfp),&stfs) < 0)
+ croak("Can't statfs filesystem of script \"%s\"",PL_origfilename);
+
+ if (stfs.f_flags & MNT_NOSUID)
+ croak("Permission denied");
+ }
+#endif /* IAMSUID */
+#endif /* BSD */
+
if (tmpstatbuf.st_dev != PL_statbuf.st_dev ||
tmpstatbuf.st_ino != PL_statbuf.st_ino) {
(void)PerlIO_close(PL_rsfp);
diff --git a/contrib/perl5/perl.h b/contrib/perl5/perl.h
index 6a063b8..91e4643 100644
--- a/contrib/perl5/perl.h
+++ b/contrib/perl5/perl.h
@@ -361,6 +361,15 @@ register struct op *op asm(stringify(OP_IN_REGISTER));
# include <sys/param.h>
#endif
+/* needed for IAMSUID case for 4.4BSD systems
+ * XXX there should probably be a Configure variable
+ */
+
+#ifdef I_SYS_PARAM
+#if (defined (BSD) && (BSD >= 199306))
+# include <sys/mount.h>
+#endif /* !BSD */
+#endif /* !I_SYS_PARAM */
/* Use all the "standard" definitions? */
#if defined(STANDARD_C) && defined(I_STDLIB)
OpenPOWER on IntegriCloud