diff options
author | 2021-11-29 15:42:14 -0500 | |
---|---|---|
committer | 2021-11-29 15:42:14 -0500 | |
commit | 1ad4d8f618d0cb7762d00ac8909542cecc5de2d0 (patch) | |
tree | 3e66dca3c1e17193d3148f51dbbd7c6325c5a66f /src | |
parent | disable by default several network tools (diff) | |
download | firejail-1ad4d8f618d0cb7762d00ac8909542cecc5de2d0.tar.gz firejail-1ad4d8f618d0cb7762d00ac8909542cecc5de2d0.tar.zst firejail-1ad4d8f618d0cb7762d00ac8909542cecc5de2d0.zip |
disable shell tab completion for --whitelist and --private commands
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/fs_home.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/firejail/fs_home.c b/src/firejail/fs_home.c index 230e9186c..4558934da 100644 --- a/src/firejail/fs_home.c +++ b/src/firejail/fs_home.c | |||
@@ -33,13 +33,35 @@ | |||
33 | #define O_PATH 010000000 | 33 | #define O_PATH 010000000 |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | static void disable_tab_completion(const char *homedir) { | ||
37 | char *fname; | ||
38 | |||
39 | if (asprintf(&fname, "%s/.inputrc", homedir) == -1) | ||
40 | errExit("asprintf"); | ||
41 | |||
42 | // don't create a new one if we already have it | ||
43 | if (access(fname, F_OK)) { | ||
44 | FILE *fp = fopen(fname, "w"); | ||
45 | if (!fp) | ||
46 | errExit("fopen"); | ||
47 | fprintf(fp, "set disable-completion on\n"); | ||
48 | fclose(fp); | ||
49 | if (chmod(fname, 0644)) | ||
50 | errExit("chmod"); | ||
51 | } | ||
52 | free(fname); | ||
53 | } | ||
54 | |||
55 | |||
36 | static void skel(const char *homedir) { | 56 | static void skel(const char *homedir) { |
37 | EUID_ASSERT(); | 57 | EUID_ASSERT(); |
58 | char *fname; | ||
59 | |||
60 | disable_tab_completion(homedir); | ||
38 | 61 | ||
39 | // zsh | 62 | // zsh |
40 | if (!arg_shell_none && (strcmp(cfg.shell,"/usr/bin/zsh") == 0 || strcmp(cfg.shell,"/bin/zsh") == 0)) { | 63 | if (!arg_shell_none && (strcmp(cfg.shell,"/usr/bin/zsh") == 0 || strcmp(cfg.shell,"/bin/zsh") == 0)) { |
41 | // copy skel files | 64 | // copy skel files |
42 | char *fname; | ||
43 | if (asprintf(&fname, "%s/.zshrc", homedir) == -1) | 65 | if (asprintf(&fname, "%s/.zshrc", homedir) == -1) |
44 | errExit("asprintf"); | 66 | errExit("asprintf"); |
45 | // don't copy it if we already have the file | 67 | // don't copy it if we already have the file |
@@ -64,7 +86,6 @@ static void skel(const char *homedir) { | |||
64 | // csh | 86 | // csh |
65 | else if (!arg_shell_none && strcmp(cfg.shell,"/bin/csh") == 0) { | 87 | else if (!arg_shell_none && strcmp(cfg.shell,"/bin/csh") == 0) { |
66 | // copy skel files | 88 | // copy skel files |
67 | char *fname; | ||
68 | if (asprintf(&fname, "%s/.cshrc", homedir) == -1) | 89 | if (asprintf(&fname, "%s/.cshrc", homedir) == -1) |
69 | errExit("asprintf"); | 90 | errExit("asprintf"); |
70 | // don't copy it if we already have the file | 91 | // don't copy it if we already have the file |
@@ -89,7 +110,6 @@ static void skel(const char *homedir) { | |||
89 | // bash etc. | 110 | // bash etc. |
90 | else { | 111 | else { |
91 | // copy skel files | 112 | // copy skel files |
92 | char *fname; | ||
93 | if (asprintf(&fname, "%s/.bashrc", homedir) == -1) | 113 | if (asprintf(&fname, "%s/.bashrc", homedir) == -1) |
94 | errExit("asprintf"); | 114 | errExit("asprintf"); |
95 | // don't copy it if we already have the file | 115 | // don't copy it if we already have the file |