diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-07-19 09:28:13 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:29:42 -0500 |
commit | 7ee2babcfe2ffb956a9013a2364c038021b77ae3 (patch) | |
tree | 7b2821e632fb05ce2617c909ec6ab938e7762584 /source4/lib/messaging | |
parent | ea39a55deabe06a2833bcae6f0ced7f8454d6c78 (diff) | |
download | samba-7ee2babcfe2ffb956a9013a2364c038021b77ae3.tar.gz samba-7ee2babcfe2ffb956a9013a2364c038021b77ae3.tar.bz2 samba-7ee2babcfe2ffb956a9013a2364c038021b77ae3.zip |
r8587: - fixed ref allocation in irpc replies
- make every irpc server support the irpc_uptime() call
(This used to be commit eee90448268b9f673cc43076ad87529aa80d17ae)
Diffstat (limited to 'source4/lib/messaging')
-rw-r--r-- | source4/lib/messaging/messaging.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 4f1589a9ba..1a2485d700 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -47,6 +47,7 @@ struct messaging_context { struct irpc_list *irpc; struct idr_context *idr; const char **names; + struct timeval start_time; struct { struct event_context *ev; @@ -98,6 +99,17 @@ static void ping_message(struct messaging_context *msg, void *private, messaging_send(msg, src, MSG_PONG, data); } +/* + return uptime of messaging server via irpc +*/ +static NTSTATUS irpc_uptime(struct irpc_message *msg, + struct irpc_uptime *r) +{ + struct messaging_context *ctx = talloc_get_type(msg->private, struct messaging_context); + *r->out.start_time = timeval_to_nttime(&ctx->start_time); + return NT_STATUS_OK; +} + /* return the path to a messaging socket */ @@ -385,14 +397,15 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, uint32_t server_id mkdir(path, 0700); talloc_free(path); - msg->base_path = smbd_tmp_path(msg, "messaging"); - msg->path = messaging_path(msg, server_id); - msg->server_id = server_id; - msg->dispatch = NULL; - msg->pending = NULL; - msg->idr = idr_init(msg); - msg->irpc = NULL; - msg->names = NULL; + msg->base_path = smbd_tmp_path(msg, "messaging"); + msg->path = messaging_path(msg, server_id); + msg->server_id = server_id; + msg->dispatch = NULL; + msg->pending = NULL; + msg->idr = idr_init(msg); + msg->irpc = NULL; + msg->names = NULL; + msg->start_time = timeval_current(); status = socket_create("unix", SOCKET_TYPE_DGRAM, &msg->sock, 0); if (!NT_STATUS_IS_OK(status)) { @@ -422,6 +435,7 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, uint32_t server_id messaging_register(msg, NULL, MSG_PING, ping_message); messaging_register(msg, NULL, MSG_IRPC, irpc_handler); + IRPC_REGISTER(msg, irpc, IRPC_UPTIME, irpc_uptime, msg); return msg; } @@ -571,6 +585,8 @@ static void irpc_handler(struct messaging_context *msg_ctx, void *private, ndr = ndr_pull_init_blob(packet, msg_ctx); if (ndr == NULL) goto failed; + ndr->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_irpc_header(ndr, NDR_BUFFERS|NDR_SCALARS, &header); if (!NT_STATUS_IS_OK(status)) goto failed; |