Line data Source code
1 : /*
2 : Unix SMB/CIFS implementation.
3 : test suite for dfs ndr operations
4 :
5 : Copyright (C) Jelmer Vernooij 2007
6 :
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.
11 :
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.
16 :
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/>.
19 : */
20 :
21 : #include "includes.h"
22 : #include "torture/ndr/ndr.h"
23 : #include "librpc/gen_ndr/ndr_dfs.h"
24 : #include "torture/ndr/proto.h"
25 :
26 : static const uint8_t getmanagerversion_out_data[] = {
27 : 0x04, 0x00, 0x00, 0x00
28 : };
29 :
30 2 : static bool getmanagerversion_out_check(struct torture_context *tctx,
31 : struct dfs_GetManagerVersion *r)
32 : {
33 2 : torture_assert_int_equal(tctx, *r->out.version, 4, "version");
34 0 : return true;
35 : }
36 :
37 : static const uint8_t enumex_in_data300[] = {
38 : 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
39 : 0x77, 0x00, 0x32, 0x00, 0x6b, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00,
40 : 0x00, 0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
41 : 0x38, 0xf5, 0x07, 0x00, 0x2c, 0x01, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00,
42 : 0x40, 0xf5, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
43 : 0xa8, 0xf5, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00
44 : };
45 :
46 2 : static bool enumex_in_check300(struct torture_context *tctx,
47 : struct dfs_EnumEx *r)
48 : {
49 2 : torture_assert_str_equal(tctx, r->in.dfs_name, "w2k3dc", "dfs name");
50 2 : torture_assert_int_equal(tctx, r->in.level, 300, "level");
51 2 : torture_assert(tctx, r->in.total != NULL, "total ptr");
52 2 : torture_assert_int_equal(tctx, *r->in.total, 0, "total");
53 2 : torture_assert_int_equal(tctx, r->in.bufsize, -1, "buf size");
54 2 : torture_assert(tctx, r->in.info != NULL, "info ptr");
55 2 : torture_assert_int_equal(tctx, r->in.info->level, 300, "info level");
56 2 : torture_assert(tctx, r->in.info->e.info300->s == NULL, "info data ptr");
57 0 : return true;
58 : }
59 :
60 :
61 : static const uint8_t enumex_out_data300[] = {
62 : 0x00, 0x00, 0x02, 0x00, 0x2c, 0x01, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00,
63 : 0x04, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00,
64 : 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x02, 0x00,
65 : 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00,
66 : 0x14, 0x00, 0x02, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
67 : 0x17, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x57, 0x00, 0x32, 0x00, 0x4b, 0x00,
68 : 0x33, 0x00, 0x44, 0x00, 0x43, 0x00, 0x5c, 0x00, 0x73, 0x00, 0x74, 0x00,
69 : 0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x6f, 0x00,
70 : 0x6e, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x74, 0x00,
71 : 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
72 : 0x18, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x57, 0x00, 0x32, 0x00, 0x4b, 0x00,
73 : 0x33, 0x00, 0x44, 0x00, 0x43, 0x00, 0x5c, 0x00, 0x73, 0x00, 0x74, 0x00,
74 : 0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x6f, 0x00,
75 : 0x6e, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x74, 0x00,
76 : 0x32, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
77 : 0x18, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x57, 0x00, 0x32, 0x00, 0x4b, 0x00,
78 : 0x33, 0x00, 0x44, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x5c, 0x00, 0x74, 0x00,
79 : 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x64, 0x00, 0x6f, 0x00, 0x6d, 0x00,
80 : 0x61, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x6f, 0x00,
81 : 0x74, 0x00, 0x00, 0x00, 0x18, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00, 0x00,
82 : 0x00, 0x00, 0x00, 0x00
83 : };
84 :
85 2 : static bool enumex_out_check300(struct torture_context *tctx,
86 : struct dfs_EnumEx *r)
87 : {
88 2 : torture_assert_werr_ok(tctx, r->out.result, "return code");
89 2 : torture_assert(tctx, r->out.total != NULL, "total ptr");
90 2 : torture_assert_int_equal(tctx, *r->out.total, 3, "total");
91 2 : torture_assert(tctx, r->out.info != NULL, "info ptr");
92 2 : torture_assert_int_equal(tctx, r->out.info->level, 300, "info level");
93 2 : torture_assert(tctx, r->out.info->e.info300 != NULL, "info data ptr");
94 2 : torture_assert_int_equal(tctx, r->out.info->e.info300->count, 3, "info enum array");
95 2 : torture_assert_str_equal(tctx, r->out.info->e.info300->s[0].dom_root, "\\W2K3DC\\standaloneroot", "info enum array 0");
96 2 : torture_assert_int_equal(tctx, r->out.info->e.info300->s[0].flavor, 256, "info enum flavor 0");
97 2 : torture_assert_str_equal(tctx, r->out.info->e.info300->s[1].dom_root, "\\W2K3DC\\standaloneroot2", "info enum array 1");
98 2 : torture_assert_int_equal(tctx, r->out.info->e.info300->s[1].flavor, 256, "info enum flavor 1");
99 2 : torture_assert_str_equal(tctx, r->out.info->e.info300->s[2].dom_root, "\\W2K3DOM\\testdomainroot", "info enum array 2");
100 2 : torture_assert_int_equal(tctx, r->out.info->e.info300->s[2].flavor, 512, "info enum flavor 2");
101 0 : return true;
102 : }
103 :
104 2354 : struct torture_suite *ndr_dfs_suite(TALLOC_CTX *ctx)
105 : {
106 2354 : struct torture_suite *suite = torture_suite_create(ctx, "dfs");
107 :
108 2354 : torture_suite_add_ndr_pull_fn_test(suite, dfs_GetManagerVersion, getmanagerversion_out_data, NDR_OUT, getmanagerversion_out_check );
109 :
110 2354 : torture_suite_add_ndr_pull_fn_test(suite, dfs_EnumEx, enumex_in_data300, NDR_IN, enumex_in_check300 );
111 2354 : torture_suite_add_ndr_pull_fn_test(suite, dfs_EnumEx, enumex_out_data300, NDR_OUT, enumex_out_check300 );
112 :
113 2354 : return suite;
114 : }
115 :
|