From 8d62a1370df7facb677ae825a27d72b06c69eeb3 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 27 Nov 2007 10:23:24 +0100 Subject: r26148: Add IDL and torture test for wkssvc_NetrUseGetInfo(). Guenther (This used to be commit 1a472cc1b2a6acf714cebb54eeb6bed965ab144d) --- source4/librpc/idl/wkssvc.idl | 7 ++- source4/rpc_server/wkssvc/dcesrv_wkssvc.c | 8 +-- source4/torture/rpc/wkssvc.c | 92 +++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 5 deletions(-) (limited to 'source4') diff --git a/source4/librpc/idl/wkssvc.idl b/source4/librpc/idl/wkssvc.idl index cc25ad3c2f..85dc7eb3aa 100644 --- a/source4/librpc/idl/wkssvc.idl +++ b/source4/librpc/idl/wkssvc.idl @@ -316,7 +316,12 @@ import "srvsvc.idl"; /*****************************/ /* Function 0x09 */ - WERROR WKSSVC_NETRUSEGETINFO (); + WERROR wkssvc_NetrUseGetInfo( + [in] [string,charset(UTF16)] uint16 *server_name, + [in,ref] [string,charset(UTF16)] uint16 *use_name, + [in] uint32 level, + [out] [switch_is(level)] [ref] wkssvc_NetrUseGetInfoCtr *ctr + ); /*****************************/ /* Function 0x0a */ diff --git a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c index 7afed4f923..292ed0e525 100644 --- a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c +++ b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c @@ -192,11 +192,11 @@ static WERROR dcesrv_wkssvc_NetrUseAdd(struct dcesrv_call_state *dce_call, TALLO } -/* - WKSSVC_NETRUSEGETINFO +/* + wkssvc_NetrUseGetInfo */ -static WERROR dcesrv_WKSSVC_NETRUSEGETINFO(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct WKSSVC_NETRUSEGETINFO *r) +static WERROR dcesrv_wkssvc_NetrUseGetInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct wkssvc_NetrUseGetInfo *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c index 72f9f63ddd..c1e08d396b 100644 --- a/source4/torture/rpc/wkssvc.c +++ b/source4/torture/rpc/wkssvc.c @@ -378,6 +378,96 @@ static bool test_NetrUseDel(struct torture_context *tctx, return true; } +static bool test_NetrUseGetInfo_level(struct torture_context *tctx, + struct dcerpc_pipe *p, + const char *use_name, + uint32_t level, + WERROR werr) +{ + NTSTATUS status; + struct wkssvc_NetrUseGetInfo r; + union wkssvc_NetrUseGetInfoCtr ctr; + + ZERO_STRUCT(ctr); + + r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); + r.in.use_name = use_name; + r.in.level = level; + r.out.ctr = &ctr; + status = dcerpc_wkssvc_NetrUseGetInfo(p, tctx, &r); + + torture_assert_ntstatus_ok(tctx, status, + "NetrUseGetInfo failed"); + torture_assert_werr_equal(tctx, r.out.result, werr, + "NetrUseGetInfo failed"); + return true; +} + +static bool test_NetrUseGetInfo(struct torture_context *tctx, + struct dcerpc_pipe *p) +{ + NTSTATUS status; + struct wkssvc_NetrUseEnum r; + uint32_t handle = 0; + uint32_t entries_read = 0; + struct wkssvc_NetrUseEnumInfo info; + struct wkssvc_NetrUseEnumCtr0 *use0; + uint32_t levels[] = { 0, 1, 2 }; + const char *use_name = NULL; + int i, k; + + ZERO_STRUCT(info); + + info.level = 0; + use0 = talloc_zero(tctx, struct wkssvc_NetrUseEnumCtr0); + info.ctr.ctr0 = use0; + + r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); + r.in.prefmaxlen = (uint32_t)-1; + r.in.info = r.out.info = &info; + r.in.resume_handle = r.out.resume_handle = &handle; + r.out.entries_read = &entries_read; + + status = dcerpc_wkssvc_NetrUseEnum(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, + "NetrUseEnum failed"); + torture_assert_werr_ok(tctx, r.out.result, + "NetrUseEnum failed"); + + for (k=0; k < r.out.info->ctr.ctr0->count; k++) { + + use_name = r.out.info->ctr.ctr0->array[k].local; + + for (i=0; ictr.ctr0->array[k].remote; + + for (i=0; i