smbd: Pass "file_id" explicitly into share_mode_entry_to_message()
authorVolker Lendecke <vl@samba.org>
Wed, 7 Feb 2018 10:36:51 +0000 (11:36 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 12 Feb 2018 23:26:43 +0000 (00:26 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/rpc_server/srvsvc/srv_srvsvc_nt.c
source3/smbd/open.c
source3/smbd/oplock.c
source3/smbd/proto.h

index e0561b6e7e0eb1adf158caf77fc23811df1db4cc..8a738b396cd6ec3bfe1aec67629d7247374be853 100644 (file)
@@ -2725,7 +2725,7 @@ static int enum_file_close_fn(const struct share_mode_entry *e,
        DBG_DEBUG("request to close file %s, %s\n", sharepath,
                  share_mode_str(talloc_tos(), 0, id, e));
 
-       share_mode_entry_to_message(msg, e);
+       share_mode_entry_to_message(msg, &e->id, e);
 
        state->r->out.result = ntstatus_to_werror(
                messaging_send_buf(state->msg_ctx,
index 9f96d581212e934443313e436cc7710ca4d89716..995417bc76440bad9c055e5fec3211adf3a2573a 100644 (file)
@@ -1701,7 +1701,7 @@ NTSTATUS send_break_message(struct messaging_context *msg_ctx,
                   server_id_str_buf(exclusive->pid, &tmp)));
 
        /* Create the message. */
-       share_mode_entry_to_message(msg, exclusive);
+       share_mode_entry_to_message(msg, &exclusive->id, exclusive);
 
        /* Overload entry->op_type */
        /*
index e848b5e0d862cb1ae13418ca8b07d440d77a5726..419296eb060ccff17392e8a654cd661001ee9c4a 100644 (file)
@@ -1134,7 +1134,7 @@ static void send_break_to_none(struct messaging_context *msg_ctx,
 {
        char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];
 
-       share_mode_entry_to_message(msg, e);
+       share_mode_entry_to_message(msg, &e->id, e);
        /* Overload entry->op_type */
        SSVAL(msg, OP_BREAK_MSG_OP_TYPE_OFFSET, NO_OPLOCK);
 
@@ -1291,7 +1291,8 @@ void smbd_contend_level2_oplocks_end(files_struct *fsp,
  Linearize a share mode entry struct to an internal oplock break message.
 ****************************************************************************/
 
-void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e)
+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);
@@ -1301,7 +1302,11 @@ void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e)
        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);
-       push_file_id_24(msg+OP_BREAK_MSG_DEV_OFFSET, &e->id);
+       /*
+        * "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);
index fe3764047093704ad8c52fe8758b038ca086310e..175b92bc1cdcc4f55b5dba976e02e920446ea6f8 100644 (file)
@@ -722,7 +722,8 @@ 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 share_mode_entry *e);
+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 share_mode_entry *e, const char *msg);
 bool init_oplocks(struct smbd_server_connection *sconn);
 void init_kernel_oplocks(struct smbd_server_connection *sconn);