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 /source4/torture/rpc | |
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)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r-- | source4/torture/rpc/wkssvc.c | 55 |
1 files changed, 55 insertions, 0 deletions
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; } |