summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/echo.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-03 10:01:20 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-03 10:01:20 +0000
commit0a427a43c4464c05bdceb662fd6d3895790ea581 (patch)
tree484d6610cbdfbd6aa459e336e1ae7252e833d482 /source4/torture/rpc/echo.c
parent399fff106d268a5ea95fd2e60735d92b80bcecb1 (diff)
downloadsamba-0a427a43c4464c05bdceb662fd6d3895790ea581.tar.gz
samba-0a427a43c4464c05bdceb662fd6d3895790ea581.tar.bz2
samba-0a427a43c4464c05bdceb662fd6d3895790ea581.zip
added SinkData and SourceData tests for rpcecho
(This used to be commit 7c356350e6148078725de6b6829eb0855771ae17)
Diffstat (limited to 'source4/torture/rpc/echo.c')
-rw-r--r--source4/torture/rpc/echo.c72
1 files changed, 71 insertions, 1 deletions
diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c
index 754d0c16d3..48b004782c 100644
--- a/source4/torture/rpc/echo.c
+++ b/source4/torture/rpc/echo.c
@@ -53,7 +53,7 @@ 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 = 17;
int len_out;
printf("\nTesting EchoData\n");
@@ -83,6 +83,68 @@ static BOOL test_echodata(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
return True;
}
+
+/*
+ test the SourceData interface
+*/
+static BOOL test_sourcedata(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+ int i;
+ NTSTATUS status;
+ char *data_out;
+ int len = 100;
+ int len_out;
+
+ printf("\nTesting SourceData\n");
+
+ status = dcerpc_rpcecho_sourcedata(p, mem_ctx,
+ len,
+ &len_out,
+ &data_out);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("SourceData(%d) failed\n", len);
+ return False;
+ }
+ printf("SourceData(%d) returned %d bytes\n", len, len_out);
+
+ for (i=0;i<len;i++) {
+ if (data_out[i] != (i & 0xFF)) {
+ printf("bad data 0x%x at %d\n", data_out[i], i);
+ return False;
+ }
+ }
+
+ return True;
+}
+
+/*
+ test the SinkData interface
+*/
+static BOOL test_sinkdata(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+ int i;
+ NTSTATUS status;
+ char *data_in;
+ int len = 100;
+
+ printf("\nTesting SinkData\n");
+
+ data_in = talloc(mem_ctx, len);
+ for (i=0;i<len;i++) {
+ data_in[i] = i+1;
+ }
+
+ status = dcerpc_rpcecho_sinkdata(p, mem_ctx,
+ len,
+ data_in);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("SinkData(%d) failed\n", len);
+ return False;
+ }
+
+ return True;
+}
+
BOOL torture_rpc_echo(int dummy)
{
NTSTATUS status;
@@ -105,6 +167,14 @@ BOOL torture_rpc_echo(int dummy)
ret = False;
}
+ if (!test_sourcedata(p, mem_ctx)) {
+ ret = False;
+ }
+
+ if (!test_sinkdata(p, mem_ctx)) {
+ ret = False;
+ }
+
printf("\n");
torture_rpc_close(p);