Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jul 2009 14:07:59 GMT
From:      Jonathan Anderson <jona@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 166444 for review
Message-ID:  <200907231407.n6NE7xfV030125@repoman.freebsd.org>

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

Change 166444 by jona@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;
+	}
 }
 
 



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