diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-06-23 17:16:32 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2014-09-24 08:44:11 +0200 |
commit | 3f519a507ad31c17d381af352490bd9cc9270baf (patch) | |
tree | aa3375c1a45065c477ed3f4941eab023e95750dc /source3/lib | |
parent | 5b6f0416e089c3db8803a27d6c7e88525fa78528 (diff) | |
download | samba-3f519a507ad31c17d381af352490bd9cc9270baf.tar.gz samba-3f519a507ad31c17d381af352490bd9cc9270baf.tar.xz samba-3f519a507ad31c17d381af352490bd9cc9270baf.zip |
s3:unix_msg: pass the fd array to the unix_dgram recv_callback function
For now unix_msg_recv() will just close the fds, but they will be passed
to the unix_msg recv_callback in the next commits.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/unix_msg/unix_msg.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/source3/lib/unix_msg/unix_msg.c b/source3/lib/unix_msg/unix_msg.c index a5db4170bf..bdd95a6b61 100644 --- a/source3/lib/unix_msg/unix_msg.c +++ b/source3/lib/unix_msg/unix_msg.c @@ -62,6 +62,7 @@ struct unix_dgram_ctx { void (*recv_callback)(struct unix_dgram_ctx *ctx, uint8_t *msg, size_t msg_len, + int *fds, size_t num_fds, void *private_data); void *private_data; @@ -153,6 +154,7 @@ static int unix_dgram_init(const struct sockaddr_un *addr, size_t max_msg, const struct poll_funcs *ev_funcs, void (*recv_callback)(struct unix_dgram_ctx *ctx, uint8_t *msg, size_t msg_len, + int *fds, size_t num_fds, void *private_data), void *private_data, struct unix_dgram_ctx **result) @@ -313,16 +315,15 @@ static void unix_dgram_recv_handler(struct poll_watch *w, int fd, short events, } } - /* for now we don't support fd passing */ - goto cleanup_fds; - - ctx->recv_callback(ctx, ctx->recv_buf, received, ctx->private_data); + ctx->recv_callback(ctx, ctx->recv_buf, received, + fds, num_fds, ctx->private_data); return; cleanup_fds: close_fd_array(fds, num_fds); - ctx->recv_callback(ctx, ctx->recv_buf, received, ctx->private_data); + ctx->recv_callback(ctx, ctx->recv_buf, received, + NULL, 0, ctx->private_data); } static void unix_dgram_job_finished(struct poll_watch *w, int fd, short events, @@ -660,8 +661,9 @@ struct unix_msg_ctx { struct unix_msg *msgs; }; -static void unix_msg_recv(struct unix_dgram_ctx *ctx, - uint8_t *msg, size_t msg_len, +static void unix_msg_recv(struct unix_dgram_ctx *dgram_ctx, + uint8_t *buf, size_t buflen, + int *fds, size_t num_fds, void *private_data); int unix_msg_init(const struct sockaddr_un *addr, @@ -800,6 +802,7 @@ int unix_msg_send(struct unix_msg_ctx *ctx, const struct sockaddr_un *dst, static void unix_msg_recv(struct unix_dgram_ctx *dgram_ctx, uint8_t *buf, size_t buflen, + int *fds, size_t num_fds, void *private_data) { struct unix_msg_ctx *ctx = (struct unix_msg_ctx *)private_data; @@ -808,6 +811,9 @@ static void unix_msg_recv(struct unix_dgram_ctx *dgram_ctx, size_t space; uint64_t cookie; + /* for now we ignore passed file descriptors */ + close_fd_array(fds, num_fds); + if (buflen < sizeof(cookie)) { return; } |