Author: tridge
Date: 2005-07-19 09:28:13 +0000 (Tue, 19 Jul 2005)
New Revision: 8587

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8587

Log:
- fixed ref allocation in irpc replies

- make every irpc server support the irpc_uptime() call







Modified:
   branches/SAMBA_4_0/source/lib/messaging/messaging.c
   branches/SAMBA_4_0/source/librpc/idl/irpc.idl


Changeset:
Modified: branches/SAMBA_4_0/source/lib/messaging/messaging.c
===================================================================
--- branches/SAMBA_4_0/source/lib/messaging/messaging.c 2005-07-19 09:27:20 UTC 
(rev 8586)
+++ branches/SAMBA_4_0/source/lib/messaging/messaging.c 2005-07-19 09:28:13 UTC 
(rev 8587)
@@ -47,6 +47,7 @@
        struct irpc_list *irpc;
        struct idr_context *idr;
        const char **names;
+       struct timeval start_time;
 
        struct {
                struct event_context *ev;
@@ -98,6 +99,17 @@
        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 @@
        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 @@
        
        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 @@
        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;
 

Modified: branches/SAMBA_4_0/source/librpc/idl/irpc.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/irpc.idl       2005-07-19 09:27:20 UTC 
(rev 8586)
+++ branches/SAMBA_4_0/source/librpc/idl/irpc.idl       2005-07-19 09:28:13 UTC 
(rev 8587)
@@ -22,6 +22,10 @@
                NTSTATUS status;
        } irpc_header;
 
+       /******************************************************
+         uptime call - supported by all messaging servers
+       *******************************************************/
+       void irpc_uptime([out,ref] NTTIME *start_time);
 
        /******************************************************
          management calls for the nbt server

Reply via email to