2 Unix SMB/CIFS implementation.
4 test suite for browser rpc operations
6 Copyright (C) Stefan Metzmacher 2008
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.
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.
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/>.
23 #include "librpc/gen_ndr/ndr_browser_c.h"
24 #include "torture/rpc/rpc.h"
26 bool test_BrowserrQueryOtherDomains(struct torture_context
*tctx
,
27 struct dcerpc_pipe
*p
)
29 struct BrowserrQueryOtherDomains r
;
30 struct BrowserrSrvInfo info
;
31 struct BrowserrSrvInfo100Ctr ctr100
;
32 struct srvsvc_NetSrvInfo100 entries100
[1];
33 struct BrowserrSrvInfo101Ctr ctr101
;
34 struct srvsvc_NetSrvInfo101 entries101
[1];
35 uint32_t total_entries
;
38 torture_comment(tctx
, "dcerpc_BrowserrQueryOtherDomains\n");
43 ZERO_STRUCT(entries100
);
45 ZERO_STRUCT(entries101
);
48 r
.in
.server_unc
= talloc_asprintf(tctx
,"\\\\%s",dcerpc_server_name(p
));
51 r
.out
.total_entries
= &total_entries
;
54 info
.info
.info100
= &ctr100
;
56 status
= dcerpc_BrowserrQueryOtherDomains(p
, tctx
, &r
);
57 torture_assert_ntstatus_ok(tctx
, status
, "BrowserrQueryOtherDomains failed");
58 torture_assert_werr_ok(tctx
, r
.out
.result
, "BrowserrQueryOtherDomains failed");
59 torture_assert_int_equal(tctx
, *r
.out
.total_entries
, 0, "BrowserrQueryOtherDomains");
61 info
.info
.info100
= &ctr100
;
62 ctr100
.entries_read
= ARRAY_SIZE(entries100
);
63 ctr100
.entries
= entries100
;
65 status
= dcerpc_BrowserrQueryOtherDomains(p
, tctx
, &r
);
66 torture_assert_ntstatus_ok(tctx
, status
, "BrowserrQueryOtherDomains failed");
67 torture_assert_werr_ok(tctx
, r
.out
.result
, "BrowserrQueryOtherDomains failed");
68 torture_assert_int_equal(tctx
, *r
.out
.total_entries
, 0, "BrowserrQueryOtherDomains");
70 info
.info
.info100
= NULL
;
71 status
= dcerpc_BrowserrQueryOtherDomains(p
, tctx
, &r
);
72 torture_assert_ntstatus_ok(tctx
, status
, "BrowserrQueryOtherDomains failed");
73 torture_assert_werr_equal(tctx
, WERR_INVALID_PARAM
, r
.out
.result
,
74 "BrowserrQueryOtherDomains failed");
77 info
.info
.info101
= &ctr101
;
79 status
= dcerpc_BrowserrQueryOtherDomains(p
, tctx
, &r
);
80 torture_assert_ntstatus_ok(tctx
, status
, "BrowserrQueryOtherDomains failed");
81 torture_assert_werr_equal(tctx
, WERR_UNKNOWN_LEVEL
, r
.out
.result
,
82 "BrowserrQueryOtherDomains");
84 info
.info
.info101
= &ctr101
;
85 ctr101
.entries_read
= ARRAY_SIZE(entries101
);
86 ctr101
.entries
= entries101
;
88 status
= dcerpc_BrowserrQueryOtherDomains(p
, tctx
, &r
);
89 torture_assert_ntstatus_ok(tctx
, status
, "BrowserrQueryOtherDomains failed");
90 torture_assert_werr_equal(tctx
, WERR_UNKNOWN_LEVEL
, r
.out
.result
,
91 "BrowserrQueryOtherDomains");
93 info
.info
.info101
= NULL
;
94 status
= dcerpc_BrowserrQueryOtherDomains(p
, tctx
, &r
);
95 torture_assert_ntstatus_ok(tctx
, status
, "BrowserrQueryOtherDomains failed");
96 torture_assert_werr_equal(tctx
, WERR_UNKNOWN_LEVEL
, r
.out
.result
,
97 "BrowserrQueryOtherDomains");
100 status
= dcerpc_BrowserrQueryOtherDomains(p
, tctx
, &r
);
101 torture_assert_ntstatus_ok(tctx
, status
, "BrowserrQueryOtherDomains failed");
102 torture_assert_werr_equal(tctx
, WERR_UNKNOWN_LEVEL
, r
.out
.result
,
103 "BrowserrQueryOtherDomains");
106 status
= dcerpc_BrowserrQueryOtherDomains(p
, tctx
, &r
);
107 torture_assert_ntstatus_ok(tctx
, status
, "BrowserrQueryOtherDomains failed");
108 torture_assert_werr_equal(tctx
, WERR_UNKNOWN_LEVEL
, r
.out
.result
,
109 "BrowserrQueryOtherDomains");
114 struct torture_suite
*torture_rpc_browser(TALLOC_CTX
*mem_ctx
)
116 struct torture_suite
*suite
= torture_suite_create(mem_ctx
, "BROWSER");
117 struct torture_rpc_tcase
*tcase
= torture_suite_add_rpc_iface_tcase(suite
, "browser", &ndr_table_browser
);
119 torture_rpc_tcase_add_test(tcase
, "BrowserrQueryOtherDomains", test_BrowserrQueryOtherDomains
);