summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/echo.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-02-20 02:57:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:10:48 -0500
commit64112074e9772aead31092c8713e077d1aff050b (patch)
treea3b2a33dd00e5c65877004a5906653b1481e367a /source4/torture/rpc/echo.c
parent111b6c2b9a4695369815d71a0c06f931778228b0 (diff)
downloadsamba-64112074e9772aead31092c8713e077d1aff050b.tar.gz
samba-64112074e9772aead31092c8713e077d1aff050b.tar.bz2
samba-64112074e9772aead31092c8713e077d1aff050b.zip
r5465: Add support to multiple levels of pointers in pidl.
Also add a new function to echo.idl that tests this behaviour. (This used to be commit e5eb5e847e75f2b7b041a66f84d9b919ddf27739)
Diffstat (limited to 'source4/torture/rpc/echo.c')
-rw-r--r--source4/torture/rpc/echo.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c
index 35df96c897..8ef0b00eb2 100644
--- a/source4/torture/rpc/echo.c
+++ b/source4/torture/rpc/echo.c
@@ -352,6 +352,49 @@ static BOOL test_surrounding(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
return ret;
}
+/*
+ test multiple levels of pointers
+*/
+static BOOL test_doublepointer(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+ NTSTATUS status;
+ struct echo_TestDoublePointer r;
+ BOOL ret = True;
+ uint16_t value = 12;
+ uint16_t *pvalue = &value;
+ uint16_t **ppvalue = &pvalue;
+
+ ZERO_STRUCT(r);
+ r.in.data = &ppvalue;
+
+ printf("\nTesting TestDoublePointer\n");
+ status = dcerpc_echo_TestDoublePointer(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TestDoublePointer failed - %s\n", nt_errstr(status));
+ ret = False;
+ }
+
+ if (value != r.out.result) {
+ printf("TestSurrounding did not return original value\n");
+ ret = False;
+ }
+
+ pvalue = NULL;
+
+ status = dcerpc_echo_TestDoublePointer(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TestDoublePointer failed - %s\n", nt_errstr(status));
+ ret = False;
+ }
+
+ if (r.out.result != 0) {
+ printf("TestSurrounding did not return 0 when passed a NULL pointer\n");
+ ret = False;
+ }
+
+ return ret;
+}
+
BOOL torture_rpc_echo(void)
{
NTSTATUS status;
@@ -377,6 +420,7 @@ BOOL torture_rpc_echo(void)
ret &= test_testcall2(p, mem_ctx);
ret &= test_enum(p, mem_ctx);
ret &= test_surrounding(p, mem_ctx);
+ ret &= test_doublepointer(p, mem_ctx);
ret &= test_sleep(p, mem_ctx);
printf("\n");