From: Volker Lendecke Date: Wed, 7 Feb 2018 10:39:32 +0000 (+0100) Subject: smbd: Pass "file_id" explicitly to message_to_share_mode_entry() X-Git-Tag: tevent-0.9.36~125 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b7e29d04c6156a6eb5c02b12e53abd1a04d75471;p=thirdparty%2Fsamba.git smbd: Pass "file_id" explicitly to message_to_share_mode_entry() Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 0d60a2258e2..c7ec3fdb6af 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -1285,7 +1285,7 @@ void msg_close_file(struct messaging_context *msg_ctx, 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); diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 419296eb060..6674c2e5ae7 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -816,7 +816,7 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx, } /* 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", @@ -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. ****************************************************************************/ -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); @@ -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); - 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); diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 175b92bc1cd..96636696f91 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -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); -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);