aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@protonmail.com>2022-02-20 08:05:33 -0500
committerLibravatar netblue30 <netblue30@protonmail.com>2022-02-20 08:05:33 -0500
commite6c50240f9f2033a896df5a06c6fc7c1529d5442 (patch)
tree6bb24b2a55641caa80d5c69ade958b1e0b5ee59b /src
parentMerge pull request #4948 from crocket/master (diff)
downloadfirejail-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.h1
-rw-r--r--src/firejail/fs_home.c4
-rw-r--r--src/firejail/main.c3
-rw-r--r--src/firejail/profile.c4
-rw-r--r--src/firejail/usage.c2
-rw-r--r--src/man/firejail.txt7
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
365extern int arg_dbus_log_user; 365extern int arg_dbus_log_user;
366extern int arg_dbus_log_system; 366extern int arg_dbus_log_system;
367extern const char *arg_dbus_log_file; 367extern const char *arg_dbus_log_file;
368extern int arg_tab;
368 369
369extern int login_shell; 370extern int login_shell;
370extern int parent_to_child_fds[2]; 371extern 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
36static void disable_tab_completion(const char *homedir) { 36static 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
155const char *arg_dbus_log_file = NULL; 155const char *arg_dbus_log_file = NULL;
156int arg_dbus_log_user = 0; 156int arg_dbus_log_user = 0;
157int arg_dbus_log_system = 0; 157int arg_dbus_log_system = 0;
158int arg_tab = 0;
158int login_shell = 0; 159int login_shell = 0;
159 160
160int parent_to_child_fds[2]; 161int 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
2687Enable 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
2687Kill the sandbox automatically after the time has elapsed. The time is specified in hours/minutes/seconds format. 2694Kill the sandbox automatically after the time has elapsed. The time is specified in hours/minutes/seconds format.
2688.br 2695.br