mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
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>
This commit is contained in:
parent
3013463098
commit
d6949f0f93
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user