1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

smbd: pass lck down to rename_internals_fsp()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Ralph Boehme 2024-09-30 20:03:43 +02:00
parent 6c923bcd1e
commit 5c944aaccc
6 changed files with 32 additions and 4 deletions

View File

@ -144,6 +144,7 @@ NTSTATUS smbd_do_setfilepathinfo(connection_struct *conn,
TALLOC_CTX *mem_ctx,
uint16_t info_level,
files_struct *fsp,
struct share_mode_lock **lck,
struct smb_filename *smb_fname,
char *data,
int total_data,

View File

@ -922,6 +922,7 @@ ssize_t sendfile_short_send(struct smbXsrv_connection *xconn,
size_t smb_maxcnt);
NTSTATUS rename_internals_fsp(connection_struct *conn,
files_struct *fsp,
struct share_mode_lock **lck,
struct smb_filename *smb_fname_dst_in,
const char *dst_original_lcomp,
uint32_t attrs,

View File

@ -4598,6 +4598,7 @@ static void call_trans2setpathinfo(
req,
info_level,
fsp,
NULL,
smb_fname,
*ppdata,
total_data,
@ -4774,6 +4775,7 @@ static void call_trans2setfileinfo(
req,
info_level,
fsp,
NULL,
smb_fname,
*ppdata,
total_data,

View File

@ -1389,6 +1389,7 @@ static NTSTATUS parent_dirname_compatible_open(connection_struct *conn,
NTSTATUS rename_internals_fsp(connection_struct *conn,
files_struct *fsp,
struct share_mode_lock **_lck,
struct smb_filename *smb_fname_dst_in,
const char *dst_original_lcomp,
uint32_t attrs,
@ -1737,7 +1738,11 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
*/
parent_dir_fname_src_atname->st = fsp->fsp_name->st;
lck = get_existing_share_mode_lock(talloc_tos(), fsp->file_id);
if (_lck != NULL) {
lck = talloc_move(talloc_tos(), _lck);
} else {
lck = get_existing_share_mode_lock(talloc_tos(), fsp->file_id);
}
/*
* We have the file open ourselves, so not being able to get the
@ -1963,6 +1968,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
status = rename_internals_fsp(conn,
fsp,
NULL,
smb_fname_dst,
dst_original_lcomp,
attrs,

View File

@ -429,6 +429,7 @@ static void smbd_smb2_setinfo_lease_break_check(struct tevent_req *req)
state,
state->file_info_level,
state->fsp,
&state->lck,
state->fsp->fsp_name,
(char *)state->data.data,
state->data.length,
@ -541,6 +542,7 @@ static void smbd_smb2_setinfo_lease_break_fsp_done(struct tevent_req *subreq)
state,
state->file_info_level,
state->fsp,
&state->lck,
state->fsp->fsp_name,
(char *)state->data.data,
state->data.length,

View File

@ -4406,6 +4406,7 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn,
const char *pdata,
int total_data,
files_struct *fsp,
struct share_mode_lock **lck,
struct smb_filename *smb_fname_src)
{
bool overwrite;
@ -4437,6 +4438,7 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn,
status = rename_internals_fsp(conn,
fsp,
lck,
smb_fname_dst,
dst_original_lcomp,
(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM),
@ -4810,6 +4812,7 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
status = rename_internals_fsp(conn,
fsp,
NULL,
smb_fname_dst,
dst_original_lcomp,
0,
@ -5087,11 +5090,20 @@ static NTSTATUS smb_set_file_end_of_file_info(connection_struct *conn,
fail_after_createfile);
}
/**
* Set an info_level
*
* Called from the SMB1 and SMB2 code. For the path-based SMB1 code, there may
* not be a full fsp from the FSA layer.
*
* lck may be NULL, currently only passed for SMB2 rename requests.
**/
NTSTATUS smbd_do_setfilepathinfo(connection_struct *conn,
struct smb_request *req,
TALLOC_CTX *mem_ctx,
uint16_t info_level,
files_struct *fsp,
struct share_mode_lock **lck,
struct smb_filename *smb_fname,
char *pdata,
int total_data,
@ -5234,9 +5246,13 @@ NTSTATUS smbd_do_setfilepathinfo(connection_struct *conn,
case SMB2_FILE_RENAME_INFORMATION_INTERNAL:
{
/* SMB2 rename information. */
status = smb2_file_rename_information(conn, req,
pdata, total_data,
fsp, smb_fname);
status = smb2_file_rename_information(conn,
req,
pdata,
total_data,
fsp,
lck,
smb_fname);
break;
}