PERFORCE change 166444 for review
Jonathan Anderson
jona at FreeBSD.org
Thu Jul 23 14:08:01 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=166444
Change 166444 by jona at jona-trustedbsd-belle-vmware on 2009/07/23 14:07:50
Stub of a policy implementation
Affected files ...
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/policy.c#2 edit
Differences ...
==== //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/policy.c#2 (text+ko) ====
@@ -46,15 +46,39 @@
#include <sysexits.h>
#include <unistd.h>
+#include <libuserangel.h>
+
#include "policy.h"
+#include "server.h" /* TODO: tmp */
int default_policy(struct client* client, enum ua_request_t req, struct ua_datum* d)
{
-// fprintf(stderr, "\n\nUnhandled policy request type %i\n\n", req);
+ switch(req)
+ {
+ case UA_NO_OP: return 1;
+
+ case UA_CHECK_ACCESS:
+ case UA_STAT:
+ case UA_OPEN_PATH:
+ {
+ unsigned int len = d->length + 1;
+ char path[len];
+
+ if(ua_unmarshall_string(d, path, &len) < 0)
+ return -1;
+ }
+
+ return 1;
+
+ case UA_LOAD_LIBRARY:
+ case UA_POWERBOX:
- return 0; // the default is to reject all requests
+ default:
+ fprintf(stderr, "Unhandled policy request type %i\n", req);
+ return 0;
+ }
}
More information about the p4-projects
mailing list