Author: tridge
Date: 2005-08-01 17:33:43 +0000 (Mon, 01 Aug 2005)
New Revision: 8887

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

Log:
fixed the irpc error that caused ia64 to fail the LOCAL-IRPC test




Modified:
   branches/SAMBA_4_0/source/lib/messaging/irpc.h
   branches/SAMBA_4_0/source/lib/messaging/messaging.c
   branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rpc.c
   branches/SAMBA_4_0/source/torture/local/irpc.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/messaging/irpc.h
===================================================================
--- branches/SAMBA_4_0/source/lib/messaging/irpc.h      2005-08-01 17:31:40 UTC 
(rev 8886)
+++ branches/SAMBA_4_0/source/lib/messaging/irpc.h      2005-08-01 17:33:43 UTC 
(rev 8887)
@@ -29,7 +29,7 @@
 };
 
 /* don't allow calls to take too long */
-#define IRPC_CALL_TIMEOUT 10
+#define IRPC_CALL_TIMEOUT 1000
 
 
 /* the server function type */
@@ -42,11 +42,11 @@
                          (irpc_function_t)function, private)
 
 /* make a irpc call */
-#define IRPC_CALL(msg_ctx, server_id, pipename, funcname, ptr) \
-   irpc_call(msg_ctx, server_id, &dcerpc_table_ ## pipename, DCERPC_ ## 
funcname, ptr)
+#define IRPC_CALL(msg_ctx, server_id, pipename, funcname, ptr, ctx) \
+   irpc_call(msg_ctx, server_id, &dcerpc_table_ ## pipename, DCERPC_ ## 
funcname, ptr, ctx)
 
-#define IRPC_CALL_SEND(msg_ctx, server_id, pipename, funcname, ptr) \
-   irpc_call_send(msg_ctx, server_id, &dcerpc_table_ ## pipename, DCERPC_ ## 
funcname, ptr)
+#define IRPC_CALL_SEND(msg_ctx, server_id, pipename, funcname, ptr, ctx) \
+   irpc_call_send(msg_ctx, server_id, &dcerpc_table_ ## pipename, DCERPC_ ## 
funcname, ptr, ctx)
 
 
 /*
@@ -60,6 +60,7 @@
        void *r;
        NTSTATUS status;
        BOOL done;
+       TALLOC_CTX *mem_ctx;
        struct {
                void (*fn)(struct irpc_request *);
                void *private;
@@ -89,12 +90,12 @@
 struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx, 
                                    uint32_t server_id, 
                                    const struct dcerpc_interface_table *table, 
-                                   int callnum, void *r);
+                                   int callnum, void *r, TALLOC_CTX *ctx);
 NTSTATUS irpc_call_recv(struct irpc_request *irpc);
 NTSTATUS irpc_call(struct messaging_context *msg_ctx, 
                   uint32_t server_id, 
                   const struct dcerpc_interface_table *table, 
-                  int callnum, void *r);
+                  int callnum, void *r, TALLOC_CTX *ctx);
 
 NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name);
 uint32_t *irpc_servers_byname(struct messaging_context *msg_ctx, const char 
*name);

Modified: branches/SAMBA_4_0/source/lib/messaging/messaging.c
===================================================================
--- branches/SAMBA_4_0/source/lib/messaging/messaging.c 2005-08-01 17:31:40 UTC 
(rev 8886)
+++ branches/SAMBA_4_0/source/lib/messaging/messaging.c 2005-08-01 17:33:43 UTC 
(rev 8887)
@@ -500,9 +500,11 @@
        irpc->status = irpc->table->calls[irpc->callnum].ndr_pull(ndr, NDR_OUT, 
irpc->r);
        if (NT_STATUS_IS_OK(irpc->status)) {
                irpc->status = header->status;
+               talloc_steal(irpc->mem_ctx, ndr);
+       } else {
+               talloc_steal(irpc, ndr);
        }
        irpc->done = True;
-       talloc_steal(irpc, ndr);
        if (irpc->async.fn) {
                irpc->async.fn(irpc);
        }
@@ -634,7 +636,7 @@
 struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx, 
                                    uint32_t server_id, 
                                    const struct dcerpc_interface_table *table, 
-                                   int callnum, void *r)
+                                   int callnum, void *r, TALLOC_CTX *ctx)
 {
        struct irpc_header header;
        struct ndr_push *ndr;
@@ -653,6 +655,7 @@
        irpc->r        = r;
        irpc->done     = False;
        irpc->async.fn = NULL;
+       irpc->mem_ctx  = ctx;
 
        talloc_set_destructor(irpc, irpc_destructor);
 
@@ -713,10 +716,11 @@
 NTSTATUS irpc_call(struct messaging_context *msg_ctx, 
                   uint32_t server_id, 
                   const struct dcerpc_interface_table *table, 
-                  int callnum, void *r)
+                  int callnum, void *r,
+                  TALLOC_CTX *mem_ctx)
 {
        struct irpc_request *irpc = irpc_call_send(msg_ctx, server_id, 
-                                                  table, callnum, r);
+                                                  table, callnum, r, mem_ctx);
        NTSTATUS status = irpc_call_recv(irpc);
        talloc_free(irpc);
        return status;

Modified: branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rpc.c
===================================================================
--- branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rpc.c      2005-08-01 
17:31:40 UTC (rev 8886)
+++ branches/SAMBA_4_0/source/scripting/ejs/smbcalls_rpc.c      2005-08-01 
17:33:43 UTC (rev 8887)
@@ -219,7 +219,7 @@
        /* make the actual calls */
        for (i=0;i<count;i++) {
                reqs[i] = irpc_call_send(p->msg_ctx, p->dest_ids[i], 
-                                        iface, callnum, ptr);
+                                        iface, callnum, ptr, ptr);
                if (reqs[i] == NULL) {
                        status = NT_STATUS_NO_MEMORY;
                        goto done;

Modified: branches/SAMBA_4_0/source/torture/local/irpc.c
===================================================================
--- branches/SAMBA_4_0/source/torture/local/irpc.c      2005-08-01 17:31:40 UTC 
(rev 8886)
+++ branches/SAMBA_4_0/source/torture/local/irpc.c      2005-08-01 17:33:43 UTC 
(rev 8887)
@@ -68,7 +68,7 @@
        r.in.in_data = value;
 
        test_debug = True;
-       status = IRPC_CALL(msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, &r);
+       status = IRPC_CALL(msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, &r, 
mem_ctx);
        test_debug = False;
        if (!NT_STATUS_IS_OK(status)) {
                printf("AddOne failed - %s\n", nt_errstr(status));
@@ -101,7 +101,7 @@
        r.in.in_data = talloc_strdup(mem_ctx, "0123456789");
        r.in.len = strlen(r.in.in_data);
 
-       status = IRPC_CALL(msg_ctx1, MSG_ID2, rpcecho, ECHO_ECHODATA, &r);
+       status = IRPC_CALL(msg_ctx1, MSG_ID2, rpcecho, ECHO_ECHODATA, &r, 
mem_ctx);
        if (!NT_STATUS_IS_OK(status)) {
                printf("EchoData failed - %s\n", nt_errstr(status));
                return False;
@@ -163,7 +163,7 @@
        while (timeval_elapsed(&tv) < timelimit) {
                struct irpc_request *irpc;
 
-               irpc = IRPC_CALL_SEND(msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, 
&r);
+               irpc = IRPC_CALL_SEND(msg_ctx1, MSG_ID2, rpcecho, ECHO_ADDONE, 
&r, mem_ctx);
                if (irpc == NULL) {
                        printf("AddOne send failed\n");
                        return False;

Reply via email to