diff options
author | Günther Deschner <gd@samba.org> | 2007-11-27 10:42:50 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:46:26 +0100 |
commit | 238862649cfa2f667915ef6475be54fb1ebff82d (patch) | |
tree | 263e4566ef62a8c3e20fe4e490396f88291f77a0 | |
parent | fd461adfd017f5fe26ffd7340ccfd953363c28ab (diff) | |
download | samba-238862649cfa2f667915ef6475be54fb1ebff82d.tar.gz samba-238862649cfa2f667915ef6475be54fb1ebff82d.tar.bz2 samba-238862649cfa2f667915ef6475be54fb1ebff82d.zip |
r26152: Add IDL and torture test for wkssvc_NetrEnumerateComputerNames().
Guenther
(This used to be commit ea478168676e00a602f8181b408c4886b35d2fd3)
-rw-r--r-- | source4/librpc/idl/wkssvc.idl | 21 | ||||
-rw-r--r-- | source4/rpc_server/wkssvc/dcesrv_wkssvc.c | 8 | ||||
-rw-r--r-- | source4/torture/rpc/wkssvc.c | 55 |
3 files changed, 78 insertions, 6 deletions
diff --git a/source4/librpc/idl/wkssvc.idl b/source4/librpc/idl/wkssvc.idl index f84c6329c8..6ecceae3e1 100644 --- a/source4/librpc/idl/wkssvc.idl +++ b/source4/librpc/idl/wkssvc.idl @@ -2,7 +2,7 @@ wkssvc interface definitions */ -import "srvsvc.idl"; +import "srvsvc.idl", "lsa.idl"; [ uuid("6bffd098-a112-3610-9833-46c3f87e345a"), version(1.0), @@ -535,5 +535,22 @@ import "srvsvc.idl"; /*****************************/ /* Function 0x1e */ - WERROR WKSSVC_NETRENUMERATECOMPUTERNAMES (); + typedef enum { + NetPrimaryComputerName = 0, + NetAlternateComputerNames = 1, + NetAllComputerNames = 2, + NetComputerNameTypeMax = 3 + } wkssvc_ComputerNameType; + + typedef struct { + uint32 count; + [size_is(count)] lsa_String *computer_name; + } wkssvc_ComputerNamesCtr; + + WERROR wkssvc_NetrEnumerateComputerNames( + [in] [string,charset(UTF16)] uint16 *server_name, + [in] wkssvc_ComputerNameType name_type, + [in] uint32 Reserved, + [out] [ref] wkssvc_ComputerNamesCtr **ctr + ); } diff --git a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c index 4123d9c9ce..48e3727d5c 100644 --- a/source4/rpc_server/wkssvc/dcesrv_wkssvc.c +++ b/source4/rpc_server/wkssvc/dcesrv_wkssvc.c @@ -402,11 +402,11 @@ static WERROR dcesrv_WKSSVC_NETRSETPRIMARYCOMPUTERNAME(struct dcesrv_call_state } -/* - WKSSVC_NETRENUMERATECOMPUTERNAMES +/* + wkssvc_NetrEnumerateComputerNames */ -static WERROR dcesrv_WKSSVC_NETRENUMERATECOMPUTERNAMES(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct WKSSVC_NETRENUMERATECOMPUTERNAMES *r) +static WERROR dcesrv_wkssvc_NetrEnumerateComputerNames(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct wkssvc_NetrEnumerateComputerNames *r) { DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); } diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c index d862e00d1d..7486e8cde5 100644 --- a/source4/torture/rpc/wkssvc.c +++ b/source4/torture/rpc/wkssvc.c @@ -504,6 +504,59 @@ static bool test_NetrLogonDomainNameDel(struct torture_context *tctx, return true; } +static bool test_NetrEnumerateComputerNames_level(struct torture_context *tctx, + struct dcerpc_pipe *p, + uint16_t level) +{ + NTSTATUS status; + struct wkssvc_NetrEnumerateComputerNames r; + struct wkssvc_ComputerNamesCtr *ctr; + + ctr = talloc_zero(tctx, struct wkssvc_ComputerNamesCtr); + + r.in.server_name = dcerpc_server_name(p); + r.in.name_type = level; + r.in.Reserved = 0; + r.out.ctr = &ctr; + + torture_comment(tctx, "testing NetrEnumerateComputerNames level %u\n", + r.in.name_type); + + status = dcerpc_wkssvc_NetrEnumerateComputerNames(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, + "NetrEnumerateComputerNames failed"); + torture_assert_werr_ok(tctx, r.out.result, + "NetrEnumerateComputerNames failed"); + + if ((level == NetPrimaryComputerName) && ctr->count != 1) { + torture_comment(tctx, + "NetrEnumerateComputerNames did not return one " + "name but %u\n", ctr->count); + return false; + } + + return true; +} + +static bool test_NetrEnumerateComputerNames(struct torture_context *tctx, + struct dcerpc_pipe *p) +{ + uint16_t levels[] = {0,1,2}; + int i; + + for (i=0; i<ARRAY_SIZE(levels); i++) { + + if (!test_NetrEnumerateComputerNames_level(tctx, + p, + levels[i])) + { + return false; + } + } + + return true; +} + static bool test_NetrValidateName(struct torture_context *tctx, struct dcerpc_pipe *p) { @@ -605,6 +658,8 @@ struct torture_suite *torture_rpc_wkssvc(TALLOC_CTX *mem_ctx) test_NetrLogonDomainNameDel); torture_rpc_tcase_add_test(tcase, "NetrLogonDomainNameAdd", test_NetrLogonDomainNameAdd); + torture_rpc_tcase_add_test(tcase, "NetrEnumerateComputerNames", + test_NetrEnumerateComputerNames); return suite; } |