diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-02-18 23:30:26 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:10:47 -0500 |
commit | ea5ddbcb4d531971ac9f252ed423d0ccecf56769 (patch) | |
tree | 74f098193a2fedd09a658d7dce27d79a3dd725b1 /source4 | |
parent | 42d6a4c4f0d87e8e1bdd1e3152e592822bf95337 (diff) | |
download | samba-ea5ddbcb4d531971ac9f252ed423d0ccecf56769.tar.gz samba-ea5ddbcb4d531971ac9f252ed423d0ccecf56769.tar.bz2 samba-ea5ddbcb4d531971ac9f252ed423d0ccecf56769.zip |
r5452: Add implementation + torture test for echo_Surrounding
(This used to be commit 1b71000cc15a06bd4868fbf4ce5415f5866d29a5)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/rpc_server/echo/rpc_echo.c | 14 | ||||
-rw-r--r-- | source4/torture/rpc/echo.c | 35 |
2 files changed, 49 insertions, 0 deletions
diff --git a/source4/rpc_server/echo/rpc_echo.c b/source4/rpc_server/echo/rpc_echo.c index 28c9958c92..a2d2e552d6 100644 --- a/source4/rpc_server/echo/rpc_echo.c +++ b/source4/rpc_server/echo/rpc_echo.c @@ -137,6 +137,20 @@ static void echo_TestSleep_handler(struct event_context *ev, struct timed_event } } +static NTSTATUS echo_TestSurrounding(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_TestSurrounding *r) +{ + if (!r->in.data) { + r->out.data = NULL; + return NT_STATUS_OK; + } + + r->out.data = talloc(mem_ctx, struct echo_Surrounding); + r->out.data->x = 2 * r->in.data->x; + r->out.data->surrounding = talloc_zero_array(mem_ctx, uint16_t, r->out.data->x); + + return NT_STATUS_OK; +} + static long echo_TestSleep(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_TestSleep *r) { struct echo_TestSleep_private *p; diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c index d01bda1f68..8284157bd2 100644 --- a/source4/torture/rpc/echo.c +++ b/source4/torture/rpc/echo.c @@ -319,6 +319,40 @@ static BOOL test_enum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) return ret; } +/* + test surrounding conformant array handling +*/ +static BOOL test_surrounding(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +{ + NTSTATUS status; + struct echo_TestSurrounding r; + BOOL ret = True; + + ZERO_STRUCT(r); + r.in.data = talloc(mem_ctx, struct echo_Surrounding); + + r.in.data->x = 20; + r.in.data->surrounding = talloc_zero_array(mem_ctx, uint16_t, r.in.data->x); + + r.out.data = talloc(mem_ctx, struct echo_Surrounding); + + printf("\nTesting TestSurrounding\n"); + status = dcerpc_echo_TestSurrounding(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("TestSurrounding failed - %s\n", nt_errstr(status)); + ret = False; + } + + if (r.out.data->x != 2 * r.in.data->x) { + printf("TestSurrounding did not make the array twice as large\n"); + ret = False; + } + + return ret; +} + + + BOOL torture_rpc_echo(void) { NTSTATUS status; @@ -344,6 +378,7 @@ BOOL torture_rpc_echo(void) ret &= test_testcall2(p, mem_ctx); ret &= test_enum(p, mem_ctx); ret &= test_sleep(p, mem_ctx); + ret &= test_surrounding(p, mem_ctx); printf("\n"); |