PERFORCE change 165406 for review
Jonathan Anderson
jona at FreeBSD.org
Mon Jun 29 15:26:57 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=165406
Change 165406 by jona at 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 */
More information about the p4-projects
mailing list