Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 May 1997 10:50:55 +0200
From:      Ollivier Robert <roberto@keltia.freenix.fr>
To:        "FreeBSD's ports list" <ports@FreeBSD.ORG>
Subject:   Perl5 and the NOSUID flag
Message-ID:  <19970507105055.40536@keltia.freenix.fr>

next in thread | raw e-mail | index | archive | help
The following patch has been submitted to the Perl5 porters people but I'm
not sure it will make it into 5.004 (due to time constraints). It would be
nice to verify it can be applied to 5.003 (probably) and included in the
perl5 port.

It makes suidperl respect the NOSUID mout flag when executing setuid
scripts. A similar patch was committed to /usr/bin/perl a while ago.

--- perl.h.old	Tue May  6 12:22:21 1997
+++ perl.h	Tue May  6 12:26:50 1997
@@ -223,6 +223,15 @@
 #   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)
--- perl.c.old	Sun Apr 27 15:04:13 1997
+++ perl.c	Tue May  6 12:27:40 1997
@@ -1913,4 +1913,18 @@
 	    if (Stat(SvPVX(GvSV(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(rsfp),&stfs) < 0)
+                croak("Can't statfs filesystem of script \"%s\"",origfilename);
+
+            if (stfs.f_flags & MNT_NOSUID)
+                croak("Permission denied");
+        }
+#endif /* IAMSUID */
+#endif /* BSD */
+
 	    if (tmpstatbuf.st_dev != statbuf.st_dev ||
 		tmpstatbuf.st_ino != statbuf.st_ino) {

-- 
Ollivier ROBERT -=- FreeBSD: There are no limits -=- roberto@keltia.freenix.fr
FreeBSD keltia.freenix.fr 3.0-CURRENT #7: Sat Apr 26 17:13:26 CEST 1997



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970507105055.40536>