diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 1da8fc99f43..53f5cc1e60a 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -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 */ diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index e0da9b14f74..33a5523ff79 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -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; diff --git a/source3/smbd/smb2_reply.c b/source3/smbd/smb2_reply.c index 492e39ed23b..cc5a1ee14f2 100644 --- a/source3/smbd/smb2_reply.c +++ b/source3/smbd/smb2_reply.c @@ -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; +}