[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Feb 13 04:02:02 UTC 2018


The branch, master has been updated
       via  3bbc575 smbd: remove "id" from share_mode_entry
       via  f7e6571 smbd: Pass "file_id" explicitly to send_break_to_none
       via  1e2659e smbd: Pass "file_id" explicitly to send_break_message()
       via  9d7701c srvsvc: Avoid a dependency on share_mode_entry->id
       via  d9e5148 smbd: Avoid a dependency on share_mode_entry->id
       via  ddb1524 smbd: Avoid a dependency on share_mode_entry->id
       via  b7e29d0 smbd: Pass "file_id" explicitly to message_to_share_mode_entry()
       via  fc424b2 smbd: Pass "file_id" explicitly into share_mode_entry_to_message()
       via  5fdc62b smbd: Remove a redundant check
       via  bab8bf7 smbd: Use "share_mode_data->id", not "share_mode_entry->id"
       via  c1079e3 srvsvc: Use the passed-in file_id
       via  3434b32 smbd: Pass in "file_id" into validate_my_share_entries
       via  9487510 smbd: Pass in "file_id" into share_mode_str()
       via  786e307 srvsvc: Use the passed-in file id, not the one from share_mode_entry
       via  f519162 smbd: Pass "file_id" through share_entry_forall
       via  e6187be smbd: Fix a signed/unsigned hickup
      from  1e8ad19 winbindd: Initialize the domain groups member

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3bbc57564411b031bf3ce55652c9c899642da045
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 14:32:37 2018 +0100

    smbd: remove "id" from share_mode_entry
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Feb 13 05:01:38 CET 2018 on sn-devel-144

commit f7e65719a4bc5fa2bede491d40a610b28f873c8a
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 12:28:13 2018 +0100

    smbd: Pass "file_id" explicitly to send_break_to_none
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 1e2659e96d4a309e76d1fc2a5a3dabb83a258127
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 12:24:35 2018 +0100

    smbd: Pass "file_id" explicitly to send_break_message()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9d7701c923bce11c05c879ea3f7cdd2322e3d2bd
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 12:16:10 2018 +0100

    srvsvc: Avoid a dependency on share_mode_entry->id
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d9e51484703e7ff510c534c603d30975d87c895c
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 12:11:10 2018 +0100

    smbd: Avoid a dependency on share_mode_entry->id
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ddb1524669681bffc86090432f01a21621d11d2f
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 11:40:58 2018 +0100

    smbd: Avoid a dependency on share_mode_entry->id
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b7e29d04c6156a6eb5c02b12e53abd1a04d75471
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 11:39:32 2018 +0100

    smbd: Pass "file_id" explicitly to message_to_share_mode_entry()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit fc424b28cd54f4ff5737417db1e1f8059cad80db
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 11:36:51 2018 +0100

    smbd: Pass "file_id" explicitly into share_mode_entry_to_message()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5fdc62b2369b8463940629dc47c2768f0bcfc29d
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 11:14:31 2018 +0100

    smbd: Remove a redundant check
    
    The file ids in all share modes match the share_mode_data's one
    
    We don't have a paranoia check for this, but the share mode is per inode.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit bab8bf7acb71bc54c258c29e7392927afb8b0709
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 11:13:40 2018 +0100

    smbd: Use "share_mode_data->id", not "share_mode_entry->id"
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c1079e3d2a9dd10b11e6b7c9b9852518ea637bb5
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 11:10:14 2018 +0100

    srvsvc: Use the passed-in file_id
    
    The one in share_mode_entry will go
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3434b32b88e656e767a0a1d2fa3988b2fb2311b0
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 11:09:10 2018 +0100

    smbd: Pass in "file_id" into validate_my_share_entries
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9487510e9e1269e70d4c4fbc44316f0c8758be03
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 11:05:33 2018 +0100

    smbd: Pass in "file_id" into share_mode_str()
    
    This used to directly access share_entry->id, which will go
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 786e307fd433065c097915a9d98fc71b4afbab14
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 10:52:23 2018 +0100

    srvsvc: Use the passed-in file id, not the one from share_mode_entry
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f51916265777189eafd7d8d73166fc52287f2878
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 10:43:11 2018 +0100

    smbd: Pass "file_id" through share_entry_forall
    
    It's also in the share_entry, but that is redundant and will go
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e6187be11846239f1a0e6e76aa3812a52406989a
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 7 10:05:57 2018 +0100

    smbd: Fix a signed/unsigned hickup
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/librpc/idl/open_files.idl         |  1 -
 source3/locking/locking.c                 | 14 ++++++-------
 source3/locking/proto.h                   |  5 ++++-
 source3/locking/share_mode_lock.c         |  3 +++
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 15 ++++++++------
 source3/smbd/close.c                      |  7 ++++---
 source3/smbd/open.c                       | 29 +++++++++++++++------------
 source3/smbd/oplock.c                     | 33 +++++++++++++++++++++----------
 source3/smbd/proto.h                      | 12 +++++++----
 source3/smbd/smb2_setinfo.c               |  3 ++-
 source3/utils/status.c                    |  1 +
 11 files changed, 76 insertions(+), 47 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/librpc/idl/open_files.idl b/source3/librpc/idl/open_files.idl
index 1f85f24..8d652a9 100644
--- a/source3/librpc/idl/open_files.idl
+++ b/source3/librpc/idl/open_files.idl
@@ -51,7 +51,6 @@ interface open_files
 		uint32		share_access;
 		uint32		private_options;
 		timeval		time;
-		file_id		id;
 		udlong		share_file_id;
 		uint32		uid;
 		uint16		flags;
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 4e9f1bb..791878c 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -425,7 +425,9 @@ void locking_close_file(struct messaging_context *msg_ctx,
  Print out a share mode.
 ********************************************************************/
 
-char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e)
+char *share_mode_str(TALLOC_CTX *ctx, int num,
+		     const struct file_id *id,
+		     const struct share_mode_entry *e)
 {
 	struct server_id_buf tmp;
 
@@ -439,7 +441,7 @@ char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e)
 		 e->access_mask, (unsigned long long)e->op_mid,
 		 e->op_type, (unsigned long long)e->share_file_id,
 		 (unsigned int)e->uid, (unsigned int)e->flags,
-		 file_id_string_tos(&e->id),
+		 file_id_string_tos(id),
 		 (unsigned int)e->name_hash);
 }
 
