diff options
author | Stefan Metzmacher <metze@samba.org> | 2020-12-23 15:38:03 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2021-01-14 11:30:38 +0000 |
commit | d6949f0f93ff0a1f6292395fbbd9c07b12fe9336 (patch) | |
tree | 1b99e340cc7c8d3eaf1e4c168d978d1d862a8ec4 /source3 | |
parent | 30134630988ca76545a8aee8516d44a0dc64bc8d (diff) | |
download | samba-d6949f0f93ff0a1f6292395fbbd9c07b12fe9336.tar.gz |
s3:smbd: let open_directory() also use fd_open_atomic() as reopen_from_procfd() fallback
Calling fd_open_atomic() without O_CREAT is the same as calling
fd_openat() directly, so we can also use it to open an existing
directory.
In the next step we'll move the reopen_from_procfd() fallback logic to
a single helper function.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/open.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 956230fdc4b..e839f406abc 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -4649,6 +4649,8 @@ static NTSTATUS open_directory(connection_struct *conn, status = reopen_from_procfd(fsp, smb_dname, flags, 0); if (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { + bool __unused_file_created = false; + /* * Close the existing pathref fd and set the fsp flag * is_pathref to false so we get a "normal" fd this @@ -4661,7 +4663,11 @@ static NTSTATUS open_directory(connection_struct *conn, fsp->fsp_flags.is_pathref = false; - status = fd_openat(conn->cwd_fsp, fsp->fsp_name, fsp, flags, 0); + /* + * Calling fd_open_atomic() without O_CREAT + * is like calling fd_openat() directly. + */ + status = fd_open_atomic(fsp, flags, 0, &__unused_file_created); } if (!NT_STATUS_IS_OK(status)) { DBG_INFO("Could not open fd for%s (%s)\n", |