From: Volker Lendecke Date: Sun, 24 Jul 2022 14:47:37 +0000 (+0200) Subject: vfs_error_inject: Ignore openat() from openat_pathref_dirfsp_nosymlink() X-Git-Tag: tevent-0.13.0~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7bb8af3f74cb6a2e3a9836bb36bbad5e1d1e6a6d;p=thirdparty%2Fsamba.git vfs_error_inject: Ignore openat() from openat_pathref_dirfsp_nosymlink() Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- 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; }