diff options
author | Günther Deschner <gd@samba.org> | 2007-11-27 10:07:00 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:46:23 +0100 |
commit | ec739190fbd72cd8e585bcfa87eed1913bb94780 (patch) | |
tree | 4702f396ec561bf72fb44adda86936e6bde8a5b6 /source4 | |
parent | a6426f3a2477c3fd528d96129eeb9c4364d6b8c4 (diff) | |
download | samba-ec739190fbd72cd8e585bcfa87eed1913bb94780.tar.gz samba-ec739190fbd72cd8e585bcfa87eed1913bb94780.tar.bz2 samba-ec739190fbd72cd8e585bcfa87eed1913bb94780.zip |
r26146: Add IDL and torture test for wkssvc_NetrUseEnum().
Guenther
(This used to be commit 72a14407ca407b670eb0feae8065e784ab1e4627)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/librpc/idl/wkssvc.idl | 61 | ||||
-rw-r--r-- | source4/rpc_server/wkssvc/dcesrv_wkssvc.c | 8 | ||||
-rw-r--r-- | source4/torture/rpc/wkssvc.c | 59 |
3 files changed, 123 insertions, 5 deletions
diff --git a/source4/librpc/idl/wkssvc.idl b/source4/librpc/idl/wkssvc.idl index cefa5165a4..a3e08c9444 100644 --- a/source4/librpc/idl/wkssvc.idl +++ b/source4/librpc/idl/wkssvc.idl @@ -280,7 +280,66 @@ import "srvsvc.idl"; /*****************************/ /* Function 0x0b */ - WERROR WKSSVC_NETRUSEENUM (); + typedef struct { + [string,charset(UTF16)] uint16 *local; + [string,charset(UTF16)] uint16 *remote; + [string,charset(UTF16)] uint16 *password; + uint32 status; + uint32 asg_type; + uint32 ref_count; + uint32 use_count; + [string,charset(UTF16)] uint16 *user_name; + [string,charset(UTF16)] uint16 *domain_name; + } wkssvc_NetrUseInfo2; + + typedef struct { + [string,charset(UTF16)] uint16 *local; + [string,charset(UTF16)] uint16 *remote; + [string,charset(UTF16)] uint16 *password; + uint32 status; + uint32 asg_type; + uint32 ref_count; + uint32 use_count; + } wkssvc_NetrUseInfo1; + + typedef struct { + [string,charset(UTF16)] uint16 *local; + [string,charset(UTF16)] uint16 *remote; + } wkssvc_NetrUseInfo0; + + typedef struct { + uint32 count; + [size_is(count)] wkssvc_NetrUseInfo2 *array; + } wkssvc_NetrUseEnumCtr2; + + typedef struct { + uint32 count; + [size_is(count)] wkssvc_NetrUseInfo1 *array; + } wkssvc_NetrUseEnumCtr1; + + typedef struct { + uint32 count; + [size_is(count)] wkssvc_NetrUseInfo0 *array; + } wkssvc_NetrUseEnumCtr0; + + typedef [switch_type(uint32)] union { + [case(0)] wkssvc_NetrUseEnumCtr0 *ctr0; + [case(1)] wkssvc_NetrUseEnumCtr1 *ctr1; + [case(2)] wkssvc_NetrUseEnumCtr2 *ctr2; + } wkssvc_NetrUseEnumCtr; + + typedef struct { + uint32 level; + [switch_is(level)] wkssvc_NetrUseEnumCtr ctr; + } wkssvc_NetrUseEnumInfo; + + WERROR wkssvc_NetrUseEnum( + [in] [string,charset(UTF16)] uint16 *server_name, + [in,out] [ref] wkssvc_NetrUseEnumInfo *info, + [in] uint32 prefmaxlen, + [out,ref] uint32 *entries_read, + [in,out] uint32 *resume_handle + ); /*****************************/ /* Function 0x0c */ diff --git a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c index 85acfcf98d..8380c8f9bd 100644 --- a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c +++ b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c @@ -212,11 +212,11 @@ static WERROR dcesrv_WKSSVC_NETRUSEDEL(struct dcesrv_call_state *dce_call, TALLO } -/* - WKSSVC_NETRUSEENUM +/* + wkssvc_NetrUseEnum */ -static WERROR dcesrv_WKSSVC_NETRUSEENUM(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct WKSSVC_NETRUSEENUM *r) +static WERROR dcesrv_wkssvc_NetrUseEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct wkssvc_NetrUseEnum *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c index 1be3f88c40..8fe410057c 100644 --- a/source4/torture/rpc/wkssvc.c +++ b/source4/torture/rpc/wkssvc.c @@ -242,6 +242,62 @@ static bool test_NetrWkstaUserGetInfo(struct torture_context *tctx, return true; } +static bool test_NetrUseEnum(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; + struct wkssvc_NetrUseEnumCtr1 *use1; + struct wkssvc_NetrUseEnumCtr2 *use2; + uint32_t levels[] = { 0, 1, 2 }; + int i; + + for (i=0; i<ARRAY_SIZE(levels); i++) { + + ZERO_STRUCT(info); + + info.level = levels[i]; + switch (info.level) { + case 0: + use0 = talloc_zero(tctx, struct wkssvc_NetrUseEnumCtr0); + info.ctr.ctr0 = use0; + break; + case 1: + use1 = talloc_zero(tctx, struct wkssvc_NetrUseEnumCtr1); + info.ctr.ctr1 = use1; + break; + case 2: + use2 = talloc_zero(tctx, struct wkssvc_NetrUseEnumCtr2); + info.ctr.ctr2 = use2; + break; + default: + break; + } + + 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; + + torture_comment(tctx, "testing NetrUseEnum level %u\n", + levels[i]); + + 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"); + } + + return true; +} + struct torture_suite *torture_rpc_wkssvc(TALLOC_CTX *mem_ctx) { struct torture_suite *suite; @@ -266,5 +322,8 @@ struct torture_suite *torture_rpc_wkssvc(TALLOC_CTX *mem_ctx) torture_rpc_tcase_add_test(tcase, "NetrWkstaUserGetInfo", test_NetrWkstaUserGetInfo); + torture_rpc_tcase_add_test(tcase, "NetrUseEnum", + test_NetrUseEnum); + return suite; } |