Merge pull request #25355 from poettering/chase-symlinks-no-symlink

chase_symlinks(): add CHASE_PROHIBIT_SYMLINKS
This commit is contained in:
Yu Watanabe
2022-11-13 20:16:34 +09:00
committed by GitHub
5 changed files with 41 additions and 13 deletions
+4 -4
View File
@@ -508,7 +508,7 @@ static int boot_loader_read_conf_path(BootConfig *config, const char *root, cons
assert(config);
assert(path);
r = chase_symlinks_and_fopen_unlocked(path, root, CHASE_PREFIX_ROOT, "re", &full, &f);
r = chase_symlinks_and_fopen_unlocked(path, root, CHASE_PREFIX_ROOT|CHASE_PROHIBIT_SYMLINKS, "re", &full, &f);
if (r == -ENOENT)
return 0;
if (r < 0)
@@ -593,7 +593,7 @@ static int boot_entries_find_type1(
assert(root);
assert(dir);
dir_fd = chase_symlinks_and_open(dir, root, CHASE_PREFIX_ROOT, O_DIRECTORY|O_CLOEXEC, &full);
dir_fd = chase_symlinks_and_open(dir, root, CHASE_PREFIX_ROOT|CHASE_PROHIBIT_SYMLINKS, O_DIRECTORY|O_CLOEXEC, &full);
if (dir_fd == -ENOENT)
return 0;
if (dir_fd < 0)
@@ -853,7 +853,7 @@ static int boot_entries_find_unified(
assert(config);
assert(dir);
r = chase_symlinks_and_opendir(dir, root, CHASE_PREFIX_ROOT, &full, &d);
r = chase_symlinks_and_opendir(dir, root, CHASE_PREFIX_ROOT|CHASE_PROHIBIT_SYMLINKS, &full, &d);
if (r == -ENOENT)
return 0;
if (r < 0)
@@ -1260,7 +1260,7 @@ static void boot_entry_file_list(
assert(p);
assert(ret_status);
int status = chase_symlinks_and_access(p, root, CHASE_PREFIX_ROOT, F_OK, NULL, NULL);
int status = chase_symlinks_and_access(p, root, CHASE_PREFIX_ROOT|CHASE_PROHIBIT_SYMLINKS, F_OK, NULL, NULL);
printf("%13s%s ", strempty(field), field ? ":" : " ");
if (status < 0) {