Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Feb 1996 15:03:24 +0100
From:      Wolfram Schneider <wosch@cs.tu-berlin.de>
To:        security@freebsd.org
Subject:   chown(2) patch
Message-ID:  <199602071403.PAA15972@gundula.cs.tu-berlin.de>

next in thread | raw e-mail | index | archive | help

from bug reports [1995/08/13] kern/679 chown(2) ignores set-user-id
and set-group-id bits for user root

--- 1.1	1995/09/05 22:12:59
+++ ufs_vnops.c	1996/02/04 22:43:42
@@ -546,10 +546,24 @@
 #endif /* QUOTA */
 	if (ouid != uid || ogid != gid)
 		ip->i_flag |= IN_CHANGE;
+
+#ifdef COMPAT_CHOWN
+	/* clear suid/sgid flag for non-root files */
 	if (ouid != uid && cred->cr_uid != 0)
 		ip->i_mode &= ~ISUID;
 	if (ogid != gid && cred->cr_uid != 0)
 		ip->i_mode &= ~ISGID;
+#else
+	/* 
+	 * always clear suid/sgid flags, 
+	 * also for root like manpage claims 
+	 */
+
+	if (ouid != uid)
+		ip->i_mode &= ~ISUID;
+	if (ogid != gid)
+		ip->i_mode &= ~ISGID;
+#endif /* !COMPAT_COMPAT */
 	return (0);
 }
 



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