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,
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,
req,
info_level,
fsp,
+ NULL,
smb_fname,
*ppdata,
total_data,
req,
info_level,
fsp,
+ NULL,
smb_fname,
*ppdata,
total_data,
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,
*/
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
status = rename_internals_fsp(conn,
fsp,
+ NULL,
smb_fname_dst,
dst_original_lcomp,
attrs,
state,
state->file_info_level,
state->fsp,
+ &state->lck,
state->fsp->fsp_name,
(char *)state->data.data,
state->data.length,
state,
state->file_info_level,
state->fsp,
+ &state->lck,
state->fsp->fsp_name,
(char *)state->data.data,
state->data.length,
const char *pdata,
int total_data,
files_struct *fsp,
+ struct share_mode_lock **lck,
struct smb_filename *smb_fname_src)
{
bool overwrite;
status = rename_internals_fsp(conn,
fsp,
+ lck,
smb_fname_dst,
dst_original_lcomp,
(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM),
status = rename_internals_fsp(conn,
fsp,
+ NULL,
smb_fname_dst,
dst_original_lcomp,
0,
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,
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;
}