summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2014-05-17 15:19:18 +0200
committerMichael Adam <obnox@samba.org>2014-09-24 08:44:12 +0200
commit01026363dd0051eac00b555c5e0503a0484134cc (patch)
tree158c5f9bb2959366602e48fd91453cbbfedd8e61
parent16678391925335d84ac95de11158959cb20280bc (diff)
downloadsamba-01026363dd0051eac00b555c5e0503a0484134cc.tar.gz
samba-01026363dd0051eac00b555c5e0503a0484134cc.tar.xz
samba-01026363dd0051eac00b555c5e0503a0484134cc.zip
s3:messaging: add fds-array to messaging_send_iov()
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org>
-rw-r--r--source3/include/messages.h3
-rw-r--r--source3/lib/messages.c19
-rw-r--r--source3/smbd/notify_internal.c2
3 files changed, 19 insertions, 5 deletions
diff --git a/source3/include/messages.h b/source3/include/messages.h
index b7193d5a85..eb0943a95f 100644
--- a/source3/include/messages.h
+++ b/source3/include/messages.h
@@ -114,7 +114,8 @@ NTSTATUS messaging_send_buf(struct messaging_context *msg_ctx,
const uint8_t *buf, size_t len);
NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
struct server_id server, uint32_t msg_type,
- const struct iovec *iov, int iovlen);
+ const struct iovec *iov, int iovlen,
+ const int *fds, size_t num_fds);
void messaging_dispatch_rec(struct messaging_context *msg_ctx,
struct messaging_rec *rec);
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 0579dbf359..84147de0f6 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -442,7 +442,7 @@ NTSTATUS messaging_send(struct messaging_context *msg_ctx,
iov.iov_base = data->data;
iov.iov_len = data->length;
- return messaging_send_iov(msg_ctx, server, msg_type, &iov, 1);
+ return messaging_send_iov(msg_ctx, server, msg_type, &iov, 1, NULL, 0);
}
NTSTATUS messaging_send_buf(struct messaging_context *msg_ctx,
@@ -455,7 +455,8 @@ NTSTATUS messaging_send_buf(struct messaging_context *msg_ctx,
NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
struct server_id server, uint32_t msg_type,
- const struct iovec *iov, int iovlen)
+ const struct iovec *iov, int iovlen,
+ const int *fds, size_t num_fds)
{
int ret;
struct messaging_hdr hdr;
@@ -465,7 +466,15 @@ NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
return NT_STATUS_INVALID_PARAMETER_MIX;
}
+ if (num_fds > INT8_MAX) {
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ }
+
if (!procid_is_local(&server)) {
+ if (num_fds > 0) {
+ return NT_STATUS_NOT_SUPPORTED;
+ }
+
ret = msg_ctx->remote->send_fn(msg_ctx->id, server,
msg_type, iov, iovlen,
NULL, 0,
@@ -484,6 +493,10 @@ NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
* Self-send, directly dispatch
*/
+ if (num_fds > 0) {
+ return NT_STATUS_NOT_SUPPORTED;
+ }
+
buf = iov_buf(talloc_tos(), iov, iovlen);
if (buf == NULL) {
return NT_STATUS_NO_MEMORY;
@@ -511,7 +524,7 @@ NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
memcpy(&iov2[1], iov, iovlen * sizeof(*iov));
become_root();
- ret = messaging_dgm_send(server.pid, iov2, iovlen+1, NULL, 0);
+ ret = messaging_dgm_send(server.pid, iov2, iovlen+1, fds, num_fds);
unbecome_root();
if (ret != 0) {
diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c
index e902bf4f3e..2ba68d74bc 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -792,7 +792,7 @@ static NTSTATUS notify_send(struct notify_context *notify,
iov[1].iov_len = strlen(path)+1;
return messaging_send_iov(notify->msg, *pid, MSG_PVFS_NOTIFY,
- iov, ARRAY_SIZE(iov));
+ iov, ARRAY_SIZE(iov), NULL, 0);
}
static void notify_handler(struct messaging_context *msg_ctx,