diff options
author | netblue30 <netblue30@protonmail.com> | 2022-02-20 08:05:33 -0500 |
---|---|---|
committer | netblue30 <netblue30@protonmail.com> | 2022-02-20 08:05:33 -0500 |
commit | e6c50240f9f2033a896df5a06c6fc7c1529d5442 (patch) | |
tree | 6bb24b2a55641caa80d5c69ade958b1e0b5ee59b /src | |
parent | Merge pull request #4948 from crocket/master (diff) | |
download | firejail-e6c50240f9f2033a896df5a06c6fc7c1529d5442.tar.gz firejail-e6c50240f9f2033a896df5a06c6fc7c1529d5442.tar.zst firejail-e6c50240f9f2033a896df5a06c6fc7c1529d5442.zip |
--tab: enable shell tab completion
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/firejail.h | 1 | ||||
-rw-r--r-- | src/firejail/fs_home.c | 4 | ||||
-rw-r--r-- | src/firejail/main.c | 3 | ||||
-rw-r--r-- | src/firejail/profile.c | 4 | ||||
-rw-r--r-- | src/firejail/usage.c | 2 | ||||
-rw-r--r-- | src/man/firejail.txt | 7 |
6 files changed, 20 insertions, 1 deletions
diff --git a/src/firejail/firejail.h b/src/firejail/firejail.h index f1fa66707..316518534 100644 --- a/src/firejail/firejail.h +++ b/src/firejail/firejail.h | |||
@@ -365,6 +365,7 @@ extern DbusPolicy arg_dbus_system; // --dbus-system | |||
365 | extern int arg_dbus_log_user; | 365 | extern int arg_dbus_log_user; |
366 | extern int arg_dbus_log_system; | 366 | extern int arg_dbus_log_system; |
367 | extern const char *arg_dbus_log_file; | 367 | extern const char *arg_dbus_log_file; |
368 | extern int arg_tab; | ||
368 | 369 | ||
369 | extern int login_shell; | 370 | extern int login_shell; |
370 | extern int parent_to_child_fds[2]; | 371 | extern int parent_to_child_fds[2]; |
diff --git a/src/firejail/fs_home.c b/src/firejail/fs_home.c index 6a554dc89..061461590 100644 --- a/src/firejail/fs_home.c +++ b/src/firejail/fs_home.c | |||
@@ -34,8 +34,10 @@ | |||
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | static void disable_tab_completion(const char *homedir) { | 36 | static void disable_tab_completion(const char *homedir) { |
37 | char *fname; | 37 | if (arg_tab) |
38 | return; | ||
38 | 39 | ||
40 | char *fname; | ||
39 | if (asprintf(&fname, "%s/.inputrc", homedir) == -1) | 41 | if (asprintf(&fname, "%s/.inputrc", homedir) == -1) |
40 | errExit("asprintf"); | 42 | errExit("asprintf"); |
41 | 43 | ||
diff --git a/src/firejail/main.c b/src/firejail/main.c index d614ae1ac..4b01ea0a5 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c | |||
@@ -155,6 +155,7 @@ DbusPolicy arg_dbus_system = DBUS_POLICY_ALLOW; // --dbus-system | |||
155 | const char *arg_dbus_log_file = NULL; | 155 | const char *arg_dbus_log_file = NULL; |
156 | int arg_dbus_log_user = 0; | 156 | int arg_dbus_log_user = 0; |
157 | int arg_dbus_log_system = 0; | 157 | int arg_dbus_log_system = 0; |
158 | int arg_tab = 0; | ||
158 | int login_shell = 0; | 159 | int login_shell = 0; |
159 | 160 | ||
160 | int parent_to_child_fds[2]; | 161 | int parent_to_child_fds[2]; |
@@ -2798,6 +2799,8 @@ int main(int argc, char **argv, char **envp) { | |||
2798 | else if (strcmp(argv[i], "--deterministic-shutdown") == 0) { | 2799 | else if (strcmp(argv[i], "--deterministic-shutdown") == 0) { |
2799 | arg_deterministic_shutdown = 1; | 2800 | arg_deterministic_shutdown = 1; |
2800 | } | 2801 | } |
2802 | else if (strcmp(argv[i], "--tab") == 0) | ||
2803 | arg_tab = 1; | ||
2801 | else { | 2804 | else { |
2802 | // double dash - positional params to follow | 2805 | // double dash - positional params to follow |
2803 | if (strcmp(argv[i], "--") == 0) { | 2806 | if (strcmp(argv[i], "--") == 0) { |
diff --git a/src/firejail/profile.c b/src/firejail/profile.c index 794668dc6..0b258e6bb 100644 --- a/src/firejail/profile.c +++ b/src/firejail/profile.c | |||
@@ -389,6 +389,10 @@ int profile_check_line(char *ptr, int lineno, const char *fname) { | |||
389 | #endif | 389 | #endif |
390 | return 0; | 390 | return 0; |
391 | } | 391 | } |
392 | else if (strcmp(ptr, "tab") == 0) { | ||
393 | arg_tab = 1; | ||
394 | return 0; | ||
395 | } | ||
392 | else if (strcmp(ptr, "private-cwd") == 0) { | 396 | else if (strcmp(ptr, "private-cwd") == 0) { |
393 | cfg.cwd = NULL; | 397 | cfg.cwd = NULL; |
394 | arg_private_cwd = 1; | 398 | arg_private_cwd = 1; |
diff --git a/src/firejail/usage.c b/src/firejail/usage.c index 0b24467be..2dd913b5e 100644 --- a/src/firejail/usage.c +++ b/src/firejail/usage.c | |||
@@ -245,6 +245,8 @@ static char *usage_str = | |||
245 | " --shell=none - run the program directly without a user shell.\n" | 245 | " --shell=none - run the program directly without a user shell.\n" |
246 | " --shell=program - set default user shell.\n" | 246 | " --shell=program - set default user shell.\n" |
247 | " --shutdown=name|pid - shutdown the sandbox identified by name or PID.\n" | 247 | " --shutdown=name|pid - shutdown the sandbox identified by name or PID.\n" |
248 | " --tab - enable shell tab completion in sandboxes using private or\n" | ||
249 | "\twhitelisted home directories.\n" | ||
248 | " --timeout=hh:mm:ss - kill the sandbox automatically after the time\n" | 250 | " --timeout=hh:mm:ss - kill the sandbox automatically after the time\n" |
249 | "\thas elapsed.\n" | 251 | "\thas elapsed.\n" |
250 | " --tmpfs=dirname - mount a tmpfs filesystem on directory dirname.\n" | 252 | " --tmpfs=dirname - mount a tmpfs filesystem on directory dirname.\n" |
diff --git a/src/man/firejail.txt b/src/man/firejail.txt index 4cbe7f13d..a3dfb14ac 100644 --- a/src/man/firejail.txt +++ b/src/man/firejail.txt | |||
@@ -2683,6 +2683,13 @@ $ firejail \-\-list | |||
2683 | .br | 2683 | .br |
2684 | $ firejail \-\-shutdown=3272 | 2684 | $ firejail \-\-shutdown=3272 |
2685 | .TP | 2685 | .TP |
2686 | \fB\-\-tab | ||
2687 | Enable bash completion in sandboxes using private or whitelisted home directories. | ||
2688 | .br | ||
2689 | |||
2690 | .br | ||
2691 | $ firejail \-\-private --tab | ||
2692 | .TP | ||
2686 | \fB\-\-timeout=hh:mm:ss | 2693 | \fB\-\-timeout=hh:mm:ss |
2687 | Kill the sandbox automatically after the time has elapsed. The time is specified in hours/minutes/seconds format. | 2694 | Kill the sandbox automatically after the time has elapsed. The time is specified in hours/minutes/seconds format. |
2688 | .br | 2695 | .br |