From 64112074e9772aead31092c8713e077d1aff050b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 20 Feb 2005 02:57:38 +0000 Subject: 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) --- source4/torture/rpc/echo.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'source4/torture/rpc') 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"); -- cgit