diff options
author | 2017-10-22 09:05:16 -0400 | |
---|---|---|
committer | 2017-10-22 09:05:16 -0400 | |
commit | e3c6d04d273550b8a67afd3d8d6d6e1c6fe9edfa (patch) | |
tree | 817191d2bb55ed9dc7cea9a4c1148e291692260c | |
parent | add /usr/share whitelisting support in --build (diff) | |
download | firejail-e3c6d04d273550b8a67afd3d8d6d6e1c6fe9edfa.tar.gz firejail-e3c6d04d273550b8a67afd3d8d6d6e1c6fe9edfa.tar.zst firejail-e3c6d04d273550b8a67afd3d8d6d6e1c6fe9edfa.zip |
--build fixes
-rw-r--r-- | src/fbuilder/build_bin.c | 3 | ||||
-rw-r--r-- | src/fbuilder/build_fs.c | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/fbuilder/build_bin.c b/src/fbuilder/build_bin.c index 31b6ba8e8..6c173bfcc 100644 --- a/src/fbuilder/build_bin.c +++ b/src/fbuilder/build_bin.c | |||
@@ -114,12 +114,13 @@ void build_bin(const char *fname) { | |||
114 | } | 114 | } |
115 | 115 | ||
116 | if (bin_out) { | 116 | if (bin_out) { |
117 | printf("# private-bin "); | 117 | printf("private-bin "); |
118 | FileDB *ptr = bin_out; | 118 | FileDB *ptr = bin_out; |
119 | while (ptr) { | 119 | while (ptr) { |
120 | printf("%s,", ptr->fname); | 120 | printf("%s,", ptr->fname); |
121 | ptr = ptr->next; | 121 | ptr = ptr->next; |
122 | } | 122 | } |
123 | printf("\n"); | 123 | printf("\n"); |
124 | printf("# private-lib\n"); | ||
124 | } | 125 | } |
125 | } | 126 | } |
diff --git a/src/fbuilder/build_fs.c b/src/fbuilder/build_fs.c index 5e63c241a..01104edb1 100644 --- a/src/fbuilder/build_fs.c +++ b/src/fbuilder/build_fs.c | |||
@@ -178,16 +178,22 @@ void build_var(const char *fname) { | |||
178 | static FileDB *share_out = NULL; | 178 | static FileDB *share_out = NULL; |
179 | static void share_callback(char *ptr) { | 179 | static void share_callback(char *ptr) { |
180 | // extract the directory: | 180 | // extract the directory: |
181 | // "/usr/share/bash-completion/bash_completion" becomes "/usr/share/bash-completion" | ||
182 | assert(strncmp(ptr, "/usr/share", 10) == 0); | 181 | assert(strncmp(ptr, "/usr/share", 10) == 0); |
183 | char *p1 = ptr + 10; | 182 | char *p1 = ptr + 10; |
184 | if (*p1 != '/') | 183 | if (*p1 != '/') |
185 | return; | 184 | return; |
186 | p1++; | 185 | p1++; |
186 | if (*p1 == '/') // double '/' | ||
187 | p1++; | ||
188 | if (*p1 == '\0') | ||
189 | return; | ||
190 | |||
191 | // "/usr/share/bash-completion/bash_completion" becomes "/usr/share/bash-completion" | ||
187 | char *p2 = strchr(p1, '/'); | 192 | char *p2 = strchr(p1, '/'); |
188 | if (p2) | 193 | if (p2) |
189 | *p2 = '\0'; | 194 | *p2 = '\0'; |
190 | 195 | ||
196 | // store the file | ||
191 | share_out = filedb_add(share_out, ptr); | 197 | share_out = filedb_add(share_out, ptr); |
192 | } | 198 | } |
193 | 199 | ||