summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/echo.c
diff options
context:
space:
mode:
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);