PERFORCE change 166608 for review
Jonathan Anderson
jona at FreeBSD.org
Mon Jul 27 11:27:10 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=166608
Change 166608 by jona at jona-trustedbsd-belle-vmware on 2009/07/27 11:26:10
Added a little text editor
Affected files ...
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/sandbox_qt/TextEditor.cpp#1 add
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/sandbox_qt/TextEditor.h#1 add
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/sandbox_qt/TextEditor.qrc#1 add
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/sandbox_qt/sandbox_qt.cpp#7 edit
.. //depot/projects/trustedbsd/capabilities/src/tools/cap/sandbox_qt/sandbox_qt.pro#4 edit
Differences ...
==== //depot/projects/trustedbsd/capabilities/src/tools/cap/sandbox_qt/sandbox_qt.cpp#7 (text+ko) ====
@@ -59,6 +59,8 @@
#include <libcapability.h>
#include <libuserangel.h>
+#include <iostream>
+
#include <QApplication>
#include <QFile>
#include <QMessageBox>
@@ -67,7 +69,8 @@
#include <X11/Xauth.h>
#include <xcb/xcb.h>
-#include <iostream>
+#include "TextEditor.h"
+
using namespace std;
@@ -245,7 +248,7 @@
printf("\n");
printf("======================================\n");
fflush(stdout);
- sleep(1);
+
QMessageBox::information(NULL, "Host", "This is on the host");
return 0;
@@ -254,10 +257,11 @@
extern "C" int cap_main(int argc, char *argv[])
{
+ sleep(1);
+
printf("sandbox:\tIn sandbox: %i\n", ld_insandbox());
fflush(stdout);
-
printf("sandbox:\tOpening /etc/passwd directly... ");
fflush(stdout);
@@ -371,13 +375,7 @@
- // start QApplication
- printf("sandbox:\tCreating QApplication...\n");
- fflush(stdout);
- QApplication app(argc, argv);
- 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");
@@ -407,20 +405,29 @@
if(!group.open(QIODevice::ReadOnly | QIODevice::Text))
err(EX_IOERR, "Error opening /etc/group");
+ printf("\t\tsize: %lli\n", group.size());
printf("\t\t%s\n", group.readLine().data());
fflush(stdout);
-
+
+
- printf("sandbox:\tDisplaying message box...\n");
+ // start QApplication
+ printf("sandbox:\tCreating QApplication...\n");
fflush(stdout);
- QMessageBox::information(NULL, "Sandbox", "This is sandboxed");
- printf("sandbox:\tMessage box closed\n");
- fflush(stdout);
+ QApplication app(argc, argv);
+ printf("sandbox:\tQApplication started.\n");
+
+
+ // display a proper window
+ new TextEditor();
+ int ret = app.exec();
+ printf("sandbox:\tQApplication::exec() returned with code %i\n", ret);
+ fflush(stdout);
- return 0;
+ return ret;
}
==== //depot/projects/trustedbsd/capabilities/src/tools/cap/sandbox_qt/sandbox_qt.pro#4 (text+ko) ====
@@ -9,5 +9,7 @@
QMAKE_LFLAGS += -rdynamic
# Input
-SOURCES += sandbox_qt.cpp xcb_auth.c
+HEADERS = TextEditor.h
+SOURCES = sandbox_qt.cpp TextEditor.cpp xcb_auth.c
+RESOURCES = TextEditor.qrc
More information about the p4-projects
mailing list