aboutsummaryrefslogtreecommitdiffstats
path: root/src/firecfg
diff options
context:
space:
mode:
authorLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2024-01-08 10:05:43 -0300
committerLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2024-01-11 09:12:46 -0300
commita9c851ee486bbc0c071187c7869c480c893c67a4 (patch)
tree0a44ba64969b49597f67fc8d1aff5d4fdd5ce4e9 /src/firecfg
parentfirecfg: use filename var earlier (diff)
downloadfirejail-a9c851ee486bbc0c071187c7869c480c893c67a4.tar.gz
firejail-a9c851ee486bbc0c071187c7869c480c893c67a4.tar.zst
firejail-a9c851ee486bbc0c071187c7869c480c893c67a4.zip
firecfg: use ignorelist also for .desktop files
Closes #5245. Relates to #5876.
Diffstat (limited to 'src/firecfg')
-rw-r--r--src/firecfg/desktop_files.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/firecfg/desktop_files.c b/src/firecfg/desktop_files.c
index 5ed15c02b..8bd54d3e9 100644
--- a/src/firecfg/desktop_files.c
+++ b/src/firecfg/desktop_files.c
@@ -118,6 +118,9 @@ void fix_desktop_files(const char *homedir) {
118 exit(1); 118 exit(1);
119 } 119 }
120 120
121 // build ignorelist
122 parse_config_all(0);
123
121 // destination 124 // destination
122 // create ~/.local/share/applications directory if necessary 125 // create ~/.local/share/applications directory if necessary
123 char *user_apps_dir; 126 char *user_apps_dir;
@@ -173,8 +176,25 @@ void fix_desktop_files(const char *homedir) {
173 continue; 176 continue;
174 177
175 // skip if not .desktop file 178 // skip if not .desktop file
176 if (strstr(filename, ".desktop") != (filename + strlen(filename) - 8)) 179 char *exec = strdup(filename);
180 if (!exec)
181 errExit("strdup");
182 char *ptr = strstr(exec, ".desktop");
183 if (ptr == NULL || *(ptr + 8) != '\0') {
184 printf(" %s skipped (not a .desktop file)\n", exec);
185 free(exec);
186 continue;
187 }
188
189 // skip if program is in ignorelist
190 *ptr = '\0';
191 if (in_ignorelist(exec)) {
192 printf(" %s ignored\n", exec);
193 free(exec);
177 continue; 194 continue;
195 }
196
197 free(exec);
178 198
179 // skip links - Discord on Arch #4235 seems to be a symlink to /opt directory 199 // skip links - Discord on Arch #4235 seems to be a symlink to /opt directory
180// if (is_link(filename)) 200// if (is_link(filename))
@@ -220,7 +240,7 @@ void fix_desktop_files(const char *homedir) {
220 } 240 }
221 241
222 // get executable name 242 // get executable name
223 char *ptr = strstr(buf,"\nExec="); 243 ptr = strstr(buf,"\nExec=");
224 if (!ptr || strlen(ptr) < 7) { 244 if (!ptr || strlen(ptr) < 7) {
225 if (arg_debug) 245 if (arg_debug)
226 printf(" %s - skipped: wrong format?\n", filename); 246 printf(" %s - skipped: wrong format?\n", filename);