Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jun 2009 15:26:55 GMT
From:      Jonathan Anderson <jona@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 165406 for review
Message-ID:  <200906291526.n5TFQtov036224@repoman.freebsd.org>

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

Change 165406 by jona@jona-trustedbsd-belle-vmware on 2009/06/29 15:26:14

	Added ua_set(), fixed flag handling in ua_open()

Affected files ...

.. //depot/projects/trustedbsd/capabilities/src/lib/libuserangel/libuserangel.c#6 edit
.. //depot/projects/trustedbsd/capabilities/src/lib/libuserangel/libuserangel.h#6 edit

Differences ...

==== //depot/projects/trustedbsd/capabilities/src/lib/libuserangel/libuserangel.c#6 (text+ko) ====

@@ -150,6 +150,10 @@
 
 
 
+void ua_set(int fd) { angel = fd; }
+
+
+
 int ua_open(const char *path, int flags)
 {
 	if(angel < 0) angel = ua_find();
@@ -157,9 +161,9 @@
 
 	cap_rights_t rights = CAP_SEEK | CAP_FSYNC;
 
-	if((flags & O_RDONLY) || (flags & O_RDWR)) rights |= CAP_READ;
-	if((flags & O_WRONLY) || (flags & O_RDWR))
-		rights |= CAP_WRITE | CAP_FTRUNCATE;
+	if(flags & O_WRONLY) rights |= CAP_WRITE | CAP_FTRUNCATE;
+	else if(flags & O_RDWR) rights |= CAP_READ | CAP_WRITE | CAP_FTRUNCATE;
+	else rights |= CAP_READ;
 
 	if(flags & O_EXEC) rights |= CAP_FEXECVE;
 

==== //depot/projects/trustedbsd/capabilities/src/lib/libuserangel/libuserangel.h#6 (text+ko) ====

@@ -48,12 +48,15 @@
 /** The last angel/sandbox protocol error */
 const char* ua_protocol_error(void);
 
+/** Find the user angel (at $HOME/.user-angel or the like) */
+int ua_find(void);
+
+/** Set the user angel */
+void ua_set(int fd);
+
 /** Open a file via the User Angel */
 int ua_open(const char *path, int flags);
 
-/** Find the user angel (at $HOME/.user-angel or the like) */
-int ua_find(void);
-
 
 /* Low-level API */
 



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