]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Simplify smbd_smb2_query_directory_send()
authorVolker Lendecke <vl@samba.org>
Wed, 9 Oct 2024 05:35:26 +0000 (07:35 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 12 Nov 2024 12:09:35 +0000 (12:09 +0000)
Use reopen_from_fsp(), this will use the /proc/self/fd/<fd> trick if
available, no need to go through non_widelink_open

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/smb2_query_directory.c

index cfdcc52e93672ef64d526b9f474e3aaa697aae6b..2c8fb4a97c72493de47bf1bee76ad3016614fc2f 100644 (file)
@@ -381,21 +381,17 @@ static struct tevent_req *smbd_smb2_query_directory_send(TALLOC_CTX *mem_ctx,
 
        if (in_flags & SMB2_CONTINUE_FLAG_REOPEN) {
                struct vfs_open_how how = { .flags = O_RDONLY, };
-
-               status = fd_close(fsp);
-               if (tevent_req_nterror(req, status)) {
-                       return tevent_req_post(req, ev);
-               }
-
-               /*
-                * fd_close() will close and invalidate the fsp's file
-                * descriptor. So we have to reopen it.
-                */
+               bool file_was_created;
 
 #ifdef O_DIRECTORY
                how.flags |= O_DIRECTORY;
 #endif
-               status = fd_openat(conn->cwd_fsp, fsp->fsp_name, fsp, &how);
+
+               status = reopen_from_fsp(conn->cwd_fsp,
+                                        fsp->fsp_name,
+                                        fsp,
+                                        &how,
+                                        &file_was_created);
                if (tevent_req_nterror(req, status)) {
                        return tevent_req_post(req, ev);
                }