check_policy_sanity(): Traverse path_policy list only if no landlock available

This commit is contained in:
Albert S. 2021-12-29 00:29:14 +01:00
parent 9048a3b4fe
commit 4824c6eaa9

10
exile.h
View File

@ -1546,18 +1546,18 @@ static int check_policy_sanity(struct exile_policy *policy)
}
int can_use_landlock = exile_landlock_is_available();
struct exile_path_policy *path_policy = policy->path_policies;
while(path_policy)
if(!can_use_landlock)
{
if(path_policy_needs_landlock(path_policy))
struct exile_path_policy *path_policy = policy->path_policies;
while(path_policy)
{
if(!can_use_landlock)
if(path_policy_needs_landlock(path_policy))
{
EXILE_LOG_ERROR("Error: A path policy needs landlock, but landlock is not available. Fallback not possible\n");
return -1;
}
path_policy = path_policy->next;
}
path_policy = path_policy->next;
}
/* TODO: check if we have ALLOWED, but no default deny */