aboutsummaryrefslogtreecommitdiffstats
path: root/src/firejail/x11.c
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2017-07-19 09:00:16 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2017-07-19 09:00:16 -0400
commit812db2a6f45d3c4ba4a3c5a9716e653d25c52f7a (patch)
treeaae653e85d488f490bf99da9dcdd0f4f79e80491 /src/firejail/x11.c
parentxvfb fixes (diff)
downloadfirejail-812db2a6f45d3c4ba4a3c5a9716e653d25c52f7a.tar.gz
firejail-812db2a6f45d3c4ba4a3c5a9716e653d25c52f7a.tar.zst
firejail-812db2a6f45d3c4ba4a3c5a9716e653d25c52f7a.zip
support for Xephyr screen size
Diffstat (limited to 'src/firejail/x11.c')
-rw-r--r--src/firejail/x11.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/firejail/x11.c b/src/firejail/x11.c
index 2e2e3dff2..c6bb7e1e3 100644
--- a/src/firejail/x11.c
+++ b/src/firejail/x11.c
@@ -398,6 +398,27 @@ void x11_start_xvfb(int argc, char **argv) {
398} 398}
399 399
400 400
401
402static char *extract_setting(int argc, char **argv, const char *argument) {
403 int i;
404 int len = strlen(argument);
405
406 for (i = 1; i < argc; i++) {
407 if (strncmp(argv[i], argument, len) == 0) {
408 return argv[i] + len;
409 }
410
411 // detect end of firejail params
412 if (strcmp(argv[i], "--") == 0)
413 break;
414 if (strncmp(argv[i], "--", 2) != 0)
415 break;
416 }
417
418 return NULL;
419}
420
421
401//$ Xephyr -ac -br -noreset -screen 800x600 :22 & 422//$ Xephyr -ac -br -noreset -screen 800x600 :22 &
402//$ DISPLAY=:22 firejail --net=eth0 --blacklist=/tmp/.X11-unix/x0 firefox 423//$ DISPLAY=:22 firejail --net=eth0 --blacklist=/tmp/.X11-unix/x0 firefox
403void x11_start_xephyr(int argc, char **argv) { 424void x11_start_xephyr(int argc, char **argv) {
@@ -407,6 +428,11 @@ void x11_start_xephyr(int argc, char **argv) {
407 pid_t jail = 0; 428 pid_t jail = 0;
408 pid_t server = 0; 429 pid_t server = 0;
409 430
431 // default xephyr screen can be overwriten by a --xephyr-screen= command line option
432 char *newscreen = extract_setting(argc, argv, "--xephyr-screen=");
433 if (newscreen)
434 xephyr_screen = newscreen;
435
410 setenv("FIREJAIL_X11", "yes", 1); 436 setenv("FIREJAIL_X11", "yes", 1);
411 437
412 // unfortunately, xephyr does a number of weird things when started by root user!!! 438 // unfortunately, xephyr does a number of weird things when started by root user!!!