From 7bb8af3f74cb6a2e3a9836bb36bbad5e1d1e6a6d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 24 Jul 2022 16:47:37 +0200 Subject: [PATCH] vfs_error_inject: Ignore openat() from openat_pathref_dirfsp_nosymlink() Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- source3/modules/vfs_error_inject.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/source3/modules/vfs_error_inject.c b/source3/modules/vfs_error_inject.c index dca8783edaf..9ead2c26727 100644 --- a/source3/modules/vfs_error_inject.c +++ b/source3/modules/vfs_error_inject.c @@ -116,8 +116,22 @@ static int vfs_error_inject_openat(struct vfs_handle_struct *handle, mode_t mode) { int error = inject_unix_error("openat", handle); - - if (!fsp->fsp_flags.is_pathref && error != 0) { + int dirfsp_flags = (O_NOFOLLOW|O_DIRECTORY); + bool return_error; + +#ifdef O_PATH + dirfsp_flags |= O_PATH; +#else +#ifdef O_SEARCH + dirfsp_flags |= O_SEARCH; +#endif +#endif + + return_error = (error != 0); + return_error &= !fsp->fsp_flags.is_pathref; + return_error &= ((flags & dirfsp_flags) != dirfsp_flags); + + if (return_error) { errno = error; return -1; } -- 2.47.3