1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

smbd: Pass "file_id" explicitly into share_mode_entry_to_message()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2018-02-07 11:36:51 +01:00 committed by Jeremy Allison
parent 5fdc62b236
commit fc424b28cd
4 changed files with 12 additions and 6 deletions

View 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, DBG_DEBUG("request to close file %s, %s\n", sharepath,
share_mode_str(talloc_tos(), 0, id, e)); 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( state->r->out.result = ntstatus_to_werror(
messaging_send_buf(state->msg_ctx, messaging_send_buf(state->msg_ctx,

View File

@ -1701,7 +1701,7 @@ NTSTATUS send_break_message(struct messaging_context *msg_ctx,
server_id_str_buf(exclusive->pid, &tmp))); server_id_str_buf(exclusive->pid, &tmp)));
/* Create the message. */ /* Create the message. */
share_mode_entry_to_message(msg, exclusive); share_mode_entry_to_message(msg, &exclusive->id, exclusive);
/* Overload entry->op_type */ /* Overload entry->op_type */
/* /*

View File

@ -1134,7 +1134,7 @@ static void send_break_to_none(struct messaging_context *msg_ctx,
{ {
char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE]; 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 */ /* Overload entry->op_type */
SSVAL(msg, OP_BREAK_MSG_OP_TYPE_OFFSET, NO_OPLOCK); 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. 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); SIVAL(msg,OP_BREAK_MSG_PID_OFFSET,(uint32_t)e->pid.pid);
SBVAL(msg,OP_BREAK_MSG_MID_OFFSET,e->op_mid); 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_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_SEC_OFFSET,(uint32_t)e->time.tv_sec);
SIVAL(msg,OP_BREAK_MSG_TIME_USEC_OFFSET,(uint32_t)e->time.tv_usec); 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_FILE_ID_OFFSET,e->share_file_id);
SIVAL(msg,OP_BREAK_MSG_UID_OFFSET,e->uid); SIVAL(msg,OP_BREAK_MSG_UID_OFFSET,e->uid);
SSVAL(msg,OP_BREAK_MSG_FLAGS_OFFSET,e->flags); SSVAL(msg,OP_BREAK_MSG_FLAGS_OFFSET,e->flags);

View File

@ -722,7 +722,8 @@ void smbd_contend_level2_oplocks_begin(files_struct *fsp,
enum level2_contention_type type); enum level2_contention_type type);
void smbd_contend_level2_oplocks_end(files_struct *fsp, void smbd_contend_level2_oplocks_end(files_struct *fsp,
enum level2_contention_type type); 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); void message_to_share_mode_entry(struct share_mode_entry *e, const char *msg);
bool init_oplocks(struct smbd_server_connection *sconn); bool init_oplocks(struct smbd_server_connection *sconn);
void init_kernel_oplocks(struct smbd_server_connection *sconn); void init_kernel_oplocks(struct smbd_server_connection *sconn);