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.
This commit is contained in:
committed by
Luca Boccassi
parent
127b72da2b
commit
81a7eac1f7
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user