From 81a7eac1f7179fa61f133842fd959f85016dceb7 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 22 Aug 2022 11:33:52 +0200 Subject: [PATCH] chase-symlinks: refuse more chase_symlink() flags in the open/stat flavours These flags make no sense when we try to access the final inode, hence refuse. --- src/basic/chase-symlinks.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/basic/chase-symlinks.c b/src/basic/chase-symlinks.c index a5d89e1349..ce50ff9726 100644 --- a/src/basic/chase-symlinks.c +++ b/src/basic/chase-symlinks.c @@ -417,7 +417,7 @@ int chase_symlinks_and_open( _cleanup_free_ char *p = NULL; int r; - if (chase_flags & CHASE_NONEXISTENT) + if (chase_flags & (CHASE_NONEXISTENT|CHASE_STEP)) return -EINVAL; if (empty_or_root(root) && !ret_path && (chase_flags & (CHASE_NO_AUTOFS|CHASE_SAFE)) == 0) { @@ -458,7 +458,7 @@ int chase_symlinks_and_opendir( if (!ret_dir) return -EINVAL; - if (chase_flags & CHASE_NONEXISTENT) + if (chase_flags & (CHASE_NONEXISTENT|CHASE_STEP)) return -EINVAL; if (empty_or_root(root) && !ret_path && (chase_flags & (CHASE_NO_AUTOFS|CHASE_SAFE)) == 0) { @@ -502,7 +502,7 @@ int chase_symlinks_and_stat( assert(path); assert(ret_stat); - if (chase_flags & CHASE_NONEXISTENT) + if (chase_flags & (CHASE_NONEXISTENT|CHASE_STEP)) return -EINVAL; if (empty_or_root(root) && !ret_path && (chase_flags & (CHASE_NO_AUTOFS|CHASE_SAFE)) == 0 && !ret_fd) {