From: Lennart Poettering Date: Mon, 22 Aug 2022 09:33:52 +0000 (+0200) Subject: chase-symlinks: refuse more chase_symlink() flags in the open/stat flavours X-Git-Tag: v252-rc1~374 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81a7eac1f7179fa61f133842fd959f85016dceb7;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/basic/chase-symlinks.c b/src/basic/chase-symlinks.c index a5d89e13497..ce50ff97261 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) {