PERFORCE change 147154 for review

Edward Tomasz Napierala trasz at FreeBSD.org
Mon Aug 11 14:52:57 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=147154

Change 147154 by trasz at trasz_traszkan on 2008/08/11 14:52:02

	Deny setting setuid if we have ACL_WRITE_ACL, but are not the file owner.

Affected files ...

.. //depot/projects/soc2008/trasz_nfs4acl/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c#2 edit
.. //depot/projects/soc2008/trasz_nfs4acl/sys/ufs/ufs/ufs_vnops.c#10 edit

Differences ...

==== //depot/projects/soc2008/trasz_nfs4acl/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c#2 (text+ko) ====

@@ -257,5 +257,11 @@
 		if (error)
 			return (error);
 	}
+	/*
+	 * Deny setting setuid if we are not the file owner.
+	 */
+	if ((vap->va_mode & S_ISUID) && ovap->va_uid != cred->cr_uid)
+		return (EPERM);
+
 	return (0);
 }

==== //depot/projects/soc2008/trasz_nfs4acl/sys/ufs/ufs/ufs_vnops.c#10 (text+ko) ====

@@ -717,6 +717,13 @@
 		if (error)
 			return (error);
 	}
+
+	/*
+	 * Deny setting setuid if we are not the file owner.
+	 */
+	if ((mode & ISUID) && ip->i_uid != cred->cr_uid)
+		return (EPERM);
+
 	ip->i_mode &= ~ALLPERMS;
 	ip->i_mode |= (mode & ALLPERMS);
 	DIP_SET(ip, i_mode, ip->i_mode);


More information about the p4-projects mailing list