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

smbd: Move get_lock_offset to smb2_reply.c

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
David Mulder 2022-03-17 12:20:30 -06:00 committed by Jeremy Allison
parent fdf5727c1e
commit a85436ac48
3 changed files with 24 additions and 24 deletions

View File

@ -961,8 +961,6 @@ uint64_t get_lock_pid(const uint8_t *data, int data_offset,
bool large_file_format);
uint64_t get_lock_count(const uint8_t *data, int data_offset,
bool large_file_format);
uint64_t get_lock_offset(const uint8_t *data, int data_offset,
bool large_file_format);
void reply_lockingX(struct smb_request *req);
void reply_readbmpx(struct smb_request *req);
void reply_readbs(struct smb_request *req);
@ -1036,6 +1034,8 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
int ofun,
int count,
bool target_is_directory);
uint64_t get_lock_offset(const uint8_t *data, int data_offset,
bool large_file_format);
/* The following definitions come from smbd/seal.c */

View File

@ -6127,28 +6127,6 @@ uint64_t get_lock_count(const uint8_t *data, int data_offset,
return count;
}
/****************************************************************************
Get a lock offset, dealing with large offset requests.
****************************************************************************/
uint64_t get_lock_offset(const uint8_t *data, int data_offset,
bool large_file_format)
{
uint64_t offset = 0;
if(!large_file_format) {
offset = (uint64_t)IVAL(data,SMB_LKOFF_OFFSET(data_offset));
} else {
/*
* No BVAL, this is reversed!
*/
offset = (((uint64_t) IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(data_offset))) << 32) |
((uint64_t) IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(data_offset)));
}
return offset;
}
struct smbd_do_unlocking_state {
struct files_struct *fsp;
uint16_t num_ulocks;

View File

@ -2010,3 +2010,25 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
TALLOC_FREE(smb_fname_dst_tmp);
return status;
}
/****************************************************************************
Get a lock offset, dealing with large offset requests.
****************************************************************************/
uint64_t get_lock_offset(const uint8_t *data, int data_offset,
bool large_file_format)
{
uint64_t offset = 0;
if(!large_file_format) {
offset = (uint64_t)IVAL(data,SMB_LKOFF_OFFSET(data_offset));
} else {
/*
* No BVAL, this is reversed!
*/
offset = (((uint64_t) IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(data_offset))) << 32) |
((uint64_t) IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(data_offset)));
}
return offset;
}