[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Thu Oct 13 13:33:02 UTC 2022


The branch, master has been updated
       via  266bcedc18e s4:messaging: let imessaging_client_init() use imessaging_init_discard_incoming()
       via  32df5e4961c s3:auth_samba4: make use of imessaging_init_discard_incoming()
       via  a120fb1c724 s4:messaging: add imessaging_init_discard_incoming()
       via  5d91ecf01dc vfs_glusterfs: Add path based fallback mechanism for SMB_VFS_FNTIMES
       via  5d66d5b84f8 smbXsrv_client: handle NAME_NOT_FOUND from smb2srv_client_connection_{pass,drop}()
       via  8c8d8cf01e0 smbXsrv_client: make sure we only wait for smb2srv_client_mc_negprot_filter once and only when needed
       via  56c597bc2b2 smbXsrv_client: call smb2srv_client_connection_{pass,drop}() before dbwrap_watched_watch_send()
       via  acb3d821dea smbXsrv_client: fix a debug message in smbXsrv_client_global_verify_record()
       via  636ec45c93a smbXsrv_client: ignore NAME_NOT_FOUND from smb2srv_client_connection_passed
      from  cc397175cb9 vfs_glusterfs: Simplify SMB_VFS_FDOPENDIR implementation

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


- Log -----------------------------------------------------------------
commit 266bcedc18efc52e29efde6bad220623a5423e30
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Sep 28 14:27:09 2022 +0200

    s4:messaging: let imessaging_client_init() use imessaging_init_discard_incoming()
    
    imessaging_client_init() is for temporary stuff only, so we should drop
    (unexpected) incoming messages unless we expect irpc responses.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15201
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Thu Oct 13 13:32:30 UTC 2022 on sn-devel-184

commit 32df5e4961cf064b72bb496157cc6092126d9b8e
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Sep 28 14:14:41 2022 +0200

    s3:auth_samba4: make use of imessaging_init_discard_incoming()
    
    Otherwise we'll generate a memory leak of imessaging_post_state/
    tevent_immediate structures per incoming message!
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15201
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit a120fb1c724dfaed5a99e34aaf979502586f17c0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Sep 28 13:47:13 2022 +0200

    s4:messaging: add imessaging_init_discard_incoming()
    
    We often create imessaging contexts just for sending messages,
    but we'll never process incoming messages because a temporary event
    context was used and we just queue a lot of imessaging_post_state
    structures with immediate events.
    
    With imessaging_init_discard_incoming() we'll discard any incoming messages
    unless we have pending irpc requests.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15201
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 5d91ecf01dce95400da5d6ac181144df1e32ca35
Author: Anoop C S <anoopcs at samba.org>
Date:   Thu Oct 13 15:54:10 2022 +0530

    vfs_glusterfs: Add path based fallback mechanism for SMB_VFS_FNTIMES
    
    Fallback mechanism was missing in vfs_gluster_fntimes() for path based
    call. Therefore adding a similar mechanism as seen with other calls like
    vfs_gluster_fsetxattr, vfs_gluster_fgetxattr etc.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15198
    
    Signed-off-by: Anoop C S <anoopcs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 5d66d5b84f87267243dcd5223210906ce589af91
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Oct 12 14:57:18 2022 +0200

    smbXsrv_client: handle NAME_NOT_FOUND from smb2srv_client_connection_{pass,drop}()
    
    If we get NT_STATUS_OBJECT_NOT_FOUND from smb2srv_client_connection_{pass,drop}()
    we should just keep the connection and overwrite the stale record in
    smbXsrv_client_global.tdb. It's basically a race with serverid_exists()
    and a process that doesn't cleanly teardown.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 8c8d8cf01e01c2726d03fa1c81e0ce9992ee736c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Oct 12 14:15:53 2022 +0200

    smbXsrv_client: make sure we only wait for smb2srv_client_mc_negprot_filter once and only when needed
    
    This will simplify the following changes...
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 56c597bc2b29dc3e555f737ba189f521d0e31e8c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Oct 12 13:54:41 2022 +0200

    smbXsrv_client: call smb2srv_client_connection_{pass,drop}() before dbwrap_watched_watch_send()
    
    dbwrap_watched_watch_send() should typically be the last thing to call
    before the db record is unlocked, as it's not that easy to undo.
    
    In future we want to recover from smb2srv_client_connection_{pass,drop}()
    returning NT_STATUS_OBJECT_NAME_NOT_FOUND and it would add complexity if
    would need to undo dbwrap_watched_watch_send() at that point.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit acb3d821deaf06faa16f6428682ecdb02babeb98
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Oct 12 13:40:26 2022 +0200

    smbXsrv_client: fix a debug message in smbXsrv_client_global_verify_record()
    
    DBG_WARNING() already adds the function name as prefix.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 636ec45c93ad040ba70296aa543884c145b3e789
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Oct 12 13:30:32 2022 +0200

    smbXsrv_client: ignore NAME_NOT_FOUND from smb2srv_client_connection_passed
    
    If we hit a race, when a client disconnects the connection after the initial
    SMB2 Negotiate request, before the connection is completely passed to
    process serving the given client guid, the temporary smbd which accepted the
    new connection may already detected the disconnect and exitted before
    the long term smbd servicing the client guid was able to send the
    MSG_SMBXSRV_CONNECTION_PASSED message.
    
    The result was a log message like this:
    
      smbXsrv_client_connection_pass_loop: smb2srv_client_connection_passed() failed => NT_STATUS_OBJECT_NAME_NOT_FOUND
    
    and all connections belonging to the client guid were dropped,
    because we called exit_server_cleanly().
    
    Now we ignore NT_STATUS_OBJECT_NAME_NOT_FOUND from
    smb2srv_client_connection_passed() and let the normal
    event loop detect the broken connection, so that only
    that connection is terminated (not the whole smbd process).
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15200
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

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

Summary of changes:
 source3/auth/auth_samba4.c                 |  8 +--
 source3/modules/vfs_glusterfs.c            |  8 ++-
 source3/smbd/smbXsrv_client.c              | 99 ++++++++++++++++++++++++------
 source4/lib/messaging/messaging.c          | 74 +++++++++++++++++++++-
 source4/lib/messaging/messaging.h          |  5 ++
 source4/lib/messaging/messaging_internal.h |  9 +++
 6 files changed, 178 insertions(+), 25 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/auth/auth_samba4.c b/source3/auth/auth_samba4.c
index ff8dc94d296..6c017ef4aa3 100644
--- a/source3/auth/auth_samba4.c
+++ b/source3/auth/auth_samba4.c
@@ -241,12 +241,12 @@ static NTSTATUS prepare_gensec(const struct auth_context *auth_context,
 		return NT_STATUS_INVALID_SERVER_STATE;
 	}
 
-	msg_ctx = imessaging_init(frame,
+	msg_ctx = imessaging_init_discard_incoming(frame,
 				  lp_ctx,
 				  *server_id,
 				  event_ctx);
 	if (msg_ctx == NULL) {
-		DEBUG(1, ("imessaging_init failed\n"));
+		DEBUG(1, ("imessaging_init_discard_incoming failed\n"));
 		TALLOC_FREE(frame);
 		return NT_STATUS_INVALID_SERVER_STATE;
 	}
@@ -324,12 +324,12 @@ static NTSTATUS make_auth4_context_s4(const struct auth_context *auth_context,
 		return NT_STATUS_INVALID_SERVER_STATE;
 	}
 
-	msg_ctx = imessaging_init(frame,
+	msg_ctx = imessaging_init_discard_incoming(frame,
 				  lp_ctx,
 				  *server_id,
 				  event_ctx);
 	if (msg_ctx == NULL) {
-		DEBUG(1, ("imessaging_init failed\n"));
+		DEBUG(1, ("imessaging_init_discard_incoming failed\n"));
 		TALLOC_FREE(frame);
 		return NT_STATUS_INVALID_SERVER_STATE;
 	}
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 4b309de1377..31e606ba5d0 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -1772,7 +1772,13 @@ static int vfs_gluster_fntimes(struct vfs_handle_struct *handle,
 		return -1;
 	}
 
-	ret = glfs_futimens(glfd, times);
+	if (!fsp->fsp_flags.is_pathref) {
+		ret = glfs_futimens(glfd, times);
+	} else {
+		ret = glfs_utimens(handle->data,
+				   fsp->fsp_name->base_name,
+				   times);
+	}
 	END_PROFILE(syscall_fntimes);
 
 	return ret;
diff --git a/source3/smbd/smbXsrv_client.c b/source3/smbd/smbXsrv_client.c
index 14d00f4aca1..292690efb17 100644
--- a/source3/smbd/smbXsrv_client.c
+++ b/source3/smbd/smbXsrv_client.c
@@ -189,6 +189,7 @@ static void smbXsrv_client_global_verify_record(struct db_record *db_rec,
 					bool *is_free,
 					bool *was_free,
 					TALLOC_CTX *mem_ctx,
+					const struct server_id *dead_server_id,
 					struct smbXsrv_client_global0 **_g,
 					uint32_t *pseqnum)
 {
@@ -198,6 +199,7 @@ static void smbXsrv_client_global_verify_record(struct db_record *db_rec,
 	struct smbXsrv_client_globalB global_blob;
 	enum ndr_err_code ndr_err;
 	struct smbXsrv_client_global0 *global = NULL;
+	bool dead = false;
 	bool exists;
 	TALLOC_CTX *frame = talloc_stackframe();
 
@@ -231,8 +233,7 @@ static void smbXsrv_client_global_verify_record(struct db_record *db_rec,
 			(ndr_pull_flags_fn_t)ndr_pull_smbXsrv_client_globalB);
 	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 		NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
-		DBG_WARNING("smbXsrv_client_global_verify_record: "
-			    "key '%s' ndr_pull_struct_blob - %s\n",
+		DBG_WARNING("key '%s' ndr_pull_struct_blob - %s\n",
 			    hex_encode_talloc(frame, key.dptr, key.dsize),
 			    nt_errstr(status));
 		TALLOC_FREE(frame);
@@ -255,6 +256,22 @@ static void smbXsrv_client_global_verify_record(struct db_record *db_rec,
 
 	global = global_blob.info.info0;
 
+	dead = server_id_equal(dead_server_id, &global->server_id);
+	if (dead) {
+		struct server_id_buf tmp;
+
+		DBG_NOTICE("key '%s' server_id %s is already dead.\n",
+			   hex_encode_talloc(frame, key.dptr, key.dsize),
+			   server_id_str_buf(global->server_id, &tmp));
+		if (DEBUGLVL(DBGLVL_NOTICE)) {
+			NDR_PRINT_DEBUG(smbXsrv_client_globalB, &global_blob);
+		}
+		TALLOC_FREE(frame);
+		dbwrap_record_delete(db_rec);
+		*is_free = true;
+		return;
+	}
+
 	exists = serverid_exists(&global->server_id);
 	if (!exists) {
 		struct server_id_buf tmp;
@@ -472,6 +489,7 @@ struct smb2srv_client_mc_negprot_state {
 	struct db_record *db_rec;
 	uint64_t watch_instance;
 	uint32_t last_seqnum;
+	struct tevent_req *filter_subreq;
 };
 
 static void smb2srv_client_mc_negprot_cleanup(struct tevent_req *req,
@@ -534,7 +552,9 @@ static void smb2srv_client_mc_negprot_next(struct tevent_req *req)
 	struct tevent_req *subreq = NULL;
 	NTSTATUS status;
 	uint32_t seqnum = 0;
+	struct server_id last_server_id = { .pid = 0, };
 
+	TALLOC_FREE(state->filter_subreq);
 	SMB_ASSERT(state->db_rec == NULL);
 	state->db_rec = smbXsrv_client_global_fetch_locked(table->global.db_ctx,
 							   &client_guid,
@@ -544,10 +564,14 @@ static void smb2srv_client_mc_negprot_next(struct tevent_req *req)
 		return;
 	}
 
+verify_again:
+	TALLOC_FREE(global);
+
 	smbXsrv_client_global_verify_record(state->db_rec,
 					    &is_free,
 					    NULL,
 					    state,
+					    &last_server_id,
 					    &global,
 					    &seqnum);
 	if (is_free) {
@@ -601,6 +625,16 @@ static void smb2srv_client_mc_negprot_next(struct tevent_req *req)
 		return;
 	}
 
+	/*
+	 * If last_server_id is set, we expect
+	 * smbXsrv_client_global_verify_record()
+	 * to detect the already dead global->server_id
+	 * as state->db_rec is still locked and its
+	 * value didn't change.
+	 */
+	SMB_ASSERT(last_server_id.pid == 0);
+	last_server_id = global->server_id;
+
 	if (procid_is_local(&global->server_id)) {
 		subreq = messaging_filtered_read_send(state,
 						      state->ev,
@@ -611,6 +645,37 @@ static void smb2srv_client_mc_negprot_next(struct tevent_req *req)
 			return;
 		}
 		tevent_req_set_callback(subreq, smb2srv_client_mc_negprot_done, req);
+		state->filter_subreq = subreq;
+	}
+
+	if (procid_is_local(&global->server_id)) {
+		status = smb2srv_client_connection_pass(state->smb2req,
+							global);
+		if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+			/*
+			 * We remembered last_server_id = global->server_id
+			 * above, so we'll treat it as dead in the
+			 * next round to smbXsrv_client_global_verify_record().
+			 */
+			goto verify_again;
+		}
+		if (tevent_req_nterror(req, status)) {
+			return;
+		}
+	} else {
+		status = smb2srv_client_connection_drop(state->smb2req,
+							global);
+		if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+			/*
+			 * We remembered last_server_id = global->server_id
+			 * above, so we'll treat it as dead in the
+			 * next round to smbXsrv_client_global_verify_record().
+			 */
+			goto verify_again;
+		}
+		if (tevent_req_nterror(req, status)) {
+			return;
+		}
 	}
 
 	/*
@@ -644,22 +709,7 @@ static void smb2srv_client_mc_negprot_next(struct tevent_req *req)
 	}
 	tevent_req_set_callback(subreq, smb2srv_client_mc_negprot_watched, req);
 
-	if (procid_is_local(&global->server_id)) {
-		status = smb2srv_client_connection_pass(state->smb2req,
-							global);
-		TALLOC_FREE(global);
-		if (tevent_req_nterror(req, status)) {
-			return;
-		}
-	} else {
-		status = smb2srv_client_connection_drop(state->smb2req,
-							global);
-		TALLOC_FREE(global);
-		if (tevent_req_nterror(req, status)) {
-			return;
-		}
-	}
-
+	TALLOC_FREE(global);
 	TALLOC_FREE(state->db_rec);
 	return;
 }
@@ -694,6 +744,9 @@ static void smb2srv_client_mc_negprot_done(struct tevent_req *subreq)
 	NTSTATUS status;
 	int ret;
 
+	SMB_ASSERT(state->filter_subreq == subreq);
+	state->filter_subreq = NULL;
+
 	ret = messaging_filtered_read_recv(subreq, state, &rec);
 	TALLOC_FREE(subreq);
 	if (ret != 0) {
@@ -1111,6 +1164,16 @@ static void smbXsrv_client_connection_pass_loop(struct tevent_req *subreq)
 	}
 
 	status = smb2srv_client_connection_passed(client, pass_info0);
+	if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+		/*
+		 * We hit a race where, the client dropped the connection
+		 * while the socket was passed to us and the origin
+		 * process already existed.
+		 */
+		DBG_DEBUG("smb2srv_client_connection_passed() ignore %s\n",
+			  nt_errstr(status));
+		status = NT_STATUS_OK;
+	}
 	if (!NT_STATUS_IS_OK(status)) {
 		const char *r = "smb2srv_client_connection_passed() failed";
 		DBG_ERR("%s => %s\n", r, nt_errstr(status));
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index a00c35be0d5..8603c167ad4 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -429,6 +429,12 @@ static NTSTATUS imessaging_reinit(struct imessaging_context *msg)
 
 	TALLOC_FREE(msg->msg_dgm_ref);
 
+	if (msg->discard_incoming) {
+		msg->num_incoming_listeners = 0;
+	} else {
+		msg->num_incoming_listeners = 1;
+	}
+
 	msg->server_id.pid = getpid();
 
 	msg->msg_dgm_ref = messaging_dgm_ref(msg,
@@ -469,7 +475,9 @@ NTSTATUS imessaging_reinit_all(void)
 /*
   create the listening socket and setup the dispatcher
 */
-struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
+static struct imessaging_context *imessaging_init_internal(
+					   TALLOC_CTX *mem_ctx,
+					   bool discard_incoming,
 					   struct loadparm_context *lp_ctx,
 					   struct server_id server_id,
 					   struct tevent_context *ev)
@@ -490,6 +498,12 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
 		return NULL;
 	}
 	msg->ev = ev;
+	msg->discard_incoming = discard_incoming;
+	if (msg->discard_incoming) {
+		msg->num_incoming_listeners = 0;
+	} else {
+		msg->num_incoming_listeners = 1;
+	}
 
 	talloc_set_destructor(msg, imessaging_context_destructor);
 
@@ -601,6 +615,36 @@ fail:
 	return NULL;
 }
 
+/*
+  create the listening socket and setup the dispatcher
+*/
+struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
+					   struct loadparm_context *lp_ctx,
+					   struct server_id server_id,
+					   struct tevent_context *ev)
+{
+	bool discard_incoming = false;
+	return imessaging_init_internal(mem_ctx,
+					discard_incoming,
+					lp_ctx,
+					server_id,
+					ev);
+}
+
+struct imessaging_context *imessaging_init_discard_incoming(
+						TALLOC_CTX *mem_ctx,
+						struct loadparm_context *lp_ctx,
+						struct server_id server_id,
+						struct tevent_context *ev)
+{
+	bool discard_incoming = true;
+	return imessaging_init_internal(mem_ctx,
+					discard_incoming,
+					lp_ctx,
+					server_id,
+					ev);
+}
+
 struct imessaging_post_state {
 	struct imessaging_context *msg_ctx;
 	struct imessaging_post_state **busy_ref;
@@ -697,6 +741,22 @@ static void imessaging_dgm_recv(struct tevent_context *ev,
 		return;
 	}
 
+	if (msg->num_incoming_listeners == 0) {
+		struct server_id_buf selfbuf;
+
+		message_hdr_get(&msg_type, &src, &dst, buf);
+
+		DBG_DEBUG("not listening - discarding message from "
+			  "src[%s] to dst[%s] (self[%s]) type=0x%x "
+			  "on %s event context\n",
+			   server_id_str_buf(src, &srcbuf),
+			   server_id_str_buf(dst, &dstbuf),
+			   server_id_str_buf(msg->server_id, &selfbuf),
+			   (unsigned)msg_type,
+			   (ev != msg->ev) ? "different" : "main");
+		return;
+	}
+
 	if (ev != msg->ev) {
 		int ret;
 		ret = imessaging_post_self(msg, buf, buf_len);
@@ -758,8 +818,9 @@ struct imessaging_context *imessaging_client_init(TALLOC_CTX *mem_ctx,
 	/* This is because we are not in the s3 serverid database */
 	id.unique_id = SERVERID_UNIQUE_ID_NOT_TO_VERIFY;
 
-	return imessaging_init(mem_ctx, lp_ctx, id, ev);
+	return imessaging_init_discard_incoming(mem_ctx, lp_ctx, id, ev);
 }
+
 /*
   a list of registered irpc server functions
 */
@@ -975,6 +1036,12 @@ static int irpc_destructor(struct irpc_request *irpc)
 {
 	if (irpc->callid != -1) {
 		idr_remove(irpc->msg_ctx->idr, irpc->callid);
+		if (irpc->msg_ctx->discard_incoming) {
+			SMB_ASSERT(irpc->msg_ctx->num_incoming_listeners > 0);
+		} else {
+			SMB_ASSERT(irpc->msg_ctx->num_incoming_listeners > 1);
+		}
+		irpc->msg_ctx->num_incoming_listeners -= 1;
 		irpc->callid = -1;
 	}
 
@@ -1168,6 +1235,9 @@ static struct tevent_req *irpc_bh_raw_call_send(TALLOC_CTX *mem_ctx,
 	state->irpc->incoming.handler = irpc_bh_raw_call_incoming_handler;
 	state->irpc->incoming.private_data = req;
 
+	/* make sure we accept incoming messages */
+	SMB_ASSERT(state->irpc->msg_ctx->num_incoming_listeners < UINT64_MAX);
+	state->irpc->msg_ctx->num_incoming_listeners += 1;
 	talloc_set_destructor(state->irpc, irpc_destructor);
 
 	/* setup the header */
diff --git a/source4/lib/messaging/messaging.h b/source4/lib/messaging/messaging.h
index 3fd788d1e42..e7ae9e8cc46 100644
--- a/source4/lib/messaging/messaging.h
+++ b/source4/lib/messaging/messaging.h
@@ -49,6 +49,11 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
 					   struct loadparm_context *lp_ctx,
 					   struct server_id server_id,
 					   struct tevent_context *ev);
+struct imessaging_context *imessaging_init_discard_incoming(
+						TALLOC_CTX *mem_ctx,
+						struct loadparm_context *lp_ctx,
+						struct server_id server_id,
+						struct tevent_context *ev);
 void imessaging_dgm_unref_ev(struct tevent_context *ev);
 NTSTATUS imessaging_reinit_all(void);
 int imessaging_cleanup(struct imessaging_context *msg);
diff --git a/source4/lib/messaging/messaging_internal.h b/source4/lib/messaging/messaging_internal.h
index 5e99734ad60..ac254c22631 100644
--- a/source4/lib/messaging/messaging_internal.h
+++ b/source4/lib/messaging/messaging_internal.h
@@ -33,6 +33,15 @@ struct imessaging_context {
 	struct server_id_db *names;
 	struct timeval start_time;
 	void *msg_dgm_ref;
+	/*
+	 * The number of instances waiting for incoming
+	 * messages. By default it's always greater than 0.
+	 *
+	 * If it's 0 we'll discard incoming messages,
+	 * see imessaging_init_discard_imcoming().
+	 */
+	bool discard_incoming;
+	uint64_t num_incoming_listeners;
 };
 
 NTSTATUS imessaging_register_extra_handlers(struct imessaging_context *msg);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list