@@ -720,7 +722,7 @@ static void remove_share_mode_lease(struct share_mode_data *d,
 
 		status = leases_db_del(&client_guid,
 					&lease_key,
-					&e->id);
+					&d->id);
 
 		DEBUG(10, ("%s: leases_db_del returned %s\n", __func__,
 			   nt_errstr(status)));
@@ -845,7 +847,6 @@ bool set_share_mode(struct share_mode_lock *lck, struct files_struct *fsp,
 	e->lease = lease;
 	e->time.tv_sec = fsp->open_time.tv_sec;
 	e->time.tv_usec = fsp->open_time.tv_usec;
-	e->id = fsp->file_id;
 	e->share_file_id = fsp->fh->gen_id;
 	e->uid = (uint32_t)uid;
 	e->flags = (fsp->posix_flags & FSP_POSIX_FLAGS_OPEN) ?
@@ -860,7 +861,7 @@ struct share_mode_entry *find_share_mode_entry(
 {
 	struct share_mode_data *d = lck->data;
 	struct server_id pid;
-	int i;
+	uint32_t i;
 
 	pid = messaging_server_id(fsp->conn->sconn->msg_ctx);
 
@@ -873,9 +874,6 @@ struct share_mode_entry *find_share_mode_entry(
 		if (!serverid_equal(&pid, &e->pid)) {
 			continue;
 		}
-		if (!file_id_equal(&fsp->file_id, &e->id)) {
-			continue;
-		}
 		if (fsp->fh->gen_id != e->share_file_id) {
 			continue;
 		}
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index 33184e0..afd5373 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -140,7 +140,9 @@ void locking_close_file(struct messaging_context *msg_ctx,
 bool locking_init(void);
 bool locking_init_readonly(void);
 bool locking_end(void);
-char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e);
+char *share_mode_str(TALLOC_CTX *ctx, int num,
+		     const struct file_id *id,
+		     const struct share_mode_entry *e);
 struct share_mode_lock *get_existing_share_mode_lock(TALLOC_CTX *mem_ctx,
 						     struct file_id id);
 struct share_mode_lock *get_share_mode_lock(
@@ -210,6 +212,7 @@ int share_mode_forall(int (*fn)(struct file_id fid,
 				void *private_data),
 		      void *private_data);
 int share_entry_forall(int (*fn)(const struct share_mode_entry *,
+				 const struct file_id *id,
 				 const char *, const char *,
 				 const char *, void *),
 		      void *private_data);
diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
index cee0045..fce0c33 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -879,6 +879,7 @@ int share_mode_forall(int (*fn)(struct file_id fid,
 
 struct share_entry_forall_state {
 	int (*fn)(const struct share_mode_entry *e,
+		  const struct file_id *id,
 		  const char *service_path,
 		  const char *base_name,
 		  const char *stream_name,
@@ -897,6 +898,7 @@ static int share_entry_traverse_fn(struct file_id fid,
 		int ret;
 
 		ret = state->fn(&data->share_modes[i],
+				&data->id,
 				data->servicepath,
 				data->base_name,
 				data->stream_name,
@@ -915,6 +917,7 @@ static int share_entry_traverse_fn(struct file_id fid,
 ********************************************************************/
 
 int share_entry_forall(int (*fn)(const struct share_mode_entry *,
+				 const struct file_id *id,
 				 const char *, const char *,
 				 const char *, void *),
 		       void *private_data)
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index 2ff8e64..6536e3d 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -82,6 +82,7 @@ struct share_conn_stat {
 ********************************************************************/
 
 static int enum_file_fn(const struct share_mode_entry *e,
+			const struct file_id *id,
 			const char *sharepath,
 			const char *fname,
 			const char *sname,
@@ -123,7 +124,7 @@ static int enum_file_fn(const struct share_mode_entry *e,
 	/* need to count the number of locks on a file */
 
 	ZERO_STRUCT( fsp );
-	fsp.file_id = e->id;
+	fsp.file_id = *id;
 
 	if ( (brl = brl_get_locks(talloc_tos(), &fsp)) != NULL ) {
 		num_locks = brl_num_locks(brl);
@@ -173,7 +174,7 @@ static WERROR net_enum_files(TALLOC_CTX *ctx,
 	f_enum_cnt.username = username;
 	f_enum_cnt.ctr3 = *ctr3;
 
-	share_entry_forall( enum_file_fn, (void *)&f_enum_cnt );
+	share_entry_forall(enum_file_fn, (void *)&f_enum_cnt );
 
 	*ctr3 = f_enum_cnt.ctr3;
 
@@ -841,6 +842,7 @@ static WERROR init_srv_sess_info_0(struct pipes_struct *p,
  **********************************************************************/
 
 static int count_sess_files_fn(const struct share_mode_entry *e,
+			       const struct file_id *id,
 			       const char *sharepath,
 			       const char *fname,
 			       const char *sname,
@@ -968,6 +970,7 @@ static WERROR init_srv_sess_info_1(struct pipes_struct *p,
  ********************************************************************/
 
 static int share_file_fn(const struct share_mode_entry *e,
+			 const struct file_id *id,
 			 const char *sharepath,
 			 const char *fname,
 			 const char *sname,
@@ -2699,6 +2702,7 @@ struct enum_file_close_state {
 };
 
 static int enum_file_close_fn(const struct share_mode_entry *e,
+			      const struct file_id *id,
 			      const char *sharepath,
 			      const char *fname,
 			      const char *sname,
@@ -2718,11 +2722,10 @@ static int enum_file_close_fn(const struct share_mode_entry *e,
 	}
 
 	/* Ok - send the close message. */
-	DEBUG(10,("enum_file_close_fn: request to close file %s, %s\n",
-		sharepath,
-		share_mode_str(talloc_tos(), 0, 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, id, e);
 
 	state->r->out.result = ntstatus_to_werror(
 		messaging_send_buf(state->msg_ctx,
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 2f6cc4f..3324d3e 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -1280,15 +1280,16 @@ void msg_close_file(struct messaging_context *msg_ctx,
 			DATA_BLOB *data)
 {
 	files_struct *fsp = NULL;
+	struct file_id id;
 	struct share_mode_entry e;
 	struct smbd_server_connection *sconn =
 		talloc_get_type_abort(private_data,
 		struct smbd_server_connection);
 
-	message_to_share_mode_entry(&e, (char *)data->data);
+	message_to_share_mode_entry(&id, &e, (char *)data->data);
 
 	if(DEBUGLVL(10)) {
-		char *sm_str = share_mode_str(NULL, 0, &e);
+		char *sm_str = share_mode_str(NULL, 0, &id, &e);
 		if (!sm_str) {
 			smb_panic("talloc failed");
 		}
@@ -1297,7 +1298,7 @@ void msg_close_file(struct messaging_context *msg_ctx,
 		TALLOC_FREE(sm_str);
 	}
 
-	fsp = file_find_dif(sconn, e.id, e.share_file_id);
+	fsp = file_find_dif(sconn, id, e.share_file_id);
 	if (!fsp) {
 		DEBUG(10,("msg_close_file: failed to find file.\n"));
 		return;
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 5817bdb..be9e601 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1544,6 +1544,7 @@ sa = 0x%x, share = 0x%x\n", (num), (unsigned int)(am), (unsigned int)(right), (u
 
 #if defined(DEVELOPER)
 static void validate_my_share_entries(struct smbd_server_connection *sconn,
+				      const struct file_id id,
 				      int num,
 				      struct share_mode_entry *share_entry)
 {
@@ -1563,11 +1564,11 @@ static void validate_my_share_entries(struct smbd_server_connection *sconn,
 		return;
 	}
 
-	fsp = file_find_dif(sconn, share_entry->id,
-			    share_entry->share_file_id);
+	fsp = file_find_dif(sconn, id, share_entry->share_file_id);
 	if (!fsp) {
-		DEBUG(0,("validate_my_share_entries: PANIC : %s\n",
-			 share_mode_str(talloc_tos(), num, share_entry) ));
+		DBG_ERR("PANIC : %s\n",
+			share_mode_str(talloc_tos(), num, &id,
+				       share_entry));
 		smb_panic("validate_my_share_entries: Cannot match a "
 			  "share entry with an open file\n");
 	}
@@ -1581,8 +1582,9 @@ static void validate_my_share_entries(struct smbd_server_connection *sconn,
  panic:
 	{
 		char *str;
-		DEBUG(0,("validate_my_share_entries: PANIC : %s\n",
-			 share_mode_str(talloc_tos(), num, share_entry) ));
+		DBG_ERR("validate_my_share_entries: PANIC : %s\n",
+			share_mode_str(talloc_tos(), num, &id,
+				       share_entry));
 		str = talloc_asprintf(talloc_tos(),
 			"validate_my_share_entries: "
 			"file %s, oplock_type = 0x%x, op_type = 0x%x\n",
@@ -1654,7 +1656,7 @@ static NTSTATUS open_mode_check(connection_struct *conn,
 
 #if defined(DEVELOPER)
 	for(i = 0; i < lck->data->num_share_modes; i++) {
-		validate_my_share_entries(conn->sconn, i,
+		validate_my_share_entries(conn->sconn, lck->data->id, i,
 					  &lck->data->share_modes[i]);
 	}
 #endif
@@ -1688,8 +1690,9 @@ static NTSTATUS open_mode_check(connection_struct *conn,
  */
 
 NTSTATUS send_break_message(struct messaging_context *msg_ctx,
-				   const struct share_mode_entry *exclusive,
-				   uint16_t break_to)
+			    const struct file_id *id,
+			    const struct share_mode_entry *exclusive,
+			    uint16_t break_to)
 {
 	NTSTATUS status;
 	char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];
@@ -1699,7 +1702,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, id, exclusive);
 
 	/* Overload entry->op_type */
 	/*
@@ -1925,8 +1928,8 @@ static bool delay_for_oplock(files_struct *fsp,
 
 		DEBUG(10, ("breaking from %d to %d\n",
 			   (int)e_lease_type, (int)break_to));
-		send_break_message(fsp->conn->sconn->msg_ctx, e,
-				   break_to);
+		send_break_message(fsp->conn->sconn->msg_ctx, &fsp->file_id,
+				   e, break_to);
 		if (e_lease_type & delay_mask) {
 			delay = true;
 		}
@@ -4981,7 +4984,7 @@ static NTSTATUS lease_match(connection_struct *conn,
 				continue;
 			}
 
-			send_break_message(conn->sconn->msg_ctx, e,
+			send_break_message(conn->sconn->msg_ctx, &d->id, e,
 					   SMB2_LEASE_NONE);
 
 			/*
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index e848b5e..0f95bb0 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -792,6 +792,7 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
 					 struct server_id src,
 					 DATA_BLOB *data)
 {
+	struct file_id id;
 	struct share_mode_entry msg;
 	files_struct *fsp;
 	bool use_kernel;
@@ -816,15 +817,15 @@ 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(&id, &msg, (char *)data->data);
 	break_to = msg.op_type;
 
 	DEBUG(10, ("Got oplock break to %u message from pid %s: %s/%llu\n",
 		   (unsigned)break_to, server_id_str_buf(src, &tmp),
-		   file_id_string_tos(&msg.id),
+		   file_id_string_tos(&id),
 		   (unsigned long long)msg.share_file_id));
 
-	fsp = initial_break_processing(sconn, msg.id, msg.share_file_id);
+	fsp = initial_break_processing(sconn, id, msg.share_file_id);
 
 	if (fsp == NULL) {
 		/* We hit a race here. Break messages are sent, and before we
@@ -1130,11 +1131,12 @@ static void contend_level2_oplocks_begin_default(files_struct *fsp,
 }
 
 static void send_break_to_none(struct messaging_context *msg_ctx,
+			       const struct file_id *id,
 			       const struct share_mode_entry *e)
 {
 	char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];
 
-	share_mode_entry_to_message(msg, e);
+	share_mode_entry_to_message(msg, id, e);
 	/* Overload entry->op_type */
 	SSVAL(msg, OP_BREAK_MSG_OP_TYPE_OFFSET, NO_OPLOCK);
 
@@ -1202,7 +1204,7 @@ static void do_break_to_none(struct tevent_context *ctx,
 		DEBUG(10, ("Breaking lease# %"PRIu32" with share_entry# "
 			   "%"PRIu32"\n", i, j));
 
-		send_break_to_none(state->sconn->msg_ctx, e);
+		send_break_to_none(state->sconn->msg_ctx, &state->id, e);
 	}
 
 	for(i = 0; i < d->num_share_modes; i++) {
@@ -1245,7 +1247,7 @@ static void do_break_to_none(struct tevent_context *ctx,
 			abort();
 		}
 
-		send_break_to_none(state->sconn->msg_ctx, e);
+		send_break_to_none(state->sconn->msg_ctx, &state->id, e);
 	}
 
 	/* We let the message receivers handle removing the oplock state
@@ -1291,7 +1293,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 +1304,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);
@@ -1313,7 +1320,9 @@ void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e)
  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);
@@ -1323,7 +1332,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 fe37640..4417595 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -651,8 +651,9 @@ void change_file_owner_to_parent(connection_struct *conn,
 				 files_struct *fsp);
 bool is_stat_open(uint32_t access_mask);
 NTSTATUS send_break_message(struct messaging_context *msg_ctx,
-				const struct share_mode_entry *exclusive,
-				uint16_t break_to);
+			    const struct file_id *id,
+			    const struct share_mode_entry *exclusive,
+			    uint16_t break_to);
 struct deferred_open_record;
 bool is_deferred_open_async(const struct deferred_open_record *rec);
 NTSTATUS create_directory(connection_struct *conn, struct smb_request *req,
@@ -722,8 +723,11 @@ 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 message_to_share_mode_entry(struct share_mode_entry *e, const char *msg);
+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_setinfo.c b/source3/smbd/smb2_setinfo.c
index 0355095..996e4f2 100644
--- a/source3/smbd/smb2_setinfo.c
+++ b/source3/smbd/smb2_setinfo.c
@@ -226,7 +226,8 @@ static struct tevent_req *delay_rename_for_lease_break(struct tevent_req *req,
 		delay = true;
 		break_to = (e_lease_type & ~SMB2_LEASE_HANDLE);
 
-		send_break_message(fsp->conn->sconn->msg_ctx, e, break_to);
+		send_break_message(fsp->conn->sconn->msg_ctx, &fsp->file_id,
+				   e, break_to);
 	}
 
 	if (!delay) {
diff --git a/source3/utils/status.c b/source3/utils/status.c
index dfb1d92..beae85c 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -117,6 +117,7 @@ static bool Ucrit_addPid( struct server_id pid )
 }
 
 static int print_share_mode(const struct share_mode_entry *e,
+			    const struct file_id *id,
 			    const char *sharepath,
 			    const char *fname,
 			    const char *sname,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list