]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_error_inject: Ignore openat() from openat_pathref_dirfsp_nosymlink()
authorVolker Lendecke <vl@samba.org>
Sun, 24 Jul 2022 14:47:37 +0000 (16:47 +0200)
committerRalph Boehme <slow@samba.org>
Mon, 25 Jul 2022 12:04:33 +0000 (12:04 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_error_inject.c

index dca8783edafcaeea55f8cd49006e784685e753ef..9ead2c26727feaa18960610f7050f466d715dbf0 100644 (file)
@@ -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;
        }