return NULL;
}
+static int pakfire_fhs_check_world_writable(
+ struct pakfire* pakfire, struct pakfire_file* file) {
+ // Fetch path
+ const char* path = pakfire_file_get_path(file);
+
+ // Fetch permissions
+ const mode_t perms = pakfire_file_get_perms(file);
+
+ // Check that none of the executable bits are set
+ if ((perms & (S_IWUSR|S_IWGRP|S_IWOTH)) == (S_IWUSR|S_IWGRP|S_IWOTH)) {
+ DEBUG(pakfire, "%s is world-writable\n", path);
+ return 1;
+ }
+
+ return 0;
+}
+
static int pakfire_fhs_check_perms(struct pakfire* pakfire,
const struct pakfire_fhs_check* check, struct pakfire_file* file) {
// No permissions defined. Skipping check...
if (!path)
return 1;
+ // Check for world-writable permissions
+ r = pakfire_fhs_check_world_writable(pakfire, file);
+ if (r)
+ return r;
+
// Find a check
check = pakfire_fhs_find_check(pakfire, file);
if (!check) {