1 /* parser auto-generated by pidl */
4 #include "../librpc/gen_ndr/ndr_named_pipe_auth.h"
6 #include "librpc/gen_ndr/ndr_netlogon.h"
7 static enum ndr_err_code
ndr_push_named_pipe_auth_req_info2(struct ndr_push
*ndr
, int ndr_flags
, const struct named_pipe_auth_req_info2
*r
)
9 if (ndr_flags
& NDR_SCALARS
) {
10 NDR_CHECK(ndr_push_align(ndr
, 5));
11 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->client_name
));
12 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->client_addr
));
13 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->client_port
));
14 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->server_name
));
15 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->server_addr
));
16 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->server_port
));
17 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->sam_info3
));
18 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->session_key_length
));
19 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->session_key
));
20 NDR_CHECK(ndr_push_trailer_align(ndr
, 5));
22 if (ndr_flags
& NDR_BUFFERS
) {
24 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->client_name
, CH_UTF8
)));
25 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, 0));
26 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->client_name
, CH_UTF8
)));
27 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, r
->client_name
, ndr_charset_length(r
->client_name
, CH_UTF8
), sizeof(uint8_t), CH_UTF8
));
30 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->client_addr
, CH_DOS
)));
31 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, 0));
32 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->client_addr
, CH_DOS
)));
33 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, r
->client_addr
, ndr_charset_length(r
->client_addr
, CH_DOS
), sizeof(uint8_t), CH_DOS
));
36 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->server_name
, CH_UTF8
)));
37 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, 0));
38 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->server_name
, CH_UTF8
)));
39 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, r
->server_name
, ndr_charset_length(r
->server_name
, CH_UTF8
), sizeof(uint8_t), CH_UTF8
));
42 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->server_addr
, CH_DOS
)));
43 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, 0));
44 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->server_addr
, CH_DOS
)));
45 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, r
->server_addr
, ndr_charset_length(r
->server_addr
, CH_DOS
), sizeof(uint8_t), CH_DOS
));
48 NDR_CHECK(ndr_push_netr_SamInfo3(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->sam_info3
));
51 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, r
->session_key_length
));
52 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->session_key
, r
->session_key_length
));
55 return NDR_ERR_SUCCESS
;
58 static enum ndr_err_code
ndr_pull_named_pipe_auth_req_info2(struct ndr_pull
*ndr
, int ndr_flags
, struct named_pipe_auth_req_info2
*r
)
60 uint32_t _ptr_client_name
;
61 uint32_t size_client_name_1
= 0;
62 uint32_t length_client_name_1
= 0;
63 TALLOC_CTX
*_mem_save_client_name_0
;
64 uint32_t _ptr_client_addr
;
65 uint32_t size_client_addr_1
= 0;
66 uint32_t length_client_addr_1
= 0;
67 TALLOC_CTX
*_mem_save_client_addr_0
;
68 uint32_t _ptr_server_name
;
69 uint32_t size_server_name_1
= 0;
70 uint32_t length_server_name_1
= 0;
71 TALLOC_CTX
*_mem_save_server_name_0
;
72 uint32_t _ptr_server_addr
;
73 uint32_t size_server_addr_1
= 0;
74 uint32_t length_server_addr_1
= 0;
75 TALLOC_CTX
*_mem_save_server_addr_0
;
76 uint32_t _ptr_sam_info3
;
77 TALLOC_CTX
*_mem_save_sam_info3_0
;
78 uint32_t _ptr_session_key
;
79 uint32_t size_session_key_1
= 0;
80 TALLOC_CTX
*_mem_save_session_key_0
;
81 if (ndr_flags
& NDR_SCALARS
) {
82 NDR_CHECK(ndr_pull_align(ndr
, 5));
83 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_client_name
));
84 if (_ptr_client_name
) {
85 NDR_PULL_ALLOC(ndr
, r
->client_name
);
87 r
->client_name
= NULL
;
89 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_client_addr
));
90 if (_ptr_client_addr
) {
91 NDR_PULL_ALLOC(ndr
, r
->client_addr
);
93 r
->client_addr
= NULL
;
95 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->client_port
));
96 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_server_name
));
97 if (_ptr_server_name
) {
98 NDR_PULL_ALLOC(ndr
, r
->server_name
);
100 r
->server_name
= NULL
;
102 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_server_addr
));
103 if (_ptr_server_addr
) {
104 NDR_PULL_ALLOC(ndr
, r
->server_addr
);
106 r
->server_addr
= NULL
;
108 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->server_port
));
109 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_sam_info3
));
110 if (_ptr_sam_info3
) {
111 NDR_PULL_ALLOC(ndr
, r
->sam_info3
);
115 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->session_key_length
));
116 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_session_key
));
117 if (_ptr_session_key
) {
118 NDR_PULL_ALLOC(ndr
, r
->session_key
);
120 r
->session_key
= NULL
;
122 NDR_CHECK(ndr_pull_trailer_align(ndr
, 5));
124 if (ndr_flags
& NDR_BUFFERS
) {
125 if (r
->client_name
) {
126 _mem_save_client_name_0
= NDR_PULL_GET_MEM_CTX(ndr
);
127 NDR_PULL_SET_MEM_CTX(ndr
, r
->client_name
, 0);
128 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->client_name
));
129 NDR_CHECK(ndr_pull_array_length(ndr
, &r
->client_name
));
130 size_client_name_1
= ndr_get_array_size(ndr
, &r
->client_name
);
131 length_client_name_1
= ndr_get_array_length(ndr
, &r
->client_name
);
132 if (length_client_name_1
> size_client_name_1
) {
133 return ndr_pull_error(ndr
, NDR_ERR_ARRAY_SIZE
, "Bad array size %u should exceed array length %u", size_client_name_1
, length_client_name_1
);
135 NDR_CHECK(ndr_check_string_terminator(ndr
, length_client_name_1
, sizeof(uint8_t)));
136 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->client_name
, length_client_name_1
, sizeof(uint8_t), CH_UTF8
));
137 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_client_name_0
, 0);
139 if (r
->client_addr
) {
140 _mem_save_client_addr_0
= NDR_PULL_GET_MEM_CTX(ndr
);
141 NDR_PULL_SET_MEM_CTX(ndr
, r
->client_addr
, 0);
142 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->client_addr
));
143 NDR_CHECK(ndr_pull_array_length(ndr
, &r
->client_addr
));
144 size_client_addr_1
= ndr_get_array_size(ndr
, &r
->client_addr
);
145 length_client_addr_1
= ndr_get_array_length(ndr
, &r
->client_addr
);
146 if (length_client_addr_1
> size_client_addr_1
) {
147 return ndr_pull_error(ndr
, NDR_ERR_ARRAY_SIZE
, "Bad array size %u should exceed array length %u", size_client_addr_1
, length_client_addr_1
);
149 NDR_CHECK(ndr_check_string_terminator(ndr
, length_client_addr_1
, sizeof(uint8_t)));
150 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->client_addr
, length_client_addr_1
, sizeof(uint8_t), CH_DOS
));
151 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_client_addr_0
, 0);
153 if (r
->server_name
) {
154 _mem_save_server_name_0
= NDR_PULL_GET_MEM_CTX(ndr
);
155 NDR_PULL_SET_MEM_CTX(ndr
, r
->server_name
, 0);
156 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->server_name
));
157 NDR_CHECK(ndr_pull_array_length(ndr
, &r
->server_name
));
158 size_server_name_1
= ndr_get_array_size(ndr
, &r
->server_name
);
159 length_server_name_1
= ndr_get_array_length(ndr
, &r
->server_name
);
160 if (length_server_name_1
> size_server_name_1
) {
161 return ndr_pull_error(ndr
, NDR_ERR_ARRAY_SIZE
, "Bad array size %u should exceed array length %u", size_server_name_1
, length_server_name_1
);
163 NDR_CHECK(ndr_check_string_terminator(ndr
, length_server_name_1
, sizeof(uint8_t)));
164 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->server_name
, length_server_name_1
, sizeof(uint8_t), CH_UTF8
));
165 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_server_name_0
, 0);
167 if (r
->server_addr
) {
168 _mem_save_server_addr_0
= NDR_PULL_GET_MEM_CTX(ndr
);
169 NDR_PULL_SET_MEM_CTX(ndr
, r
->server_addr
, 0);
170 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->server_addr
));
171 NDR_CHECK(ndr_pull_array_length(ndr
, &r
->server_addr
));
172 size_server_addr_1
= ndr_get_array_size(ndr
, &r
->server_addr
);
173 length_server_addr_1
= ndr_get_array_length(ndr
, &r
->server_addr
);
174 if (length_server_addr_1
> size_server_addr_1
) {
175 return ndr_pull_error(ndr
, NDR_ERR_ARRAY_SIZE
, "Bad array size %u should exceed array length %u", size_server_addr_1
, length_server_addr_1
);
177 NDR_CHECK(ndr_check_string_terminator(ndr
, length_server_addr_1
, sizeof(uint8_t)));
178 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->server_addr
, length_server_addr_1
, sizeof(uint8_t), CH_DOS
));
179 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_server_addr_0
, 0);
182 _mem_save_sam_info3_0
= NDR_PULL_GET_MEM_CTX(ndr
);
183 NDR_PULL_SET_MEM_CTX(ndr
, r
->sam_info3
, 0);
184 NDR_CHECK(ndr_pull_netr_SamInfo3(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->sam_info3
));
185 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_sam_info3_0
, 0);
187 if (r
->session_key
) {
188 _mem_save_session_key_0
= NDR_PULL_GET_MEM_CTX(ndr
);
189 NDR_PULL_SET_MEM_CTX(ndr
, r
->session_key
, 0);
190 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->session_key
));
191 size_session_key_1
= ndr_get_array_size(ndr
, &r
->session_key
);
192 NDR_PULL_ALLOC_N(ndr
, r
->session_key
, size_session_key_1
);
193 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->session_key
, size_session_key_1
));
194 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_session_key_0
, 0);
196 if (r
->session_key
) {
197 NDR_CHECK(ndr_check_array_size(ndr
, (void*)&r
->session_key
, r
->session_key_length
));
200 return NDR_ERR_SUCCESS
;
203 _PUBLIC_
void ndr_print_named_pipe_auth_req_info2(struct ndr_print
*ndr
, const char *name
, const struct named_pipe_auth_req_info2
*r
)
205 ndr_print_struct(ndr
, name
, "named_pipe_auth_req_info2");
207 ndr_print_ptr(ndr
, "client_name", r
->client_name
);
209 if (r
->client_name
) {
210 ndr_print_string(ndr
, "client_name", r
->client_name
);
213 ndr_print_ptr(ndr
, "client_addr", r
->client_addr
);
215 if (r
->client_addr
) {
216 ndr_print_string(ndr
, "client_addr", r
->client_addr
);
219 ndr_print_uint16(ndr
, "client_port", r
->client_port
);
220 ndr_print_ptr(ndr
, "server_name", r
->server_name
);
222 if (r
->server_name
) {
223 ndr_print_string(ndr
, "server_name", r
->server_name
);
226 ndr_print_ptr(ndr
, "server_addr", r
->server_addr
);
228 if (r
->server_addr
) {
229 ndr_print_string(ndr
, "server_addr", r
->server_addr
);
232 ndr_print_uint16(ndr
, "server_port", r
->server_port
);
233 ndr_print_ptr(ndr
, "sam_info3", r
->sam_info3
);
236 ndr_print_netr_SamInfo3(ndr
, "sam_info3", r
->sam_info3
);
239 ndr_print_uint32(ndr
, "session_key_length", r
->session_key_length
);
240 ndr_print_ptr(ndr
, "session_key", r
->session_key
);
242 if (r
->session_key
) {
243 ndr_print_array_uint8(ndr
, "session_key", r
->session_key
, r
->session_key_length
);
249 static enum ndr_err_code
ndr_push_named_pipe_auth_req_info3(struct ndr_push
*ndr
, int ndr_flags
, const struct named_pipe_auth_req_info3
*r
)
251 if (ndr_flags
& NDR_SCALARS
) {
252 NDR_CHECK(ndr_push_align(ndr
, 5));
253 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->client_name
));
254 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->client_addr
));
255 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->client_port
));
256 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->server_name
));
257 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->server_addr
));
258 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->server_port
));
259 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->sam_info3
));
260 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->session_key_length
));
261 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->session_key
));
262 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->gssapi_delegated_creds_length
));
263 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->gssapi_delegated_creds
));
264 NDR_CHECK(ndr_push_trailer_align(ndr
, 5));
266 if (ndr_flags
& NDR_BUFFERS
) {
267 if (r
->client_name
) {
268 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->client_name
, CH_UTF8
)));
269 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, 0));
270 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->client_name
, CH_UTF8
)));
271 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, r
->client_name
, ndr_charset_length(r
->client_name
, CH_UTF8
), sizeof(uint8_t), CH_UTF8
));
273 if (r
->client_addr
) {
274 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->client_addr
, CH_DOS
)));
275 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, 0));
276 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->client_addr
, CH_DOS
)));
277 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, r
->client_addr
, ndr_charset_length(r
->client_addr
, CH_DOS
), sizeof(uint8_t), CH_DOS
));
279 if (r
->server_name
) {
280 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->server_name
, CH_UTF8
)));
281 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, 0));
282 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->server_name
, CH_UTF8
)));
283 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, r
->server_name
, ndr_charset_length(r
->server_name
, CH_UTF8
), sizeof(uint8_t), CH_UTF8
));
285 if (r
->server_addr
) {
286 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->server_addr
, CH_DOS
)));
287 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, 0));
288 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, ndr_charset_length(r
->server_addr
, CH_DOS
)));
289 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, r
->server_addr
, ndr_charset_length(r
->server_addr
, CH_DOS
), sizeof(uint8_t), CH_DOS
));
292 NDR_CHECK(ndr_push_netr_SamInfo3(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->sam_info3
));
294 if (r
->session_key
) {
295 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, r
->session_key_length
));
296 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->session_key
, r
->session_key_length
));
298 if (r
->gssapi_delegated_creds
) {
299 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, r
->gssapi_delegated_creds_length
));
300 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->gssapi_delegated_creds
, r
->gssapi_delegated_creds_length
));
303 return NDR_ERR_SUCCESS
;
306 static enum ndr_err_code
ndr_pull_named_pipe_auth_req_info3(struct ndr_pull
*ndr
, int ndr_flags
, struct named_pipe_auth_req_info3
*r
)
308 uint32_t _ptr_client_name
;
309 uint32_t size_client_name_1
= 0;
310 uint32_t length_client_name_1
= 0;
311 TALLOC_CTX
*_mem_save_client_name_0
;
312 uint32_t _ptr_client_addr
;
313 uint32_t size_client_addr_1
= 0;
314 uint32_t length_client_addr_1
= 0;
315 TALLOC_CTX
*_mem_save_client_addr_0
;
316 uint32_t _ptr_server_name
;
317 uint32_t size_server_name_1
= 0;
318 uint32_t length_server_name_1
= 0;
319 TALLOC_CTX
*_mem_save_server_name_0
;
320 uint32_t _ptr_server_addr
;
321 uint32_t size_server_addr_1
= 0;
322 uint32_t length_server_addr_1
= 0;
323 TALLOC_CTX
*_mem_save_server_addr_0
;
324 uint32_t _ptr_sam_info3
;
325 TALLOC_CTX
*_mem_save_sam_info3_0
;
326 uint32_t _ptr_session_key
;
327 uint32_t size_session_key_1
= 0;
328 TALLOC_CTX
*_mem_save_session_key_0
;
329 uint32_t _ptr_gssapi_delegated_creds
;
330 uint32_t size_gssapi_delegated_creds_1
= 0;
331 TALLOC_CTX
*_mem_save_gssapi_delegated_creds_0
;
332 if (ndr_flags
& NDR_SCALARS
) {
333 NDR_CHECK(ndr_pull_align(ndr
, 5));
334 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_client_name
));
335 if (_ptr_client_name
) {
336 NDR_PULL_ALLOC(ndr
, r
->client_name
);
338 r
->client_name
= NULL
;
340 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_client_addr
));
341 if (_ptr_client_addr
) {
342 NDR_PULL_ALLOC(ndr
, r
->client_addr
);
344 r
->client_addr
= NULL
;
346 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->client_port
));
347 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_server_name
));
348 if (_ptr_server_name
) {
349 NDR_PULL_ALLOC(ndr
, r
->server_name
);
351 r
->server_name
= NULL
;
353 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_server_addr
));
354 if (_ptr_server_addr
) {
355 NDR_PULL_ALLOC(ndr
, r
->server_addr
);
357 r
->server_addr
= NULL
;
359 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->server_port
));
360 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_sam_info3
));
361 if (_ptr_sam_info3
) {
362 NDR_PULL_ALLOC(ndr
, r
->sam_info3
);
366 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->session_key_length
));
367 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_session_key
));
368 if (_ptr_session_key
) {
369 NDR_PULL_ALLOC(ndr
, r
->session_key
);
371 r
->session_key
= NULL
;
373 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->gssapi_delegated_creds_length
));
374 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_gssapi_delegated_creds
));
375 if (_ptr_gssapi_delegated_creds
) {
376 NDR_PULL_ALLOC(ndr
, r
->gssapi_delegated_creds
);
378 r
->gssapi_delegated_creds
= NULL
;
380 NDR_CHECK(ndr_pull_trailer_align(ndr
, 5));
382 if (ndr_flags
& NDR_BUFFERS
) {
383 if (r
->client_name
) {
384 _mem_save_client_name_0
= NDR_PULL_GET_MEM_CTX(ndr
);
385 NDR_PULL_SET_MEM_CTX(ndr
, r
->client_name
, 0);
386 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->client_name
));
387 NDR_CHECK(ndr_pull_array_length(ndr
, &r
->client_name
));
388 size_client_name_1
= ndr_get_array_size(ndr
, &r
->client_name
);
389 length_client_name_1
= ndr_get_array_length(ndr
, &r
->client_name
);
390 if (length_client_name_1
> size_client_name_1
) {
391 return ndr_pull_error(ndr
, NDR_ERR_ARRAY_SIZE
, "Bad array size %u should exceed array length %u", size_client_name_1
, length_client_name_1
);
393 NDR_CHECK(ndr_check_string_terminator(ndr
, length_client_name_1
, sizeof(uint8_t)));
394 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->client_name
, length_client_name_1
, sizeof(uint8_t), CH_UTF8
));
395 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_client_name_0
, 0);
397 if (r
->client_addr
) {
398 _mem_save_client_addr_0
= NDR_PULL_GET_MEM_CTX(ndr
);
399 NDR_PULL_SET_MEM_CTX(ndr
, r
->client_addr
, 0);
400 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->client_addr
));
401 NDR_CHECK(ndr_pull_array_length(ndr
, &r
->client_addr
));
402 size_client_addr_1
= ndr_get_array_size(ndr
, &r
->client_addr
);
403 length_client_addr_1
= ndr_get_array_length(ndr
, &r
->client_addr
);
404 if (length_client_addr_1
> size_client_addr_1
) {
405 return ndr_pull_error(ndr
, NDR_ERR_ARRAY_SIZE
, "Bad array size %u should exceed array length %u", size_client_addr_1
, length_client_addr_1
);
407 NDR_CHECK(ndr_check_string_terminator(ndr
, length_client_addr_1
, sizeof(uint8_t)));
408 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->client_addr
, length_client_addr_1
, sizeof(uint8_t), CH_DOS
));
409 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_client_addr_0
, 0);
411 if (r
->server_name
) {
412 _mem_save_server_name_0
= NDR_PULL_GET_MEM_CTX(ndr
);
413 NDR_PULL_SET_MEM_CTX(ndr
, r
->server_name
, 0);
414 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->server_name
));
415 NDR_CHECK(ndr_pull_array_length(ndr
, &r
->server_name
));
416 size_server_name_1
= ndr_get_array_size(ndr
, &r
->server_name
);
417 length_server_name_1
= ndr_get_array_length(ndr
, &r
->server_name
);
418 if (length_server_name_1
> size_server_name_1
) {
419 return ndr_pull_error(ndr
, NDR_ERR_ARRAY_SIZE
, "Bad array size %u should exceed array length %u", size_server_name_1
, length_server_name_1
);
421 NDR_CHECK(ndr_check_string_terminator(ndr
, length_server_name_1
, sizeof(uint8_t)));
422 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->server_name
, length_server_name_1
, sizeof(uint8_t), CH_UTF8
));
423 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_server_name_0
, 0);
425 if (r
->server_addr
) {
426 _mem_save_server_addr_0
= NDR_PULL_GET_MEM_CTX(ndr
);
427 NDR_PULL_SET_MEM_CTX(ndr
, r
->server_addr
, 0);
428 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->server_addr
));
429 NDR_CHECK(ndr_pull_array_length(ndr
, &r
->server_addr
));
430 size_server_addr_1
= ndr_get_array_size(ndr
, &r
->server_addr
);
431 length_server_addr_1
= ndr_get_array_length(ndr
, &r
->server_addr
);
432 if (length_server_addr_1
> size_server_addr_1
) {
433 return ndr_pull_error(ndr
, NDR_ERR_ARRAY_SIZE
, "Bad array size %u should exceed array length %u", size_server_addr_1
, length_server_addr_1
);
435 NDR_CHECK(ndr_check_string_terminator(ndr
, length_server_addr_1
, sizeof(uint8_t)));
436 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->server_addr
, length_server_addr_1
, sizeof(uint8_t), CH_DOS
));
437 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_server_addr_0
, 0);
440 _mem_save_sam_info3_0
= NDR_PULL_GET_MEM_CTX(ndr
);
441 NDR_PULL_SET_MEM_CTX(ndr
, r
->sam_info3
, 0);
442 NDR_CHECK(ndr_pull_netr_SamInfo3(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->sam_info3
));
443 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_sam_info3_0
, 0);
445 if (r
->session_key
) {
446 _mem_save_session_key_0
= NDR_PULL_GET_MEM_CTX(ndr
);
447 NDR_PULL_SET_MEM_CTX(ndr
, r
->session_key
, 0);
448 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->session_key
));
449 size_session_key_1
= ndr_get_array_size(ndr
, &r
->session_key
);
450 NDR_PULL_ALLOC_N(ndr
, r
->session_key
, size_session_key_1
);
451 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->session_key
, size_session_key_1
));
452 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_session_key_0
, 0);
454 if (r
->gssapi_delegated_creds
) {
455 _mem_save_gssapi_delegated_creds_0
= NDR_PULL_GET_MEM_CTX(ndr
);
456 NDR_PULL_SET_MEM_CTX(ndr
, r
->gssapi_delegated_creds
, 0);
457 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->gssapi_delegated_creds
));
458 size_gssapi_delegated_creds_1
= ndr_get_array_size(ndr
, &r
->gssapi_delegated_creds
);
459 NDR_PULL_ALLOC_N(ndr
, r
->gssapi_delegated_creds
, size_gssapi_delegated_creds_1
);
460 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->gssapi_delegated_creds
, size_gssapi_delegated_creds_1
));
461 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_gssapi_delegated_creds_0
, 0);
463 if (r
->session_key
) {
464 NDR_CHECK(ndr_check_array_size(ndr
, (void*)&r
->session_key
, r
->session_key_length
));
466 if (r
->gssapi_delegated_creds
) {
467 NDR_CHECK(ndr_check_array_size(ndr
, (void*)&r
->gssapi_delegated_creds
, r
->gssapi_delegated_creds_length
));
470 return NDR_ERR_SUCCESS
;
473 _PUBLIC_
void ndr_print_named_pipe_auth_req_info3(struct ndr_print
*ndr
, const char *name
, const struct named_pipe_auth_req_info3
*r
)
475 ndr_print_struct(ndr
, name
, "named_pipe_auth_req_info3");
477 ndr_print_ptr(ndr
, "client_name", r
->client_name
);
479 if (r
->client_name
) {
480 ndr_print_string(ndr
, "client_name", r
->client_name
);
483 ndr_print_ptr(ndr
, "client_addr", r
->client_addr
);
485 if (r
->client_addr
) {
486 ndr_print_string(ndr
, "client_addr", r
->client_addr
);
489 ndr_print_uint16(ndr
, "client_port", r
->client_port
);
490 ndr_print_ptr(ndr
, "server_name", r
->server_name
);
492 if (r
->server_name
) {
493 ndr_print_string(ndr
, "server_name", r
->server_name
);
496 ndr_print_ptr(ndr
, "server_addr", r
->server_addr
);
498 if (r
->server_addr
) {
499 ndr_print_string(ndr
, "server_addr", r
->server_addr
);
502 ndr_print_uint16(ndr
, "server_port", r
->server_port
);
503 ndr_print_ptr(ndr
, "sam_info3", r
->sam_info3
);
506 ndr_print_netr_SamInfo3(ndr
, "sam_info3", r
->sam_info3
);
509 ndr_print_uint32(ndr
, "session_key_length", r
->session_key_length
);
510 ndr_print_ptr(ndr
, "session_key", r
->session_key
);
512 if (r
->session_key
) {
513 ndr_print_array_uint8(ndr
, "session_key", r
->session_key
, r
->session_key_length
);
516 ndr_print_uint32(ndr
, "gssapi_delegated_creds_length", r
->gssapi_delegated_creds_length
);
517 ndr_print_ptr(ndr
, "gssapi_delegated_creds", r
->gssapi_delegated_creds
);
519 if (r
->gssapi_delegated_creds
) {
520 ndr_print_array_uint8(ndr
, "gssapi_delegated_creds", r
->gssapi_delegated_creds
, r
->gssapi_delegated_creds_length
);
526 static enum ndr_err_code
ndr_push_named_pipe_auth_req_info(struct ndr_push
*ndr
, int ndr_flags
, const union named_pipe_auth_req_info
*r
)
528 if (ndr_flags
& NDR_SCALARS
) {
529 int level
= ndr_push_get_switch_value(ndr
, r
);
530 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, level
));
531 NDR_CHECK(ndr_push_union_align(ndr
, 5));
537 NDR_CHECK(ndr_push_netr_SamInfo3(ndr
, NDR_SCALARS
, &r
->info1
));
541 NDR_CHECK(ndr_push_named_pipe_auth_req_info2(ndr
, NDR_SCALARS
, &r
->info2
));
545 NDR_CHECK(ndr_push_named_pipe_auth_req_info3(ndr
, NDR_SCALARS
, &r
->info3
));
549 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
552 if (ndr_flags
& NDR_BUFFERS
) {
553 int level
= ndr_push_get_switch_value(ndr
, r
);
559 NDR_CHECK(ndr_push_netr_SamInfo3(ndr
, NDR_BUFFERS
, &r
->info1
));
563 NDR_CHECK(ndr_push_named_pipe_auth_req_info2(ndr
, NDR_BUFFERS
, &r
->info2
));
567 NDR_CHECK(ndr_push_named_pipe_auth_req_info3(ndr
, NDR_BUFFERS
, &r
->info3
));
571 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
574 return NDR_ERR_SUCCESS
;
577 static enum ndr_err_code
ndr_pull_named_pipe_auth_req_info(struct ndr_pull
*ndr
, int ndr_flags
, union named_pipe_auth_req_info
*r
)
581 level
= ndr_pull_get_switch_value(ndr
, r
);
582 if (ndr_flags
& NDR_SCALARS
) {
583 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &_level
));
584 if (_level
!= level
) {
585 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u for r at %s", _level
, __location__
);
587 NDR_CHECK(ndr_pull_union_align(ndr
, 5));
593 NDR_CHECK(ndr_pull_netr_SamInfo3(ndr
, NDR_SCALARS
, &r
->info1
));
597 NDR_CHECK(ndr_pull_named_pipe_auth_req_info2(ndr
, NDR_SCALARS
, &r
->info2
));
601 NDR_CHECK(ndr_pull_named_pipe_auth_req_info3(ndr
, NDR_SCALARS
, &r
->info3
));
605 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
608 if (ndr_flags
& NDR_BUFFERS
) {
614 NDR_CHECK(ndr_pull_netr_SamInfo3(ndr
, NDR_BUFFERS
, &r
->info1
));
618 NDR_CHECK(ndr_pull_named_pipe_auth_req_info2(ndr
, NDR_BUFFERS
, &r
->info2
));
622 NDR_CHECK(ndr_pull_named_pipe_auth_req_info3(ndr
, NDR_BUFFERS
, &r
->info3
));
626 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
629 return NDR_ERR_SUCCESS
;
632 _PUBLIC_
void ndr_print_named_pipe_auth_req_info(struct ndr_print
*ndr
, const char *name
, const union named_pipe_auth_req_info
*r
)
635 level
= ndr_print_get_switch_value(ndr
, r
);
636 ndr_print_union(ndr
, name
, level
, "named_pipe_auth_req_info");
642 ndr_print_netr_SamInfo3(ndr
, "info1", &r
->info1
);
646 ndr_print_named_pipe_auth_req_info2(ndr
, "info2", &r
->info2
);
650 ndr_print_named_pipe_auth_req_info3(ndr
, "info3", &r
->info3
);
654 ndr_print_bad_level(ndr
, name
, level
);
658 _PUBLIC_
enum ndr_err_code
ndr_push_named_pipe_auth_req(struct ndr_push
*ndr
, int ndr_flags
, const struct named_pipe_auth_req
*r
)
660 if (ndr_flags
& NDR_SCALARS
) {
661 NDR_CHECK(ndr_push_align(ndr
, 5));
663 uint32_t _flags_save_uint32
= ndr
->flags
;
664 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_BIGENDIAN
);
665 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, ndr_size_named_pipe_auth_req(r
, ndr
->iconv_convenience
, ndr
->flags
) - 4));
666 ndr
->flags
= _flags_save_uint32
;
668 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, NAMED_PIPE_AUTH_MAGIC
, 4, sizeof(uint8_t), CH_DOS
));
669 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->level
));
670 NDR_CHECK(ndr_push_set_switch_value(ndr
, &r
->info
, r
->level
));
671 NDR_CHECK(ndr_push_named_pipe_auth_req_info(ndr
, NDR_SCALARS
, &r
->info
));
672 NDR_CHECK(ndr_push_trailer_align(ndr
, 5));
674 if (ndr_flags
& NDR_BUFFERS
) {
675 NDR_CHECK(ndr_push_named_pipe_auth_req_info(ndr
, NDR_BUFFERS
, &r
->info
));
677 return NDR_ERR_SUCCESS
;
680 _PUBLIC_
enum ndr_err_code
ndr_pull_named_pipe_auth_req(struct ndr_pull
*ndr
, int ndr_flags
, struct named_pipe_auth_req
*r
)
682 uint32_t size_magic_0
= 0;
683 if (ndr_flags
& NDR_SCALARS
) {
684 NDR_CHECK(ndr_pull_align(ndr
, 5));
686 uint32_t _flags_save_uint32
= ndr
->flags
;
687 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_BIGENDIAN
);
688 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->length
));
689 ndr
->flags
= _flags_save_uint32
;
692 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->magic
, size_magic_0
, sizeof(uint8_t), CH_DOS
));
693 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->level
));
694 NDR_CHECK(ndr_pull_set_switch_value(ndr
, &r
->info
, r
->level
));
695 NDR_CHECK(ndr_pull_named_pipe_auth_req_info(ndr
, NDR_SCALARS
, &r
->info
));
696 NDR_CHECK(ndr_pull_trailer_align(ndr
, 5));
698 if (ndr_flags
& NDR_BUFFERS
) {
699 NDR_CHECK(ndr_pull_named_pipe_auth_req_info(ndr
, NDR_BUFFERS
, &r
->info
));
701 return NDR_ERR_SUCCESS
;
704 _PUBLIC_
void ndr_print_named_pipe_auth_req(struct ndr_print
*ndr
, const char *name
, const struct named_pipe_auth_req
*r
)
706 ndr_print_struct(ndr
, name
, "named_pipe_auth_req");
708 ndr_print_uint32(ndr
, "length", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?ndr_size_named_pipe_auth_req(r
, ndr
->iconv_convenience
, ndr
->flags
) - 4:r
->length
);
709 ndr_print_string(ndr
, "magic", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?NAMED_PIPE_AUTH_MAGIC
:r
->magic
);
710 ndr_print_uint32(ndr
, "level", r
->level
);
711 ndr_print_set_switch_value(ndr
, &r
->info
, r
->level
);
712 ndr_print_named_pipe_auth_req_info(ndr
, "info", &r
->info
);
716 _PUBLIC_
size_t ndr_size_named_pipe_auth_req(const struct named_pipe_auth_req
*r
, struct smb_iconv_convenience
*ic
, int flags
)
718 return ndr_size_struct(r
, flags
, (ndr_push_flags_fn_t
)ndr_push_named_pipe_auth_req
, ic
);
721 static enum ndr_err_code
ndr_push_named_pipe_auth_rep_info2(struct ndr_push
*ndr
, int ndr_flags
, const struct named_pipe_auth_rep_info2
*r
)
723 if (ndr_flags
& NDR_SCALARS
) {
724 NDR_CHECK(ndr_push_align(ndr
, 8));
725 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->file_type
));
726 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->device_state
));
727 NDR_CHECK(ndr_push_hyper(ndr
, NDR_SCALARS
, r
->allocation_size
));
728 NDR_CHECK(ndr_push_trailer_align(ndr
, 8));
730 if (ndr_flags
& NDR_BUFFERS
) {
732 return NDR_ERR_SUCCESS
;
735 static enum ndr_err_code
ndr_pull_named_pipe_auth_rep_info2(struct ndr_pull
*ndr
, int ndr_flags
, struct named_pipe_auth_rep_info2
*r
)
737 if (ndr_flags
& NDR_SCALARS
) {
738 NDR_CHECK(ndr_pull_align(ndr
, 8));
739 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->file_type
));
740 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->device_state
));
741 NDR_CHECK(ndr_pull_hyper(ndr
, NDR_SCALARS
, &r
->allocation_size
));
742 NDR_CHECK(ndr_pull_trailer_align(ndr
, 8));
744 if (ndr_flags
& NDR_BUFFERS
) {
746 return NDR_ERR_SUCCESS
;
749 _PUBLIC_
void ndr_print_named_pipe_auth_rep_info2(struct ndr_print
*ndr
, const char *name
, const struct named_pipe_auth_rep_info2
*r
)
751 ndr_print_struct(ndr
, name
, "named_pipe_auth_rep_info2");
753 ndr_print_uint16(ndr
, "file_type", r
->file_type
);
754 ndr_print_uint16(ndr
, "device_state", r
->device_state
);
755 ndr_print_hyper(ndr
, "allocation_size", r
->allocation_size
);
759 static enum ndr_err_code
ndr_push_named_pipe_auth_rep_info3(struct ndr_push
*ndr
, int ndr_flags
, const struct named_pipe_auth_rep_info3
*r
)
761 if (ndr_flags
& NDR_SCALARS
) {
762 NDR_CHECK(ndr_push_align(ndr
, 8));
763 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->file_type
));
764 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->device_state
));
765 NDR_CHECK(ndr_push_hyper(ndr
, NDR_SCALARS
, r
->allocation_size
));
766 NDR_CHECK(ndr_push_trailer_align(ndr
, 8));
768 if (ndr_flags
& NDR_BUFFERS
) {
770 return NDR_ERR_SUCCESS
;
773 static enum ndr_err_code
ndr_pull_named_pipe_auth_rep_info3(struct ndr_pull
*ndr
, int ndr_flags
, struct named_pipe_auth_rep_info3
*r
)
775 if (ndr_flags
& NDR_SCALARS
) {
776 NDR_CHECK(ndr_pull_align(ndr
, 8));
777 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->file_type
));
778 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->device_state
));
779 NDR_CHECK(ndr_pull_hyper(ndr
, NDR_SCALARS
, &r
->allocation_size
));
780 NDR_CHECK(ndr_pull_trailer_align(ndr
, 8));
782 if (ndr_flags
& NDR_BUFFERS
) {
784 return NDR_ERR_SUCCESS
;
787 _PUBLIC_
void ndr_print_named_pipe_auth_rep_info3(struct ndr_print
*ndr
, const char *name
, const struct named_pipe_auth_rep_info3
*r
)
789 ndr_print_struct(ndr
, name
, "named_pipe_auth_rep_info3");
791 ndr_print_uint16(ndr
, "file_type", r
->file_type
);
792 ndr_print_uint16(ndr
, "device_state", r
->device_state
);
793 ndr_print_hyper(ndr
, "allocation_size", r
->allocation_size
);
797 static enum ndr_err_code
ndr_push_named_pipe_auth_rep_info(struct ndr_push
*ndr
, int ndr_flags
, const union named_pipe_auth_rep_info
*r
)
799 if (ndr_flags
& NDR_SCALARS
) {
800 int level
= ndr_push_get_switch_value(ndr
, r
);
801 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, level
));
802 NDR_CHECK(ndr_push_union_align(ndr
, 8));
811 NDR_CHECK(ndr_push_named_pipe_auth_rep_info2(ndr
, NDR_SCALARS
, &r
->info2
));
815 NDR_CHECK(ndr_push_named_pipe_auth_rep_info3(ndr
, NDR_SCALARS
, &r
->info3
));
819 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
822 if (ndr_flags
& NDR_BUFFERS
) {
823 int level
= ndr_push_get_switch_value(ndr
, r
);
838 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
841 return NDR_ERR_SUCCESS
;
844 static enum ndr_err_code
ndr_pull_named_pipe_auth_rep_info(struct ndr_pull
*ndr
, int ndr_flags
, union named_pipe_auth_rep_info
*r
)
848 level
= ndr_pull_get_switch_value(ndr
, r
);
849 if (ndr_flags
& NDR_SCALARS
) {
850 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &_level
));
851 if (_level
!= level
) {
852 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u for r at %s", _level
, __location__
);
854 NDR_CHECK(ndr_pull_union_align(ndr
, 8));
863 NDR_CHECK(ndr_pull_named_pipe_auth_rep_info2(ndr
, NDR_SCALARS
, &r
->info2
));
867 NDR_CHECK(ndr_pull_named_pipe_auth_rep_info3(ndr
, NDR_SCALARS
, &r
->info3
));
871 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
874 if (ndr_flags
& NDR_BUFFERS
) {
889 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u at %s", level
, __location__
);
892 return NDR_ERR_SUCCESS
;
895 _PUBLIC_
void ndr_print_named_pipe_auth_rep_info(struct ndr_print
*ndr
, const char *name
, const union named_pipe_auth_rep_info
*r
)
898 level
= ndr_print_get_switch_value(ndr
, r
);
899 ndr_print_union(ndr
, name
, level
, "named_pipe_auth_rep_info");
908 ndr_print_named_pipe_auth_rep_info2(ndr
, "info2", &r
->info2
);
912 ndr_print_named_pipe_auth_rep_info3(ndr
, "info3", &r
->info3
);
916 ndr_print_bad_level(ndr
, name
, level
);
920 _PUBLIC_
enum ndr_err_code
ndr_push_named_pipe_auth_rep(struct ndr_push
*ndr
, int ndr_flags
, const struct named_pipe_auth_rep
*r
)
922 if (ndr_flags
& NDR_SCALARS
) {
923 NDR_CHECK(ndr_push_align(ndr
, 8));
925 uint32_t _flags_save_uint32
= ndr
->flags
;
926 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_BIGENDIAN
);
927 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, ndr_size_named_pipe_auth_rep(r
, ndr
->iconv_convenience
, ndr
->flags
) - 4));
928 ndr
->flags
= _flags_save_uint32
;
930 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, NAMED_PIPE_AUTH_MAGIC
, 4, sizeof(uint8_t), CH_DOS
));
931 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->level
));
932 NDR_CHECK(ndr_push_set_switch_value(ndr
, &r
->info
, r
->level
));
933 NDR_CHECK(ndr_push_named_pipe_auth_rep_info(ndr
, NDR_SCALARS
, &r
->info
));
934 NDR_CHECK(ndr_push_NTSTATUS(ndr
, NDR_SCALARS
, r
->status
));
935 NDR_CHECK(ndr_push_trailer_align(ndr
, 8));
937 if (ndr_flags
& NDR_BUFFERS
) {
938 NDR_CHECK(ndr_push_named_pipe_auth_rep_info(ndr
, NDR_BUFFERS
, &r
->info
));
940 return NDR_ERR_SUCCESS
;
943 _PUBLIC_
enum ndr_err_code
ndr_pull_named_pipe_auth_rep(struct ndr_pull
*ndr
, int ndr_flags
, struct named_pipe_auth_rep
*r
)
945 uint32_t size_magic_0
= 0;
946 if (ndr_flags
& NDR_SCALARS
) {
947 NDR_CHECK(ndr_pull_align(ndr
, 8));
949 uint32_t _flags_save_uint32
= ndr
->flags
;
950 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_BIGENDIAN
);
951 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->length
));
952 ndr
->flags
= _flags_save_uint32
;
955 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->magic
, size_magic_0
, sizeof(uint8_t), CH_DOS
));
956 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->level
));
957 NDR_CHECK(ndr_pull_set_switch_value(ndr
, &r
->info
, r
->level
));
958 NDR_CHECK(ndr_pull_named_pipe_auth_rep_info(ndr
, NDR_SCALARS
, &r
->info
));
959 NDR_CHECK(ndr_pull_NTSTATUS(ndr
, NDR_SCALARS
, &r
->status
));
960 NDR_CHECK(ndr_pull_trailer_align(ndr
, 8));
962 if (ndr_flags
& NDR_BUFFERS
) {
963 NDR_CHECK(ndr_pull_named_pipe_auth_rep_info(ndr
, NDR_BUFFERS
, &r
->info
));
965 return NDR_ERR_SUCCESS
;
968 _PUBLIC_
void ndr_print_named_pipe_auth_rep(struct ndr_print
*ndr
, const char *name
, const struct named_pipe_auth_rep
*r
)
970 ndr_print_struct(ndr
, name
, "named_pipe_auth_rep");
972 ndr_print_uint32(ndr
, "length", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?ndr_size_named_pipe_auth_rep(r
, ndr
->iconv_convenience
, ndr
->flags
) - 4:r
->length
);
973 ndr_print_string(ndr
, "magic", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?NAMED_PIPE_AUTH_MAGIC
:r
->magic
);
974 ndr_print_uint32(ndr
, "level", r
->level
);
975 ndr_print_set_switch_value(ndr
, &r
->info
, r
->level
);
976 ndr_print_named_pipe_auth_rep_info(ndr
, "info", &r
->info
);
977 ndr_print_NTSTATUS(ndr
, "status", r
->status
);
981 _PUBLIC_
size_t ndr_size_named_pipe_auth_rep(const struct named_pipe_auth_rep
*r
, struct smb_iconv_convenience
*ic
, int flags
)
983 return ndr_size_struct(r
, flags
, (ndr_push_flags_fn_t
)ndr_push_named_pipe_auth_rep
, ic
);