smbd: Move get_lock_offset to smb2_reply.c
authorDavid Mulder <dmulder@suse.com>
Thu, 17 Mar 2022 18:20:30 +0000 (12:20 -0600)
committerJeremy Allison <jra@samba.org>
Thu, 7 Apr 2022 17:37:29 +0000 (17:37 +0000)
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/proto.h
source3/smbd/reply.c
source3/smbd/smb2_reply.c

index 1da8fc99f4333741f7588be8b6a52906e27bca78..53f5cc1e60ad28070ed6ac60c0bfec65f6a414c8 100644 (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  */
 
index e0da9b14f746b7f5ef670d7b0876a44627e50c62..33a5523ff794c2bd821b670fe82045a823b85854 100644 (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;
index 492e39ed23bac9d92d25516545deb1c2efd59444..cc5a1ee14f221eea6b1aefc5a14dfb125166743a 100644 (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;
+}