PERFORCE change 166428 for review

Jonathan Anderson jona at FreeBSD.org
Thu Jul 23 05:12:15 UTC 2009


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

Change 166428 by jona at jona-trustedbsd-belle-vmware on 2009/07/23 05:11:18

	Let fo_ioctl() unwrap capabilities if required

Affected files ...

.. //depot/projects/trustedbsd/capabilities/src/sys/sys/file.h#13 edit

Differences ...

==== //depot/projects/trustedbsd/capabilities/src/sys/sys/file.h#13 (text+ko) ====

@@ -44,6 +44,10 @@
 #include <sys/_lock.h>
 #include <sys/_mutex.h>
 
+#ifdef CAPABILITIES
+#include <sys/capability.h>
+#endif /* CAPABILITIES */
+
 struct stat;
 struct thread;
 struct uio;
@@ -272,8 +276,20 @@
 	struct ucred *active_cred;
 	struct thread *td;
 {
+	struct file *p = fp;
+
+#ifdef CAPABILITIES
+	int error;
+
+	if (fp->f_type == DTYPE_CAPABILITY)
+	{
+		error = cap_fextract(fp, CAP_IOCTL, &p);
+		if (error)
+			return error;
+	}
+#endif /* CAPABILITIES */
 
-	return ((*fp->f_ops->fo_ioctl)(fp, com, data, active_cred, td));
+	return ((*p->f_ops->fo_ioctl)(p, com, data, active_cred, td));
 }
 
 static __inline int


More information about the p4-projects mailing list