1 | /*
|
---|
2 | Unix SMB/CIFS implementation.
|
---|
3 |
|
---|
4 | test suite for browser rpc operations
|
---|
5 |
|
---|
6 | Copyright (C) Stefan Metzmacher 2008
|
---|
7 |
|
---|
8 | This program is free software; you can redistribute it and/or modify
|
---|
9 | it under the terms of the GNU General Public License as published by
|
---|
10 | the Free Software Foundation; either version 3 of the License, or
|
---|
11 | (at your option) any later version.
|
---|
12 |
|
---|
13 | This program is distributed in the hope that it will be useful,
|
---|
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | GNU General Public License for more details.
|
---|
17 |
|
---|
18 | You should have received a copy of the GNU General Public License
|
---|
19 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #include "includes.h"
|
---|
23 | #include "librpc/gen_ndr/ndr_browser_c.h"
|
---|
24 | #include "torture/rpc/torture_rpc.h"
|
---|
25 |
|
---|
26 | bool test_BrowserrQueryOtherDomains(struct torture_context *tctx,
|
---|
27 | struct dcerpc_pipe *p)
|
---|
28 | {
|
---|
29 | struct dcerpc_binding_handle *b = p->binding_handle;
|
---|
30 | struct BrowserrQueryOtherDomains r;
|
---|
31 | struct BrowserrSrvInfo info;
|
---|
32 | struct BrowserrSrvInfo100Ctr ctr100;
|
---|
33 | struct srvsvc_NetSrvInfo100 entries100[1];
|
---|
34 | struct BrowserrSrvInfo101Ctr ctr101;
|
---|
35 | struct srvsvc_NetSrvInfo101 entries101[1];
|
---|
36 | uint32_t total_entries;
|
---|
37 | NTSTATUS status;
|
---|
38 |
|
---|
39 | torture_comment(tctx, "dcerpc_BrowserrQueryOtherDomains\n");
|
---|
40 |
|
---|
41 | ZERO_STRUCT(r);
|
---|
42 | ZERO_STRUCT(info);
|
---|
43 | ZERO_STRUCT(ctr100);
|
---|
44 | ZERO_STRUCT(entries100);
|
---|
45 | ZERO_STRUCT(ctr101);
|
---|
46 | ZERO_STRUCT(entries101);
|
---|
47 | total_entries = 0;
|
---|
48 |
|
---|
49 | r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p));
|
---|
50 | r.in.info = &info;
|
---|
51 | r.out.info = &info;
|
---|
52 | r.out.total_entries = &total_entries;
|
---|
53 |
|
---|
54 | info.level = 100;
|
---|
55 | info.info.info100 = &ctr100;
|
---|
56 |
|
---|
57 | status = dcerpc_BrowserrQueryOtherDomains_r(b, tctx, &r);
|
---|
58 | torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed");
|
---|
59 | torture_assert_werr_ok(tctx, r.out.result, "BrowserrQueryOtherDomains failed");
|
---|
60 | torture_assert_int_equal(tctx, *r.out.total_entries, 0, "BrowserrQueryOtherDomains");
|
---|
61 |
|
---|
62 | info.info.info100 = &ctr100;
|
---|
63 | ctr100.entries_read = ARRAY_SIZE(entries100);
|
---|
64 | ctr100.entries = entries100;
|
---|
65 |
|
---|
66 | status = dcerpc_BrowserrQueryOtherDomains_r(b, tctx, &r);
|
---|
67 | torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed");
|
---|
68 | torture_assert_werr_ok(tctx, r.out.result, "BrowserrQueryOtherDomains failed");
|
---|
69 | torture_assert_int_equal(tctx, *r.out.total_entries, 0, "BrowserrQueryOtherDomains");
|
---|
70 |
|
---|
71 | info.info.info100 = NULL;
|
---|
72 | status = dcerpc_BrowserrQueryOtherDomains_r(b, tctx, &r);
|
---|
73 | torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed");
|
---|
74 | torture_assert_werr_equal(tctx, WERR_INVALID_PARAM, r.out.result,
|
---|
75 | "BrowserrQueryOtherDomains failed");
|
---|
76 |
|
---|
77 | info.level = 101;
|
---|
78 | info.info.info101 = &ctr101;
|
---|
79 |
|
---|
80 | status = dcerpc_BrowserrQueryOtherDomains_r(b, tctx, &r);
|
---|
81 | torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed");
|
---|
82 | torture_assert_werr_equal(tctx, WERR_UNKNOWN_LEVEL, r.out.result,
|
---|
83 | "BrowserrQueryOtherDomains");
|
---|
84 |
|
---|
85 | info.info.info101 = &ctr101;
|
---|
86 | ctr101.entries_read = ARRAY_SIZE(entries101);
|
---|
87 | ctr101.entries = entries101;
|
---|
88 |
|
---|
89 | status = dcerpc_BrowserrQueryOtherDomains_r(b, tctx, &r);
|
---|
90 | torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed");
|
---|
91 | torture_assert_werr_equal(tctx, WERR_UNKNOWN_LEVEL, r.out.result,
|
---|
92 | "BrowserrQueryOtherDomains");
|
---|
93 |
|
---|
94 | info.info.info101 = NULL;
|
---|
95 | status = dcerpc_BrowserrQueryOtherDomains_r(b, tctx, &r);
|
---|
96 | torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed");
|
---|
97 | torture_assert_werr_equal(tctx, WERR_UNKNOWN_LEVEL, r.out.result,
|
---|
98 | "BrowserrQueryOtherDomains");
|
---|
99 |
|
---|
100 | info.level = 102;
|
---|
101 | status = dcerpc_BrowserrQueryOtherDomains_r(b, tctx, &r);
|
---|
102 | torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed");
|
---|
103 | torture_assert_werr_equal(tctx, WERR_UNKNOWN_LEVEL, r.out.result,
|
---|
104 | "BrowserrQueryOtherDomains");
|
---|
105 |
|
---|
106 | info.level = 0;
|
---|
107 | status = dcerpc_BrowserrQueryOtherDomains_r(b, tctx, &r);
|
---|
108 | torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed");
|
---|
109 | torture_assert_werr_equal(tctx, WERR_UNKNOWN_LEVEL, r.out.result,
|
---|
110 | "BrowserrQueryOtherDomains");
|
---|
111 |
|
---|
112 | return true;
|
---|
113 | }
|
---|
114 |
|
---|
115 | struct torture_suite *torture_rpc_browser(TALLOC_CTX *mem_ctx)
|
---|
116 | {
|
---|
117 | struct torture_suite *suite = torture_suite_create(mem_ctx, "browser");
|
---|
118 | struct torture_rpc_tcase *tcase = torture_suite_add_rpc_iface_tcase(suite, "browser", &ndr_table_browser);
|
---|
119 |
|
---|
120 | torture_rpc_tcase_add_test(tcase, "BrowserrQueryOtherDomains", test_BrowserrQueryOtherDomains);
|
---|
121 |
|
---|
122 | return suite;
|
---|
123 | }
|
---|
124 |
|
---|