Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jul 2009 05:12:13 GMT
From:      Jonathan Anderson <jona@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 166428 for review
Message-ID:  <200907230512.n6N5CDZP062649@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=166428

Change 166428 by jona@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



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