PERFORCE change 166448 for review
Jonathan Anderson
jona at FreeBSD.org
Thu Jul 23 14:24:19 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=166448
Change 166448 by jona at jona-trustedbsd-belle-vmware on 2009/07/23 14:24:02
Re-ordered in-sandbox tests
Affected files ...
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/sandbox_qt/sandbox_qt.cpp#5 edit
Differences ...
==== //depot/projects/trustedbsd/capabilities/src/tools/cap/sandbox_qt/sandbox_qt.cpp#5 (text+ko) ====
@@ -264,6 +264,8 @@
printf("sandbox:\tIn sandbox: %i\n", ld_insandbox());
fflush(stdout);
+
+ // get a file descriptor for our host
struct lc_host *lchpp;
if(lcs_get(&lchpp) < 0) err(EX_IOERR, "Error getting lc_host");
@@ -273,6 +275,8 @@
fflush(stdout);
+
+ // find the User Angel
int32_t angel = -1;
uint32_t angellen = 1;
struct ua_datum *d = ua_recv(host, &angel, &angellen);
@@ -293,7 +297,7 @@
- // first test X stuff (inc. starting the QApplication)
+ // receive X file descriptor, Xauth data
int32_t Xfd = -1;
uint32_t Xfdlen = 1;
d = ua_recv(host, &Xfd, &Xfdlen);
@@ -313,6 +317,13 @@
printf("sandbox:\tX at FD %i\n", Xfd);
fflush(stdout);
+ char display[20];
+ sprintf(display, "fd://cap:%i", Xfd);
+ setenv("DISPLAY", display, 1);
+ printf("sandbox:\tset DISPLAY to %s\n", getenv("DISPLAY"));
+ fflush(stdout);
+
+
d = ua_recv(host, NULL, 0);
if(!d)
{
@@ -345,34 +356,23 @@
printf("\n");
fflush(stdout);
-
xcb_auth_info_t xauthinfo;
xauthinfo.namelen = xauthnamelen;
xauthinfo.name = xauthname;
xauthinfo.datalen = xauthdatalen;
xauthinfo.data = xauthdata;
-
xcb_auth_cache(&xauthinfo);
- char display[20];
- sprintf(display, "fd://cap:%i", Xfd);
- setenv("DISPLAY", display, 1);
- printf("sandbox:\tset DISPLAY to %s\n", getenv("DISPLAY"));
- fflush(stdout);
+ // start QApplication
printf("sandbox:\tCreating QApplication...\n");
fflush(stdout);
QApplication app(argc, argv);
- printf("sandbox:\tQApplication started, displaying message box...\n");
- fflush(stdout);
- QMessageBox::information(NULL, "Sandbox", "This is sandboxed");
- printf("sandbox:\tMessage box closed\n");
- fflush(stdout);
+ printf("sandbox:\tQApplication started.\n");
-
// now test file opening
int fd = ua_open("/etc/passwd", O_RDONLY);
if(fd < 0) err(EX_IOERR, "Error opening passwd via angel");
@@ -405,6 +405,16 @@
printf("Filename: %s\n", group.fileName().toStdString().c_str());
printf("Data: %s\n", group.readLine().data());
fflush(stdout);
+
+
+
+ printf("sandbox:\tDisplaying message box...\n");
+ fflush(stdout);
+ QMessageBox::information(NULL, "Sandbox", "This is sandboxed");
+ printf("sandbox:\tMessage box closed\n");
+ fflush(stdout);
+
+
return 0;
}
More information about the p4-projects
mailing list