summaryrefslogtreecommitdiff
path: root/source4/torture/local
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-09-25 13:17:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:54 -0500
commit06085e7bc09e46c74fbe050633203fab619d501c (patch)
treebe2afc4c970363e19fcb9af669345f3c0c311f74 /source4/torture/local
parent87f71eb8ad90cdf9ed7d3cd79d6211908a7d2d92 (diff)
downloadsamba-06085e7bc09e46c74fbe050633203fab619d501c.tar.gz
samba-06085e7bc09e46c74fbe050633203fab619d501c.tar.bz2
samba-06085e7bc09e46c74fbe050633203fab619d501c.zip
r10490: - allow deferred irpc replies to set the status
- add an example of deferred reply for echodata in LOCAL-IRPC (This used to be commit 858a757a6d0a614b8f13bfb6217034e8a8b69554)
Diffstat (limited to 'source4/torture/local')
-rw-r--r--source4/torture/local/irpc.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/source4/torture/local/irpc.c b/source4/torture/local/irpc.c
index 3d529fcc49..861edc42fa 100644
--- a/source4/torture/local/irpc.c
+++ b/source4/torture/local/irpc.c
@@ -43,12 +43,29 @@ static NTSTATUS irpc_AddOne(struct irpc_message *irpc, struct echo_AddOne *r)
}
/*
+ a deferred reply to echodata
+*/
+static void deferred_echodata(struct event_context *ev, struct timed_event *te,
+ struct timeval t, void *private)
+{
+ struct irpc_message *irpc = talloc_get_type(private, struct irpc_message);
+ struct echo_EchoData *r = irpc->data;
+ r->out.out_data = talloc_memdup(r, r->in.in_data, r->in.len);
+ if (r->out.out_data == NULL) {
+ irpc_send_reply(irpc, NT_STATUS_NO_MEMORY);
+ }
+ printf("sending deferred reply\n");
+ irpc_send_reply(irpc, NT_STATUS_OK);
+}
+
+
+/*
serve up EchoData over the irpc system
*/
static NTSTATUS irpc_EchoData(struct irpc_message *irpc, struct echo_EchoData *r)
{
- r->out.out_data = talloc_memdup(r, r->in.in_data, r->in.len);
- NT_STATUS_HAVE_NO_MEMORY(r->out.out_data);
+ irpc->defer_reply = True;
+ event_add_timed(irpc->ev, irpc, timeval_zero(), deferred_echodata, irpc);
return NT_STATUS_OK;
}
@@ -98,8 +115,8 @@ static BOOL test_echodata(TALLOC_CTX *mem_ctx,
NTSTATUS status;
/* make the call */
- r.in.in_data = talloc_strdup(mem_ctx, "0123456789");
- r.in.len = strlen(r.in.in_data);
+ r.in.in_data = (unsigned char *)talloc_strdup(mem_ctx, "0123456789");
+ r.in.len = strlen((char *)r.in.in_data);
status = IRPC_CALL(msg_ctx1, MSG_ID2, rpcecho, ECHO_ECHODATA, &r, mem_ctx);
if (!NT_STATUS_IS_OK(status)) {