summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-03 08:37:48 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-03 08:37:48 +0000
commitdfc43cdf14f3752b6802e04f3571b5f925297d58 (patch)
tree5b7df9f2d5a0209dd3b3a5228cd99ddf36a7f208 /source4/torture
parentdc2ffe07a8b25c117c7778fb706274198c11c2cc (diff)
downloadsamba-dfc43cdf14f3752b6802e04f3571b5f925297d58.tar.gz
samba-dfc43cdf14f3752b6802e04f3571b5f925297d58.tar.bz2
samba-dfc43cdf14f3752b6802e04f3571b5f925297d58.zip
added a helper function to make building rpc functions a bit easier
(This used to be commit a8feb80438680b9ec399c908987c58c4a6a998e6)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/echo.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c
index eee192e37a..5469854116 100644
--- a/source4/torture/rpc/echo.c
+++ b/source4/torture/rpc/echo.c
@@ -21,12 +21,36 @@
#include "includes.h"
+
+/*
+ test the AddOne interface
+*/
+static BOOL test_addone(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+ int i;
+ NTSTATUS status;
+
+ printf("\nTesting AddOne\n");
+
+ for (i=0;i<10;i++) {
+ int n;
+ status = dcerpc_rpcecho_addone(p, i, &n);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("AddOne(%d) failed - %s\n", i, nt_errstr(status));
+ return False;
+ }
+ printf("%d + 1 = %d\n", i, n);
+ }
+
+ return True;
+}
+
BOOL torture_rpc_echo(int dummy)
{
NTSTATUS status;
struct dcerpc_pipe *p;
TALLOC_CTX *mem_ctx;
- int i;
+ BOOL ret = True;
mem_ctx = talloc_init("torture_rpc_echo");
@@ -34,18 +58,13 @@ BOOL torture_rpc_echo(int dummy)
if (!NT_STATUS_IS_OK(status)) {
return False;
}
-
- for (i=0;i<10;i++) {
- int n;
- status = dcerpc_rpcecho_addone(p, i, &n);
- if (!NT_STATUS_IS_OK(status)) {
- printf("AddOne(%d) failed - %s\n", i, nt_errstr(status));
- goto done;
- }
- printf("%d + 1 = %d\n", i, n);
+
+ if (!test_addone(p, mem_ctx)) {
+ ret = False;
}
-done:
+ printf("\n");
+
torture_rpc_close(p);
- return NT_STATUS_IS_OK(status);
+ return ret;
}