mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
messaging3: Avoid messaging_is_self_send
This was a bad API, and it was used in a buggy way: In messaging_dispatch_rec we always did the defer, we referenced the destination pid, not the source. In messaging_send_iov this is the right thing to do to reference the destination, but when we have arrived in messaging_dispatch_rec we should compare source and destination. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
46e912210d
commit
20ef305cfa
@ -403,13 +403,6 @@ void messaging_deregister(struct messaging_context *ctx, uint32_t msg_type,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool messaging_is_self_send(const struct messaging_context *msg_ctx,
|
|
||||||
const struct server_id *dst)
|
|
||||||
{
|
|
||||||
return ((msg_ctx->id.vnn == dst->vnn) &&
|
|
||||||
(msg_ctx->id.pid == dst->pid));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Send a message to a particular server
|
Send a message to a particular server
|
||||||
*/
|
*/
|
||||||
@ -455,10 +448,14 @@ NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
|
|||||||
return NT_STATUS_OK;
|
return NT_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messaging_is_self_send(msg_ctx, &server)) {
|
if (server_id_same_process(&msg_ctx->id, &server)) {
|
||||||
struct messaging_rec rec;
|
struct messaging_rec rec;
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Self-send, directly dispatch
|
||||||
|
*/
|
||||||
|
|
||||||
buf = iov_buf(talloc_tos(), iov, iovlen);
|
buf = iov_buf(talloc_tos(), iov, iovlen);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return NT_STATUS_NO_MEMORY;
|
return NT_STATUS_NO_MEMORY;
|
||||||
@ -827,7 +824,7 @@ void messaging_dispatch_rec(struct messaging_context *msg_ctx,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messaging_is_self_send(msg_ctx, &rec->dest)) {
|
if (server_id_same_process(&rec->src, &rec->dest)) {
|
||||||
/*
|
/*
|
||||||
* This is a self-send. We are called here from
|
* This is a self-send. We are called here from
|
||||||
* messaging_send(), and we don't want to directly
|
* messaging_send(), and we don't want to directly
|
||||||
|
Loading…
Reference in New Issue
Block a user