Debian Codegraph @

source4/torture/ndr/witness.c

raw
1 /*
2 Unix SMB/CIFS implementation.
3 test suite for witness ndr operations
4
5 Copyright (C) Guenther Deschner 2015
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_witness.h"
24 #include "torture/ndr/proto.h"
25 #include "param/param.h"
26
27 static const uint8_t witness_GetInterfaceList_data[] = {
28 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00,
29 0x02, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x4f, 0x00, 0x44, 0x00, 0x45, 0x00,
30 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
31 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
32 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
33 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
34 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
36 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
39 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
40 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
42 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
43 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
44 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
45 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
46 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
47 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
48 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
49 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
50 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
51 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
52 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
53 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
54 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
55 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
56 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
58 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
60 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
61 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
63 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
64 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
65 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
67 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
68 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
69 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
70 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
71 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
72 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
73 0x01, 0x00, 0x00, 0x00, 0xc0, 0xa8, 0x03, 0x2c, 0x00, 0x00, 0x00, 0x00,
74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
75 0x05, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x4f, 0x00, 0x44, 0x00, 0x45, 0x00,
76 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
77 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
78 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
79 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
80 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
81 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
82 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
83 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
84 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
85 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
86 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
87 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
88 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
89 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
90 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
91 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
92 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
93 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
94 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
95 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
96 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
97 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
99 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
100 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
101 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
102 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
103 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
104 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
105 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
106 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
107 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
108 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
109 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
110 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
111 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
112 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
113 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
114 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
115 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
116 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
117 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
118 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
119 0x01, 0x00, 0x00, 0x00, 0xc0, 0xa8, 0x03, 0x2d, 0x00, 0x00, 0x00, 0x00,
120 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
121 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
122 };
123
124 static bool witness_GetInterfaceList_check(struct torture_context *tctx,
125 struct witness_GetInterfaceList *r)
126 {
127 struct witness_interfaceList *l;
128
129 torture_assert(tctx, r->out.interface_list, "r->out.interface_list");
130
131 l = *(r->out.interface_list);
132
133 torture_assert_int_equal(tctx, l->num_interfaces, 2, "l->num_interfaces");
134 torture_assert(tctx, l->interfaces, "l->interfaces");
135
136 torture_assert_str_equal(tctx, l->interfaces[0].group_name, "NODE2", "l->interfaces[0].group_name");
137 torture_assert_int_equal(tctx, l->interfaces[0].version, -1, "l->interfaces[0].version");
138 torture_assert_int_equal(tctx, l->interfaces[0].state, 1, "l->interfaces[0].state");
139 torture_assert_str_equal(tctx, l->interfaces[0].ipv4, "192.168.3.44", "l->interfaces[0].state");
140 torture_assert_int_equal(tctx, l->interfaces[0].flags, 5, "l->interfaces[0].flags");
141
142 torture_assert_str_equal(tctx, l->interfaces[1].group_name, "NODE1", "l->interfaces[0].group_name");
143 torture_assert_int_equal(tctx, l->interfaces[1].version, -1, "l->interfaces[0].version");
144 torture_assert_int_equal(tctx, l->interfaces[1].state, 1, "l->interfaces[0].state");
145 torture_assert_str_equal(tctx, l->interfaces[1].ipv4, "192.168.3.45", "l->interfaces[0].state");
146 torture_assert_int_equal(tctx, l->interfaces[1].flags, 1, "l->interfaces[0].flags");
147 torture_assert_werr_ok(tctx, r->out.result, "r->out.result");
148
149 return true;
150 }
151
152 static const uint8_t witness_Register_data_IN[] = {
153 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00,
154 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x73, 0x00, 0x6f, 0x00,
155 0x66, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00,
156 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
157 0x31, 0x00, 0x39, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00,
158 0x38, 0x00, 0x2e, 0x00, 0x33, 0x00, 0x2e, 0x00, 0x34, 0x00, 0x35, 0x00,
159 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x09, 0x00, 0x00, 0x00,
160 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x54, 0x00,
161 0x48, 0x00, 0x45, 0x00, 0x4c, 0x00, 0x45, 0x00, 0x4e, 0x00, 0x41, 0x00,
162 0x00, 0x00
163 };
164
165 static bool witness_Register_check_IN(struct torture_context *tctx,
166 struct witness_Register *r)
167 {
168 torture_assert_int_equal(tctx, r->in.version, 65537, "r->in.version");
169 torture_assert_str_equal(tctx, r->in.net_name, "sofs", "r->in.net_name");
170 torture_assert_str_equal(tctx, r->in.ip_address, "192.168.3.45", "r->in.ip_address");
171 torture_assert_str_equal(tctx, r->in.client_computer_name, "MTHELENA", "r->in.client_computer_name");
172
173 return true;
174 }
175
176 static const uint8_t witness_Register_data_OUT[] = {
177 0x00, 0x00, 0x00, 0x00, 0x33, 0x86, 0xb8, 0x3a, 0x57, 0x1e, 0x1a, 0x4c,
178 0x85, 0x6c, 0xd1, 0xbc, 0x4b, 0x15, 0xbb, 0xb1, 0x00, 0x00, 0x00, 0x00
179 };
180
181 static bool witness_Register_check_OUT(struct torture_context *tctx,
182 struct witness_Register *r)
183 {
184 struct GUID guid;
185
186 torture_assert(tctx, r->out.context_handle, "r->out.context_handle");
187 torture_assert_int_equal(tctx, r->out.context_handle->handle_type, 0, "r->out.context_handle->handle_type");
188 torture_assert_ntstatus_ok(tctx, GUID_from_string("3ab88633-1e57-4c1a-856c-d1bc4b15bbb1", &guid), "");
189 torture_assert_mem_equal(tctx, &r->out.context_handle->uuid, &guid, sizeof(guid), "r->out.context_handle->uuid");
190 torture_assert_werr_ok(tctx, r->out.result, "r->out.result");
191
192 return true;
193 }
194
195 static const uint8_t witness_UnRegister_data_IN[] = {
196 0x00, 0x00, 0x00, 0x00, 0x33, 0x86, 0xb8, 0x3a, 0x57, 0x1e, 0x1a, 0x4c,
197 0x85, 0x6c, 0xd1, 0xbc, 0x4b, 0x15, 0xbb, 0xb1
198 };
199
200 static bool witness_UnRegister_check_IN(struct torture_context *tctx,
201 struct witness_UnRegister *r)
202 {
203 struct GUID guid;
204
205 torture_assert_int_equal(tctx, r->in.context_handle.handle_type, 0, "r->in.context_handle.handle_type");
206 torture_assert_ntstatus_ok(tctx, GUID_from_string("3ab88633-1e57-4c1a-856c-d1bc4b15bbb1", &guid), "");
207 torture_assert_mem_equal(tctx, &r->in.context_handle.uuid, &guid, sizeof(guid), "r->in.context_handle.uuid");
208
209 return true;
210 }
211
212 static const uint8_t witness_UnRegister_data_OUT[] = {
213 0x00, 0x00, 0x00, 0x00
214 };
215
216 static bool witness_UnRegister_check_OUT(struct torture_context *tctx,
217 struct witness_UnRegister *r)
218 {
219 torture_assert_werr_ok(tctx, r->out.result, "r->out.result");
220
221 return true;
222 }
223
224 static const uint8_t witness_AsyncNotify_data_IN[] = {
225 0x00, 0x00, 0x00, 0x00, 0xee, 0xf2, 0xb9, 0x1f, 0x4d, 0x2a, 0xf8, 0x4b,
226 0xaf, 0x8b, 0xcb, 0x9d, 0x45, 0x29, 0xa9, 0xab
227 };
228
229 static bool witness_AsyncNotify_check_IN(struct torture_context *tctx,
230 struct witness_AsyncNotify *r)
231 {
232 struct GUID guid;
233
234 torture_assert_int_equal(tctx, r->in.context_handle.handle_type, 0, "r->in.context_handle.handle_type");
235 torture_assert_ntstatus_ok(tctx, GUID_from_string("1fb9f2ee-2a4d-4bf8-af8b-cb9d4529a9ab", &guid), "");
236 torture_assert_mem_equal(tctx, &r->in.context_handle.uuid, &guid, sizeof(guid), "r->in.context_handle.uuid");
237
238 return true;
239 }
240
241 static const uint8_t witness_AsyncNotify_data_OUT[] = {
242 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
243 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x12, 0x00, 0x00, 0x00,
244 0x12, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x53, 0x00, 0x4f, 0x00,
245 0x46, 0x00, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
246 };
247
248 static bool witness_AsyncNotify_check_OUT(struct torture_context *tctx,
249 struct witness_AsyncNotify *r)
250 {
251 struct witness_notifyResponse *n;
252 struct witness_ResourceChange *c;
253
254 torture_assert(tctx, r->out.response, "r->out.response");
255
256 n = *(r->out.response);
257
258 torture_assert_int_equal(tctx, n->type, WITNESS_NOTIFY_RESOURCE_CHANGE, "type");
259 torture_assert_int_equal(tctx, n->length, 18, "length");
260 torture_assert_int_equal(tctx, n->num, 1, "num");
261
262 c = &n->messages[0].resource_change;
263
264 torture_assert_int_equal(tctx, c->length, 18, "c->length");
265 torture_assert_int_equal(tctx, c->type, WITNESS_RESOURCE_STATE_UNAVAILABLE, "c->type");
266 torture_assert_str_equal(tctx, c->name, "SOFS", "c->name");
267
268 return true;
269 }
270
271 static const uint8_t witness_AsyncNotify_data_move_OUT[] = {
272 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
273 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x24, 0x00, 0x00, 0x00,
274 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
275 0x01, 0x00, 0x00, 0x00, 0xc0, 0xa8, 0x03, 0x2d, 0x00, 0x00, 0x00, 0x00,
276 0x38, 0xe8, 0xeb, 0x26, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x60, 0x26,
277 0x00, 0x00, 0x00, 0x00
278 };
279
280 static bool witness_AsyncNotify_check_move_OUT(struct torture_context *tctx,
281 struct witness_AsyncNotify *r)
282 {
283 struct witness_notifyResponse *n;
284 struct witness_IPaddrInfoList *i;
285
286 torture_assert(tctx, r->out.response, "r->out.response");
287
288 n = *(r->out.response);
289
290 torture_assert_int_equal(tctx, n->type, WITNESS_NOTIFY_CLIENT_MOVE, "type");
291 torture_assert_int_equal(tctx, n->length, 36, "length");
292 torture_assert_int_equal(tctx, n->num, 1, "num");
293
294 i = &n->messages[0].client_move;
295
296 torture_assert_int_equal(tctx, i->length, 36, "i->length");
297 torture_assert_int_equal(tctx, i->reserved, 0, "i->reserved");
298 torture_assert_int_equal(tctx, i->num, 1, "i->num");
299
300 torture_assert_int_equal(tctx, i->addr[0].flags, WITNESS_IPADDR_V4, "i->addr[0].flags");
301 torture_assert_str_equal(tctx, i->addr[0].ipv4, "192.168.3.45", "i->addr[0].ipv4");
302 torture_assert_str_equal(tctx, i->addr[0].ipv6, "0000:0000:38e8:eb26:8e00:0000:009e:6026", "i->addr[0].ipv6");
303
304 return true;
305 }
306
307 static const uint8_t witness_AsyncNotify_data_fuzz1_OUT[] = {
308 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
309 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x0C, 0x00, 0x00, 0x00,
310 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
311 0x00, 0x00, 0x00, 0x00,
312 };
313
314 static bool witness_AsyncNotify_check_fuzz1_OUT(struct torture_context *tctx,
315 struct witness_AsyncNotify *r)
316 {
317 struct witness_notifyResponse *n;
318 struct witness_IPaddrInfoList *i;
319
320 torture_assert(tctx, r->out.response, "r->out.response");
321
322 n = *(r->out.response);
323
324 torture_assert_int_equal(tctx, n->type, WITNESS_NOTIFY_CLIENT_MOVE, "type");
325 torture_assert_int_equal(tctx, n->length, 12, "length");
326 torture_assert_int_equal(tctx, n->num, 1, "num");
327
328 i = &n->messages[0].client_move;
329
330 torture_assert_int_equal(tctx, i->length, 12, "i->length");
331 torture_assert_int_equal(tctx, i->reserved, 0, "i->reserved");
332 torture_assert_int_equal(tctx, i->num, 0, "i->num");
333
334 return true;
335 }
336
337 struct torture_suite *ndr_witness_suite(TALLOC_CTX *ctx)
338 {
339 struct torture_suite *suite = torture_suite_create(ctx, "witness");
340
341 torture_suite_add_ndr_pull_fn_test(suite,
342 witness_GetInterfaceList,
343 witness_GetInterfaceList_data,
344 NDR_OUT,
345 witness_GetInterfaceList_check);
346
347 torture_suite_add_ndr_pull_fn_test(suite,
348 witness_Register,
349 witness_Register_data_IN,
350 NDR_IN,
351 witness_Register_check_IN);
352
353 torture_suite_add_ndr_pull_fn_test(suite,
354 witness_Register,
355 witness_Register_data_OUT,
356 NDR_OUT,
357 witness_Register_check_OUT);
358
359 torture_suite_add_ndr_pull_fn_test(suite,
360 witness_UnRegister,
361 witness_UnRegister_data_IN,
362 NDR_IN,
363 witness_UnRegister_check_IN);
364
365 torture_suite_add_ndr_pull_fn_test(suite,
366 witness_UnRegister,
367 witness_UnRegister_data_OUT,
368 NDR_OUT,
369 witness_UnRegister_check_OUT);
370
371 torture_suite_add_ndr_pull_fn_test(suite,
372 witness_AsyncNotify,
373 witness_AsyncNotify_data_IN,
374 NDR_IN,
375 witness_AsyncNotify_check_IN);
376
377 torture_suite_add_ndr_pull_fn_test(suite,
378 witness_AsyncNotify,
379 witness_AsyncNotify_data_OUT,
380 NDR_OUT,
381 witness_AsyncNotify_check_OUT);
382
383 torture_suite_add_ndr_pullpush_fn_test_flags(suite,
384 witness_AsyncNotify,
385 witness_AsyncNotify_data_OUT,
386 NDR_OUT,
387 0,
388 witness_AsyncNotify_check_OUT);
389
390 torture_suite_add_ndr_pullpush_fn_test_flags(suite,
391 witness_AsyncNotify,
392 witness_AsyncNotify_data_move_OUT,
393 NDR_OUT,
394 0,
395 witness_AsyncNotify_check_move_OUT);
396
397 torture_suite_add_ndr_pull_fn_test(suite,
398 witness_AsyncNotify,
399 witness_AsyncNotify_data_fuzz1_OUT,
400 NDR_OUT,
401 witness_AsyncNotify_check_fuzz1_OUT);
402
403 torture_suite_add_ndr_pullpush_fn_test_flags(suite,
404 witness_AsyncNotify,
405 witness_AsyncNotify_data_fuzz1_OUT,
406 NDR_OUT,
407 0,
408 witness_AsyncNotify_check_fuzz1_OUT);
409
410 return suite;
411 }