Skip to content

Commit

Permalink
fixup! [LibOS] Move trusted and allowed files logic to LibOS
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitrii Kuvaiskii <[email protected]>
  • Loading branch information
Dmitrii Kuvaiskii committed Sep 4, 2024
1 parent be16ba9 commit 7eefdb6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions libos/src/fs/chroot/allowed.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@ struct allowed_file* get_allowed_file(const char* path) {
return NULL;
}

struct allowed_file* af = NULL;
struct allowed_file* found_af = NULL;

spinlock_lock(&g_allowed_files_lock);
struct allowed_file* tmp;
LISTP_FOR_EACH_ENTRY(tmp, &g_allowed_files_list, list) {
struct allowed_file* af;
LISTP_FOR_EACH_ENTRY(af, &g_allowed_files_list, list) {
/* must be a sub-directory or file */
if (is_af_path_equal_or_subpath(tmp, norm_path, strlen(norm_path))) {
af = tmp;
if (is_af_path_equal_or_subpath(af, norm_path, strlen(norm_path))) {
found_af = af;
break;
}
}
spinlock_unlock(&g_allowed_files_lock);
free(norm_path);
return af;
return found_af;
}

int register_allowed_file(const char* path) {
Expand Down

0 comments on commit 7eefdb6

Please sign in to comment.