summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/echo.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-03 09:18:38 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-03 09:18:38 +0000
commit399fff106d268a5ea95fd2e60735d92b80bcecb1 (patch)
tree3b3409a7451b76f514cc200d12b7c4f510563878 /source4/torture/rpc/echo.c
parent87ef172531add2672185ec8935180104c3667894 (diff)
downloadsamba-399fff106d268a5ea95fd2e60735d92b80bcecb1.tar.gz
samba-399fff106d268a5ea95fd2e60735d92b80bcecb1.tar.bz2
samba-399fff106d268a5ea95fd2e60735d92b80bcecb1.zip
added rpcecho EchoData test
(This used to be commit 9c7e4db4712d1b2b7d8125e3ae535efd50b80f58)
Diffstat (limited to 'source4/torture/rpc/echo.c')
-rw-r--r--source4/torture/rpc/echo.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c
index 5469854116..754d0c16d3 100644
--- a/source4/torture/rpc/echo.c
+++ b/source4/torture/rpc/echo.c
@@ -45,6 +45,44 @@ static BOOL test_addone(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
return True;
}
+/*
+ test the EchoData interface
+*/
+static BOOL test_echodata(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+ int i;
+ NTSTATUS status;
+ char *data_in, *data_out;
+ int len = 10;
+ int len_out;
+
+ printf("\nTesting EchoData\n");
+
+ data_in = talloc(mem_ctx, len);
+ for (i=0;i<len;i++) {
+ data_in[i] = i+1;
+ }
+
+ status = dcerpc_rpcecho_echodata(p, mem_ctx,
+ len,
+ data_in,
+ &len_out,
+ &data_out);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("EchoData(%d) failed\n", len);
+ return False;
+ }
+ printf("EchoData(%d) returned %d bytes\n", len, len_out);
+
+ if (memcmp(data_in, data_out, len) != 0) {
+ printf("Bad data returned!\n");
+ return False;
+ }
+
+
+ return True;
+}
+
BOOL torture_rpc_echo(int dummy)
{
NTSTATUS status;
@@ -63,6 +101,10 @@ BOOL torture_rpc_echo(int dummy)
ret = False;
}
+ if (!test_echodata(p, mem_ctx)) {
+ ret = False;
+ }
+
printf("\n");
torture_rpc_close(p);