From 7d860a73ca48819e80fc8690ae8cfb5b628ace0a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 30 Apr 2024 10:37:06 +0200 Subject: [PATCH] smbd: Remove message_to_share_mode_entry and vice versa Used only for closing files from rpc srvsvc these days Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source3/include/smb.h | 40 -------------------------- source3/smbd/proto.h | 5 ---- source3/smbd/smb2_oplock.c | 57 -------------------------------------- 3 files changed, 102 deletions(-) diff --git a/source3/include/smb.h b/source3/include/smb.h index 76291d93267..e47ccd66133 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -172,46 +172,6 @@ struct interface { #include "librpc/gen_ndr/server_id.h" -/* oplock break message definition - linearization of share_mode_entry. - -Offset Data length. -0 struct server_id pid 4 -4 uint16_t op_mid 8 -12 uint16_t op_type 2 -14 uint32_t access_mask 4 -18 uint32_t share_access 4 -22 uint32_t private_options 4 -26 uint32_t time sec 4 -30 uint32_t time usec 4 -34 uint64_t dev 8 bytes -42 uint64_t inode 8 bytes -50 uint64_t extid 8 bytes -58 unsigned long file_id 4 bytes -62 uint32_t uid 4 bytes -66 uint16_t flags 2 bytes -68 uint32_t name_hash 4 bytes -72 - -*/ - -#define OP_BREAK_MSG_PID_OFFSET 0 -#define OP_BREAK_MSG_MID_OFFSET 4 -#define OP_BREAK_MSG_OP_TYPE_OFFSET 12 -#define OP_BREAK_MSG_ACCESS_MASK_OFFSET 14 -#define OP_BREAK_MSG_SHARE_ACCESS_OFFSET 18 -#define OP_BREAK_MSG_PRIV_OFFSET 22 -#define OP_BREAK_MSG_TIME_SEC_OFFSET 26 -#define OP_BREAK_MSG_TIME_USEC_OFFSET 30 -#define OP_BREAK_MSG_DEV_OFFSET 34 -#define OP_BREAK_MSG_INO_OFFSET 42 -#define OP_BREAK_MSG_EXTID_OFFSET 50 -#define OP_BREAK_MSG_FILE_ID_OFFSET 58 -#define OP_BREAK_MSG_UID_OFFSET 62 -#define OP_BREAK_MSG_FLAGS_OFFSET 66 -#define OP_BREAK_MSG_NAME_HASH_OFFSET 68 - -#define OP_BREAK_MSG_VNN_OFFSET 72 - #define NT_HASH_LEN 16 #define LM_HASH_LEN 16 diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 7f8aee068bd..ba7218f4d1c 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -728,11 +728,6 @@ void smbd_contend_level2_oplocks_begin(files_struct *fsp, enum level2_contention_type type); void smbd_contend_level2_oplocks_end(files_struct *fsp, enum level2_contention_type type); -void share_mode_entry_to_message(char *msg, const struct file_id *id, - const struct share_mode_entry *e); -void message_to_share_mode_entry(struct file_id *id, - struct share_mode_entry *e, - const char *msg); bool init_oplocks(struct smbd_server_connection *sconn); void init_kernel_oplocks(struct smbd_server_connection *sconn); diff --git a/source3/smbd/smb2_oplock.c b/source3/smbd/smb2_oplock.c index eec805f1b46..1e27f9dafb1 100644 --- a/source3/smbd/smb2_oplock.c +++ b/source3/smbd/smb2_oplock.c @@ -1332,63 +1332,6 @@ void smbd_contend_level2_oplocks_end(files_struct *fsp, return; } -/**************************************************************************** - Linearize a share mode entry struct to an internal oplock break message. -****************************************************************************/ - -void share_mode_entry_to_message(char *msg, const struct file_id *id, - const struct share_mode_entry *e) -{ - SIVAL(msg,OP_BREAK_MSG_PID_OFFSET,(uint32_t)e->pid.pid); - SBVAL(msg,OP_BREAK_MSG_MID_OFFSET,e->op_mid); - SSVAL(msg,OP_BREAK_MSG_OP_TYPE_OFFSET,e->op_type); - SIVAL(msg,OP_BREAK_MSG_ACCESS_MASK_OFFSET,e->access_mask); - SIVAL(msg,OP_BREAK_MSG_SHARE_ACCESS_OFFSET,e->share_access); - SIVAL(msg,OP_BREAK_MSG_PRIV_OFFSET,e->private_options); - SIVAL(msg,OP_BREAK_MSG_TIME_SEC_OFFSET,(uint32_t)e->time.tv_sec); - SIVAL(msg,OP_BREAK_MSG_TIME_USEC_OFFSET,(uint32_t)e->time.tv_usec); - /* - * "id" used to be part of share_mode_entry, thus the strange - * place to put this. Feel free to move somewhere else :-) - */ - push_file_id_24(msg+OP_BREAK_MSG_DEV_OFFSET, id); - SIVAL(msg,OP_BREAK_MSG_FILE_ID_OFFSET,e->share_file_id); - SIVAL(msg,OP_BREAK_MSG_UID_OFFSET,e->uid); - SSVAL(msg,OP_BREAK_MSG_FLAGS_OFFSET,e->flags); - SIVAL(msg,OP_BREAK_MSG_NAME_HASH_OFFSET,e->name_hash); - SIVAL(msg,OP_BREAK_MSG_VNN_OFFSET,e->pid.vnn); -} - -/**************************************************************************** - De-linearize an internal oplock break message to a share mode entry struct. -****************************************************************************/ - -void message_to_share_mode_entry(struct file_id *id, - struct share_mode_entry *e, - const char *msg) -{ - e->pid = (struct server_id){ - .pid = (pid_t)IVAL(msg, OP_BREAK_MSG_PID_OFFSET), - .vnn = IVAL(msg, OP_BREAK_MSG_VNN_OFFSET), - }; - e->op_mid = BVAL(msg,OP_BREAK_MSG_MID_OFFSET); - e->op_type = SVAL(msg,OP_BREAK_MSG_OP_TYPE_OFFSET); - e->access_mask = IVAL(msg,OP_BREAK_MSG_ACCESS_MASK_OFFSET); - e->share_access = IVAL(msg,OP_BREAK_MSG_SHARE_ACCESS_OFFSET); - e->private_options = IVAL(msg,OP_BREAK_MSG_PRIV_OFFSET); - e->time.tv_sec = (time_t)IVAL(msg,OP_BREAK_MSG_TIME_SEC_OFFSET); - e->time.tv_usec = (int)IVAL(msg,OP_BREAK_MSG_TIME_USEC_OFFSET); - /* - * "id" used to be part of share_mode_entry, thus the strange - * place to put this. Feel free to move somewhere else :-) - */ - pull_file_id_24(msg+OP_BREAK_MSG_DEV_OFFSET, id); - e->share_file_id = (unsigned long)IVAL(msg,OP_BREAK_MSG_FILE_ID_OFFSET); - e->uid = (uint32_t)IVAL(msg,OP_BREAK_MSG_UID_OFFSET); - e->flags = (uint16_t)SVAL(msg,OP_BREAK_MSG_FLAGS_OFFSET); - e->name_hash = IVAL(msg, OP_BREAK_MSG_NAME_HASH_OFFSET); -} - /**************************************************************************** Setup oplocks for this process. ****************************************************************************/ -- 2.47.3