From 4dbc8abcc0f058b6aabc9739574a3cc92e2eb9f7 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 16 Jul 2004 09:25:52 +0000 Subject: r1528: add NetCharDevQ torture tests metze (This used to be commit d44c85176a79461bfb465a5643b855aa0d8da726) --- source4/torture/rpc/srvsvc.c | 150 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 149 insertions(+), 1 deletion(-) diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c index 3d608d0f96..460ac8c0cf 100644 --- a/source4/torture/rpc/srvsvc.c +++ b/source4/torture/rpc/srvsvc.c @@ -96,7 +96,7 @@ static BOOL test_NetCharDevEnum(struct dcerpc_pipe *p, NTSTATUS status; struct srvsvc_NetCharDevEnum r; struct srvsvc_NetCharDevCtr0 c0; - uint32 levels[] = {0, 1}; + uint32_t levels[] = {0, 1}; int i; BOOL ret = True; @@ -143,6 +143,150 @@ static BOOL test_NetCharDevEnum(struct dcerpc_pipe *p, return ret; } +/**************************/ +/* srvsvc_NetCharDevQ */ +/**************************/ +static BOOL test_NetCharDevQGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + const char *devicequeue) +{ + NTSTATUS status; + struct srvsvc_NetCharDevQGetInfo r; + uint32_t levels[] = {0, 1}; + int i; + BOOL ret = True; + + r.in.server_unc = talloc_asprintf(mem_ctx,"\\\\%s",dcerpc_server_name(p)); + r.in.queue_name = devicequeue; + r.in.user = talloc_asprintf(mem_ctx,"Administrator"); + + for (i=0;idevice = r.in.queue_name; + break; + case 1: + r.in.info.info1 = talloc_p(mem_ctx, struct srvsvc_NetCharDevQInfo1); + r.in.info.info1->device = r.in.queue_name; + r.in.info.info1->priority = 0x000; + r.in.info.info1->devices = r.in.queue_name; + r.in.info.info1->users = 0x000; + r.in.info.info1->num_ahead = 0x000; + break; + default: + break; + } + r.in.parm_error = &parm_error; + status = dcerpc_srvsvc_NetCharDevQSetInfo(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("NetCharDevQSetInfo level %u on devicequeue '%s' failed - %s\n", + r.in.level, r.in.queue_name, nt_errstr(status)); + ret = False; + continue; + } + if (!W_ERROR_IS_OK(r.out.result)) { + printf("NetCharDevQSetInfo level %u on devicequeue '%s' failed - %s\n", + r.in.level, r.in.queue_name, win_errstr(r.out.result)); + continue; + } + } + + return ret; +} +#endif + +static BOOL test_NetCharDevQEnum(struct dcerpc_pipe *p, + TALLOC_CTX *mem_ctx) +{ + NTSTATUS status; + struct srvsvc_NetCharDevQEnum r; + struct srvsvc_NetCharDevQCtr0 c0; + uint32_t levels[] = {0, 1}; + int i; + BOOL ret = True; + + r.in.server_unc = talloc_asprintf(mem_ctx,"\\\\%s",dcerpc_server_name(p)); + r.in.user = talloc_asprintf(mem_ctx,"%s","Administrator"); + r.in.ctr.ctr0 = &c0; + r.in.ctr.ctr0->count = 0; + r.in.ctr.ctr0->array = NULL; + r.in.max_buffer = (uint32)-1; + r.in.resume_handle = NULL; + + for (i=0;icount;j++) { + const char *device; + device = r.out.ctr.ctr1->array[j].device; + if (!test_NetCharDevQGetInfo(p, mem_ctx, device)) { + ret = False; + } + } + } + } + + return ret; +} + + static BOOL test_NetConnEnum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { @@ -494,6 +638,10 @@ BOOL torture_rpc_srvsvc(int dummy) ret = False; } + if (!test_NetCharDevQEnum(p, mem_ctx)) { + ret = False; + } + if (!test_NetConnEnum(p, mem_ctx)) { ret = False; } -- cgit