1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

smbd: Pass "dirfsp" and "smb_fname" to reopen_from_fsp()

Lift the conn->cwd_fsp reference one level, we might want to pass in a
real dirfsp in the future.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Volker Lendecke 2022-01-18 21:19:40 +01:00 committed by Ralph Boehme
parent 0fedcf5939
commit e316f82bb7

View File

@ -1241,7 +1241,9 @@ static NTSTATUS reopen_from_procfd(struct files_struct *fsp,
return NT_STATUS_OK;
}
static NTSTATUS reopen_from_fsp(struct files_struct *fsp,
static NTSTATUS reopen_from_fsp(struct files_struct *dirfsp,
struct smb_filename *smb_fname,
struct files_struct *fsp,
int flags,
mode_t mode,
bool *p_file_created)
@ -1277,8 +1279,8 @@ static NTSTATUS reopen_from_fsp(struct files_struct *fsp,
fsp->fsp_flags.is_pathref = false;
status = fd_open_atomic(
fsp->conn->cwd_fsp,
fsp->fsp_name,
dirfsp,
smb_fname,
fsp,
flags,
mode,
@ -1472,7 +1474,9 @@ static NTSTATUS open_file(files_struct *fsp,
* Actually do the open - if O_TRUNC is needed handle it
* below under the share mode lock.
*/
status = reopen_from_fsp(fsp,
status = reopen_from_fsp(fsp->conn->cwd_fsp,
fsp->fsp_name,
fsp,
local_flags & ~O_TRUNC,
unx_mode,
p_file_created);
@ -4646,7 +4650,13 @@ static NTSTATUS open_directory(connection_struct *conn,
FILE_ADD_SUBDIRECTORY;
if (access_mask & need_fd_access) {
status = reopen_from_fsp(fsp, O_RDONLY | O_DIRECTORY, 0, NULL);
status = reopen_from_fsp(
fsp->conn->cwd_fsp,
fsp->fsp_name,
fsp,
O_RDONLY | O_DIRECTORY,
0,
NULL);
if (!NT_STATUS_IS_OK(status)) {
DBG_INFO("Could not open fd for [%s]: %s\n",
smb_fname_str_dbg(smb_dname),