smbd: Pass "file_id" explicitly to message_to_share_mode_entry()
authorVolker Lendecke <vl@samba.org>
Wed, 7 Feb 2018 10:39:32 +0000 (11:39 +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/smbd/close.c
source3/smbd/oplock.c
source3/smbd/proto.h

index 0d60a2258e2dafc63e82afe213baf8e9fdbadc77..c7ec3fdb6af95d0fb02435467b6485a7309653a7 100644 (file)
@@ -1285,7 +1285,7 @@ void msg_close_file(struct messaging_context *msg_ctx,
                talloc_get_type_abort(private_data,
                struct smbd_server_connection);
 
                talloc_get_type_abort(private_data,
                struct smbd_server_connection);
 
-       message_to_share_mode_entry(&e, (char *)data->data);
+       message_to_share_mode_entry(&e.id, &e, (char *)data->data);
 
        if(DEBUGLVL(10)) {
                char *sm_str = share_mode_str(NULL, 0, &e.id, &e);
 
        if(DEBUGLVL(10)) {
                char *sm_str = share_mode_str(NULL, 0, &e.id, &e);
index 419296eb060ccff17392e8a654cd661001ee9c4a..6674c2e5ae76706c70a0d878dfdbc1106755e392 100644 (file)
@@ -816,7 +816,7 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
        }
 
        /* De-linearize incoming message. */
        }
 
        /* De-linearize incoming message. */
-       message_to_share_mode_entry(&msg, (char *)data->data);
+       message_to_share_mode_entry(&msg.id, &msg, (char *)data->data);
        break_to = msg.op_type;
 
        DEBUG(10, ("Got oplock break to %u message from pid %s: %s/%llu\n",
        break_to = msg.op_type;
 
        DEBUG(10, ("Got oplock break to %u message from pid %s: %s/%llu\n",
@@ -1318,7 +1318,9 @@ void share_mode_entry_to_message(char *msg, const struct file_id *id,
  De-linearize an internal oplock break message to a share mode entry struct.
 ****************************************************************************/
 
  De-linearize an internal oplock break message to a share mode entry struct.
 ****************************************************************************/
 
-void message_to_share_mode_entry(struct share_mode_entry *e, const char *msg)
+void message_to_share_mode_entry(struct file_id *id,
+                                struct share_mode_entry *e,
+                                const char *msg)
 {
        e->pid.pid = (pid_t)IVAL(msg,OP_BREAK_MSG_PID_OFFSET);
        e->op_mid = BVAL(msg,OP_BREAK_MSG_MID_OFFSET);
 {
        e->pid.pid = (pid_t)IVAL(msg,OP_BREAK_MSG_PID_OFFSET);
        e->op_mid = BVAL(msg,OP_BREAK_MSG_MID_OFFSET);
@@ -1328,7 +1330,11 @@ void message_to_share_mode_entry(struct share_mode_entry *e, const char *msg)
        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);
        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);
-       pull_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 :-)
+        */
+       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->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);
index 175b92bc1cdcc4f55b5dba976e02e920446ea6f8..96636696f9172c4d1dbfd6e4edad834072cf0900 100644 (file)
@@ -724,7 +724,9 @@ 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);
                                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 share_mode_entry *e, const char *msg);
+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);
 
 bool init_oplocks(struct smbd_server_connection *sconn);
 void init_kernel_oplocks(struct smbd_server_connection *sconn);