2 Unix SMB/CIFS implementation.
3 test suite for clusapi rpc operations
5 Copyright (C) Günther Deschner 2015
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "librpc/gen_ndr/ndr_clusapi_c.h"
23 #include "torture/rpc/torture_rpc.h"
24 #include "param/param.h"
26 static bool test_OpenCluster_int(struct torture_context *tctx,
27 struct dcerpc_pipe *p,
28 struct policy_handle *Cluster)
30 struct dcerpc_binding_handle *b = p->binding_handle;
31 struct clusapi_OpenCluster r;
34 r.out.Status = &Status;
35 r.out.Cluster = Cluster;
37 torture_assert_ntstatus_ok(tctx,
38 dcerpc_clusapi_OpenCluster_r(b, tctx, &r),
39 "OpenCluster failed");
40 torture_assert_werr_ok(tctx,
41 W_ERROR(*r.out.Status),
42 "OpenCluster failed");
47 static bool test_CloseCluster_int(struct torture_context *tctx,
48 struct dcerpc_pipe *p,
49 struct policy_handle *Cluster)
51 struct dcerpc_binding_handle *b = p->binding_handle;
52 struct clusapi_CloseCluster r;
54 r.in.Cluster = Cluster;
55 r.out.Cluster = Cluster;
57 torture_assert_ntstatus_ok(tctx,
58 dcerpc_clusapi_CloseCluster_r(b, tctx, &r),
59 "CloseCluster failed");
60 torture_assert_werr_ok(tctx,
61 W_ERROR(r.out.result),
62 "CloseCluster failed");
65 ndr_policy_handle_empty(Cluster),
66 "policy_handle non empty after CloseCluster");
71 static bool test_OpenCluster(struct torture_context *tctx,
72 struct dcerpc_pipe *p)
74 struct policy_handle Cluster;
76 if (!test_OpenCluster_int(tctx, p, &Cluster)) {
80 test_CloseCluster_int(tctx, p, &Cluster);
85 static bool test_CloseCluster(struct torture_context *tctx,
86 struct dcerpc_pipe *p)
88 struct policy_handle Cluster;
90 if (!test_OpenCluster_int(tctx, p, &Cluster)) {
94 return test_CloseCluster_int(tctx, p, &Cluster);
97 struct torture_suite *torture_rpc_clusapi(TALLOC_CTX *mem_ctx)
99 struct torture_rpc_tcase *tcase;
100 struct torture_suite *suite = torture_suite_create(mem_ctx, "clusapi");
102 tcase = torture_suite_add_rpc_iface_tcase(suite, "clusapi",
105 torture_rpc_tcase_add_test(tcase, "OpenCluster",
107 torture_rpc_tcase_add_test(tcase, "CloseCluster",