smbd: "have_proc_fds" can only work for a real fd
authorVolker Lendecke <vl@samba.org>
Sun, 22 Oct 2023 14:25:53 +0000 (16:25 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 1 Nov 2023 18:55:32 +0000 (18:55 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_default.c

index fe9b87929532f2bb47c4d4d0ce9eb567d7a23733..d1a19568e4eb9d999db5fd01c0084aab0ebbc1cc 100644 (file)
@@ -744,7 +744,16 @@ static int vfswrap_openat(vfs_handle_struct *handle,
        }
 
 done:
-       fsp->fsp_flags.have_proc_fds = fsp->conn->have_proc_fds;
+       if (result >= 0) {
+               fsp->fsp_flags.have_proc_fds = fsp->conn->have_proc_fds;
+       } else {
+               /*
+                * "/proc/self/fd/-1" never exists. Indicate to upper
+                * layers that for this fsp a possible name-based
+                * fallback is the only way to go.
+                */
+               fsp->fsp_flags.have_proc_fds = false;
+       }
 
 out:
        END_PROFILE(syscall_openat);