diff options
author | netblue30 <netblue30@yahoo.com> | 2016-08-14 20:19:02 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-14 20:19:02 -0400 |
commit | 61be14f1af27af00351f3768fc04b0d4936439b4 (patch) | |
tree | aedde22a9336d3dd6f0f9512f28f8bbd6994cfe2 | |
parent | Merge pull request #713 from i-MSCP/master (diff) | |
parent | Fixes remaining issues related to #704 (diff) | |
download | firejail-61be14f1af27af00351f3768fc04b0d4936439b4.tar.gz firejail-61be14f1af27af00351f3768fc04b0d4936439b4.tar.zst firejail-61be14f1af27af00351f3768fc04b0d4936439b4.zip |
Merge pull request #714 from i-MSCP/master
Fixes remaining issues related to #704
-rw-r--r-- | src/firejail/sandbox.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c index 3e8b5f934..6b3d5ea89 100644 --- a/src/firejail/sandbox.c +++ b/src/firejail/sandbox.c | |||
@@ -326,22 +326,26 @@ static void start_application(void) { | |||
326 | //**************************************** | 326 | //**************************************** |
327 | else { | 327 | else { |
328 | assert(cfg.shell); | 328 | assert(cfg.shell); |
329 | assert(cfg.command_line); | ||
329 | 330 | ||
330 | char *arg[6]; | 331 | char *arg[5]; |
331 | int index = 0; | 332 | int index = 0; |
332 | arg[index++] = cfg.shell; | 333 | arg[index++] = cfg.shell; |
333 | if (login_shell) | 334 | if (login_shell && cfg.shell == cfg.command_line) { |
334 | arg[index++] = "-l"; | 335 | arg[index++] = "-l"; |
335 | arg[index++] = "-c"; | 336 | if (arg_debug) |
336 | assert(cfg.command_line); | 337 | printf("Starting %s login shell\n", cfg.shell); |
337 | if (arg_debug) | 338 | } else { |
338 | printf("Starting %s\n", cfg.command_line); | 339 | arg[index++] = "-c"; |
339 | if (arg_doubledash) | 340 | if (arg_debug) |
340 | arg[index++] = "--"; | 341 | printf("Running %s command through %s\n", cfg.command_line, cfg.shell); |
341 | arg[index++] = cfg.command_line; | 342 | if (arg_doubledash) |
343 | arg[index++] = "--"; | ||
344 | arg[index++] = cfg.command_line; | ||
345 | } | ||
342 | arg[index] = NULL; | 346 | arg[index] = NULL; |
343 | assert(index < 5); | 347 | assert(index < 5); |
344 | 348 | ||
345 | if (arg_debug) { | 349 | if (arg_debug) { |
346 | char *msg; | 350 | char *msg; |
347 | if (asprintf(&msg, "sandbox %d, execvp into %s", sandbox_pid, cfg.command_line) == -1) | 351 | if (asprintf(&msg, "sandbox %d, execvp into %s", sandbox_pid, cfg.command_line) == -1) |
@@ -349,7 +353,7 @@ static void start_application(void) { | |||
349 | logmsg(msg); | 353 | logmsg(msg); |
350 | free(msg); | 354 | free(msg); |
351 | } | 355 | } |
352 | 356 | ||
353 | if (arg_debug) { | 357 | if (arg_debug) { |
354 | int i; | 358 | int i; |
355 | for (i = 0; i < 5; i++) { | 359 | for (i = 0; i < 5; i++) { |
@@ -358,12 +362,12 @@ static void start_application(void) { | |||
358 | printf("execvp argument %d: %s\n", i, arg[i]); | 362 | printf("execvp argument %d: %s\n", i, arg[i]); |
359 | } | 363 | } |
360 | } | 364 | } |
361 | 365 | ||
362 | if (!arg_command && !arg_quiet) | 366 | if (!arg_command && !arg_quiet) |
363 | printf("Child process initialized\n"); | 367 | printf("Child process initialized\n"); |
364 | execvp(arg[0], arg); | 368 | execvp(arg[0], arg); |
365 | } | 369 | } |
366 | 370 | ||
367 | perror("execvp"); | 371 | perror("execvp"); |
368 | exit(1); // it should never get here!!! | 372 | exit(1); // it should never get here!!! |
369 | } | 373 | } |