PERFORCE change 163968 for review

Jonathan Anderson jona at FreeBSD.org
Wed Jun 10 11:11:05 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=163968

Change 163968 by jona at jona-trustedbsd-belle-vm on 2009/06/10 11:10:53

	Added user_angel, a first attempt at the thing which will contain powerboxes (not very functional yet)

Affected files ...

.. //depot/projects/trustedbsd/capabilities/src/tools/cap/cap_exec/Makefile#3 edit
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/cap_exec/cap_exec.c#7 edit
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/cap_exec/main.c#2 edit
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/cap_exec/make-main.sh#2 edit
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/Makefile#1 add
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/cap.c#1 add
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/cap.h#1 add
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/fdcomm.c#1 add
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/fdcomm.h#1 add
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/protocol.c#1 add
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/protocol.h#1 add
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/server.c#1 add
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/server.h#1 add
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/test_client.c#1 add
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/user_angel.c#1 add
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/user_angel.h#1 add

Differences ...

==== //depot/projects/trustedbsd/capabilities/src/tools/cap/cap_exec/Makefile#3 (text+ko) ====


==== //depot/projects/trustedbsd/capabilities/src/tools/cap/cap_exec/cap_exec.c#7 (text+ko) ====

@@ -57,6 +57,7 @@
 #define LIBEDIT_SO	"libedit.so.6"
 #define	LIBNCURSES_SO	"libncurses.so.7"
 #define	LIBCRYPT_SO	"libcrypt.so.4"
+#define LIBUTIL_SO	"libutil.so.7"
 
 #define	LIBPATH	"/lib/"
 
@@ -98,7 +99,7 @@
 main(int argc, char *argv[])
 {
 	int fd_exec, fd_ldso, fd_procdesc;
-	int fd_libc, fd_libcrypt, fd_libedit, fd_libncurses;
+	int fd_libc, fd_libcrypt, fd_libedit, fd_libncurses, fd_libutil;
 	char *env_caplibindex;
 	struct pollfd pollfd;
 	pid_t pid;
@@ -137,12 +138,15 @@
 		    BIN_CAPS);
 		fd_libncurses = cap_open_limit(LIBPATH LIBNCURSES_SO,
 		    O_RDONLY, BIN_CAPS);
+		fd_libutil = cap_open_limit(LIBPATH LIBUTIL_SO,
+		    O_RDONLY, BIN_CAPS);
 
-		if (asprintf(&env_caplibindex, "%d:%s,%d:%s,%d:%s,%d:%s",
+		if (asprintf(&env_caplibindex, "%d:%s,%d:%s,%d:%s,%d:%s,%d:%s",
 		    fd_libc, LIBC_SO,
 		    fd_libcrypt, LIBCRYPT_SO,
 		    fd_libedit, LIBEDIT_SO,
-		    fd_libncurses, LIBNCURSES_SO
+		    fd_libncurses, LIBNCURSES_SO,
+		    fd_libutil, LIBUTIL_SO
 		    ) == -1)
 			err(-1, "asprintf");
 		setenv("LD_CAPLIBINDEX", env_caplibindex, 1);

==== //depot/projects/trustedbsd/capabilities/src/tools/cap/cap_exec/main.c#2 (text+ko) ====

@@ -1,10 +1,21 @@
+#include <sys/types.h>
+
+#include <errno.h>
 #include <stdio.h>
 
+
 int
 main(int argc, char *argv[])
 {
+	printf("pid %d main(%d, %p)\n", getpid(), argc, argv);
 
-	printf("pid %d main(%d, %p)\n", getpid(), argc, argv);
+	if(opendir("./") == NULL)
+		printf("Call to opendir() failed (good!) - errno %i (%s)\n",
+		       errno, strerror(errno));
+	else
+		fprintf(stderr, "Call to opendir() didn't fail!");
+
+	return 0;
 }
 
 int

==== //depot/projects/trustedbsd/capabilities/src/tools/cap/cap_exec/make-main.sh#2 (text+ko) ====

@@ -1,5 +1,6 @@
 #!/bin/sh
 
+gcc -o main main.c
 gcc -o main.dynamic main.c
 gcc -o main.so main.c -shared
 gcc -o main.static main.c -static


More information about the p4-projects mailing list