summaryrefslogtreecommitdiffstats
path: root/source3/lib/messages.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-11-12 16:42:59 +0100
committerJeremy Allison <jra@samba.org>2014-12-16 18:56:03 +0100
commit28f750643bac2049eeeaab23d7d2d9a5a6256bcd (patch)
tree9746c544081fced7301720be00bf7689c6c021c6 /source3/lib/messages.c
parentd9a8453bbf69567236038e62f1c5cc4df25d899b (diff)
downloadsamba-28f750643bac2049eeeaab23d7d2d9a5a6256bcd.tar.gz
samba-28f750643bac2049eeeaab23d7d2d9a5a6256bcd.tar.xz
samba-28f750643bac2049eeeaab23d7d2d9a5a6256bcd.zip
messaging3: Add messaging_send_iov_from
In the notifyd code it will be very helpful to fake source server_ids Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/lib/messages.c')
-rw-r--r--source3/lib/messages.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 2711468718..0866e7d38c 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -489,16 +489,17 @@ NTSTATUS messaging_send_buf(struct messaging_context *msg_ctx,
return messaging_send(msg_ctx, server, msg_type, &blob);
}
-NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
- struct server_id server, uint32_t msg_type,
- const struct iovec *iov, int iovlen,
- const int *fds, size_t num_fds)
+NTSTATUS messaging_send_iov_from(struct messaging_context *msg_ctx,
+ struct server_id src, struct server_id dst,
+ uint32_t msg_type,
+ const struct iovec *iov, int iovlen,
+ const int *fds, size_t num_fds)
{
int ret;
struct messaging_hdr hdr;
struct iovec iov2[iovlen+1];
- if (server_id_is_disconnected(&server)) {
+ if (server_id_is_disconnected(&dst)) {
return NT_STATUS_INVALID_PARAMETER_MIX;
}
@@ -506,12 +507,12 @@ NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
return NT_STATUS_INVALID_PARAMETER_MIX;
}
- if (!procid_is_local(&server)) {
+ if (!procid_is_local(&dst)) {
if (num_fds > 0) {
return NT_STATUS_NOT_SUPPORTED;
}
- ret = msg_ctx->remote->send_fn(msg_ctx->id, server,
+ ret = msg_ctx->remote->send_fn(src, dst,
msg_type, iov, iovlen,
NULL, 0,
msg_ctx->remote);
@@ -524,14 +525,14 @@ NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
ZERO_STRUCT(hdr);
hdr = (struct messaging_hdr) {
.msg_type = msg_type,
- .dst = server,
- .src = msg_ctx->id
+ .dst = dst,
+ .src = src
};
iov2[0] = (struct iovec){ .iov_base = &hdr, .iov_len = sizeof(hdr) };
memcpy(&iov2[1], iov, iovlen * sizeof(*iov));
become_root();
- ret = messaging_dgm_send(server.pid, iov2, iovlen+1, fds, num_fds);
+ ret = messaging_dgm_send(dst.pid, iov2, iovlen+1, fds, num_fds);
unbecome_root();
if (ret != 0) {
@@ -540,6 +541,15 @@ NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
return NT_STATUS_OK;
}
+NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
+ struct server_id dst, uint32_t msg_type,
+ const struct iovec *iov, int iovlen,
+ const int *fds, size_t num_fds)
+{
+ return messaging_send_iov_from(msg_ctx, msg_ctx->id, dst, msg_type,
+ iov, iovlen, fds, num_fds);
+}
+
static struct messaging_rec *messaging_rec_dup(TALLOC_CTX *mem_ctx,
struct messaging_rec *rec)
{