s4:librpc/ndr: if uninitialized variable in string_array code
[Samba/gbeck.git] / librpc / gen_ndr / ndr_xattr.c
blobd217a00228dd688cc2cb1621205edde571bbde2b
1 /* parser auto-generated by pidl */
3 #include "includes.h"
4 #include "../librpc/gen_ndr/ndr_xattr.h"
6 #include "librpc/gen_ndr/ndr_security.h"
7 static enum ndr_err_code ndr_push_xattr_DosInfo1(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosInfo1 *r)
9 if (ndr_flags & NDR_SCALARS) {
10 NDR_CHECK(ndr_push_align(ndr, 4));
11 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->attrib));
12 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ea_size));
13 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->size));
14 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->alloc_size));
15 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->create_time));
16 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->change_time));
18 if (ndr_flags & NDR_BUFFERS) {
20 return NDR_ERR_SUCCESS;
23 static enum ndr_err_code ndr_pull_xattr_DosInfo1(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosInfo1 *r)
25 if (ndr_flags & NDR_SCALARS) {
26 NDR_CHECK(ndr_pull_align(ndr, 4));
27 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->attrib));
28 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ea_size));
29 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->size));
30 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->alloc_size));
31 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->create_time));
32 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->change_time));
34 if (ndr_flags & NDR_BUFFERS) {
36 return NDR_ERR_SUCCESS;
39 _PUBLIC_ void ndr_print_xattr_DosInfo1(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo1 *r)
41 ndr_print_struct(ndr, name, "xattr_DosInfo1");
42 ndr->depth++;
43 ndr_print_uint32(ndr, "attrib", r->attrib);
44 ndr_print_uint32(ndr, "ea_size", r->ea_size);
45 ndr_print_udlong(ndr, "size", r->size);
46 ndr_print_udlong(ndr, "alloc_size", r->alloc_size);
47 ndr_print_NTTIME(ndr, "create_time", r->create_time);
48 ndr_print_NTTIME(ndr, "change_time", r->change_time);
49 ndr->depth--;
52 static enum ndr_err_code ndr_push_xattr_DosInfo2Old(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosInfo2Old *r)
54 if (ndr_flags & NDR_SCALARS) {
55 NDR_CHECK(ndr_push_align(ndr, 4));
56 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->flags));
57 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->attrib));
58 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ea_size));
59 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->size));
60 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->alloc_size));
61 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->create_time));
62 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->change_time));
63 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->write_time));
65 uint32_t _flags_save_string = ndr->flags;
66 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
67 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name));
68 ndr->flags = _flags_save_string;
71 if (ndr_flags & NDR_BUFFERS) {
73 return NDR_ERR_SUCCESS;
76 static enum ndr_err_code ndr_pull_xattr_DosInfo2Old(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosInfo2Old *r)
78 if (ndr_flags & NDR_SCALARS) {
79 NDR_CHECK(ndr_pull_align(ndr, 4));
80 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->flags));
81 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->attrib));
82 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ea_size));
83 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->size));
84 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->alloc_size));
85 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->create_time));
86 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->change_time));
87 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->write_time));
89 uint32_t _flags_save_string = ndr->flags;
90 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
91 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name));
92 ndr->flags = _flags_save_string;
95 if (ndr_flags & NDR_BUFFERS) {
97 return NDR_ERR_SUCCESS;
100 _PUBLIC_ void ndr_print_xattr_DosInfo2Old(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo2Old *r)
102 ndr_print_struct(ndr, name, "xattr_DosInfo2Old");
103 ndr->depth++;
104 ndr_print_uint32(ndr, "flags", r->flags);
105 ndr_print_uint32(ndr, "attrib", r->attrib);
106 ndr_print_uint32(ndr, "ea_size", r->ea_size);
107 ndr_print_udlong(ndr, "size", r->size);
108 ndr_print_udlong(ndr, "alloc_size", r->alloc_size);
109 ndr_print_NTTIME(ndr, "create_time", r->create_time);
110 ndr_print_NTTIME(ndr, "change_time", r->change_time);
111 ndr_print_NTTIME(ndr, "write_time", r->write_time);
112 ndr_print_string(ndr, "name", r->name);
113 ndr->depth--;
116 static enum ndr_err_code ndr_push_xattr_DosInfo(struct ndr_push *ndr, int ndr_flags, const union xattr_DosInfo *r)
118 if (ndr_flags & NDR_SCALARS) {
119 int level = ndr_push_get_switch_value(ndr, r);
120 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level));
121 switch (level) {
122 case 1: {
123 NDR_CHECK(ndr_push_xattr_DosInfo1(ndr, NDR_SCALARS, &r->info1));
124 break; }
126 case 2: {
127 NDR_CHECK(ndr_push_xattr_DosInfo2Old(ndr, NDR_SCALARS, &r->oldinfo2));
128 break; }
130 default:
131 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
134 if (ndr_flags & NDR_BUFFERS) {
135 int level = ndr_push_get_switch_value(ndr, r);
136 switch (level) {
137 case 1:
138 break;
140 case 2:
141 break;
143 default:
144 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
147 return NDR_ERR_SUCCESS;
150 static enum ndr_err_code ndr_pull_xattr_DosInfo(struct ndr_pull *ndr, int ndr_flags, union xattr_DosInfo *r)
152 int level;
153 uint16_t _level;
154 level = ndr_pull_get_switch_value(ndr, r);
155 if (ndr_flags & NDR_SCALARS) {
156 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
157 if (_level != level) {
158 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
160 switch (level) {
161 case 1: {
162 NDR_CHECK(ndr_pull_xattr_DosInfo1(ndr, NDR_SCALARS, &r->info1));
163 break; }
165 case 2: {
166 NDR_CHECK(ndr_pull_xattr_DosInfo2Old(ndr, NDR_SCALARS, &r->oldinfo2));
167 break; }
169 default:
170 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
173 if (ndr_flags & NDR_BUFFERS) {
174 switch (level) {
175 case 1:
176 break;
178 case 2:
179 break;
181 default:
182 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
185 return NDR_ERR_SUCCESS;
188 _PUBLIC_ void ndr_print_xattr_DosInfo(struct ndr_print *ndr, const char *name, const union xattr_DosInfo *r)
190 int level;
191 level = ndr_print_get_switch_value(ndr, r);
192 ndr_print_union(ndr, name, level, "xattr_DosInfo");
193 switch (level) {
194 case 1:
195 ndr_print_xattr_DosInfo1(ndr, "info1", &r->info1);
196 break;
198 case 2:
199 ndr_print_xattr_DosInfo2Old(ndr, "oldinfo2", &r->oldinfo2);
200 break;
202 default:
203 ndr_print_bad_level(ndr, name, level);
207 _PUBLIC_ enum ndr_err_code ndr_push_xattr_DosAttrib(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosAttrib *r)
209 if (ndr_flags & NDR_SCALARS) {
210 NDR_CHECK(ndr_push_align(ndr, 4));
211 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->version));
212 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->info, r->version));
213 NDR_CHECK(ndr_push_xattr_DosInfo(ndr, NDR_SCALARS, &r->info));
215 if (ndr_flags & NDR_BUFFERS) {
217 return NDR_ERR_SUCCESS;
220 _PUBLIC_ enum ndr_err_code ndr_pull_xattr_DosAttrib(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosAttrib *r)
222 if (ndr_flags & NDR_SCALARS) {
223 NDR_CHECK(ndr_pull_align(ndr, 4));
224 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->version));
225 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->info, r->version));
226 NDR_CHECK(ndr_pull_xattr_DosInfo(ndr, NDR_SCALARS, &r->info));
228 if (ndr_flags & NDR_BUFFERS) {
230 return NDR_ERR_SUCCESS;
233 _PUBLIC_ void ndr_print_xattr_DosAttrib(struct ndr_print *ndr, const char *name, const struct xattr_DosAttrib *r)
235 ndr_print_struct(ndr, name, "xattr_DosAttrib");
236 ndr->depth++;
237 ndr_print_uint16(ndr, "version", r->version);
238 ndr_print_set_switch_value(ndr, &r->info, r->version);
239 ndr_print_xattr_DosInfo(ndr, "info", &r->info);
240 ndr->depth--;
243 static enum ndr_err_code ndr_push_xattr_EA(struct ndr_push *ndr, int ndr_flags, const struct xattr_EA *r)
245 if (ndr_flags & NDR_SCALARS) {
246 NDR_CHECK(ndr_push_align(ndr, 4));
248 uint32_t _flags_save_string = ndr->flags;
249 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
250 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name));
251 ndr->flags = _flags_save_string;
253 NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->value));
255 if (ndr_flags & NDR_BUFFERS) {
257 return NDR_ERR_SUCCESS;
260 static enum ndr_err_code ndr_pull_xattr_EA(struct ndr_pull *ndr, int ndr_flags, struct xattr_EA *r)
262 if (ndr_flags & NDR_SCALARS) {
263 NDR_CHECK(ndr_pull_align(ndr, 4));
265 uint32_t _flags_save_string = ndr->flags;
266 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
267 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name));
268 ndr->flags = _flags_save_string;
270 NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->value));
272 if (ndr_flags & NDR_BUFFERS) {
274 return NDR_ERR_SUCCESS;
277 _PUBLIC_ void ndr_print_xattr_EA(struct ndr_print *ndr, const char *name, const struct xattr_EA *r)
279 ndr_print_struct(ndr, name, "xattr_EA");
280 ndr->depth++;
281 ndr_print_string(ndr, "name", r->name);
282 ndr_print_DATA_BLOB(ndr, "value", r->value);
283 ndr->depth--;
286 _PUBLIC_ enum ndr_err_code ndr_push_xattr_DosEAs(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosEAs *r)
288 uint32_t cntr_eas_1;
289 if (ndr_flags & NDR_SCALARS) {
290 NDR_CHECK(ndr_push_align(ndr, 4));
291 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->num_eas));
292 NDR_CHECK(ndr_push_unique_ptr(ndr, r->eas));
294 if (ndr_flags & NDR_BUFFERS) {
295 if (r->eas) {
296 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_eas));
297 for (cntr_eas_1 = 0; cntr_eas_1 < r->num_eas; cntr_eas_1++) {
298 NDR_CHECK(ndr_push_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_1]));
302 return NDR_ERR_SUCCESS;
305 _PUBLIC_ enum ndr_err_code ndr_pull_xattr_DosEAs(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosEAs *r)
307 uint32_t _ptr_eas;
308 uint32_t cntr_eas_1;
309 TALLOC_CTX *_mem_save_eas_0;
310 TALLOC_CTX *_mem_save_eas_1;
311 if (ndr_flags & NDR_SCALARS) {
312 NDR_CHECK(ndr_pull_align(ndr, 4));
313 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->num_eas));
314 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_eas));
315 if (_ptr_eas) {
316 NDR_PULL_ALLOC(ndr, r->eas);
317 } else {
318 r->eas = NULL;
321 if (ndr_flags & NDR_BUFFERS) {
322 if (r->eas) {
323 _mem_save_eas_0 = NDR_PULL_GET_MEM_CTX(ndr);
324 NDR_PULL_SET_MEM_CTX(ndr, r->eas, 0);
325 NDR_CHECK(ndr_pull_array_size(ndr, &r->eas));
326 NDR_PULL_ALLOC_N(ndr, r->eas, ndr_get_array_size(ndr, &r->eas));
327 _mem_save_eas_1 = NDR_PULL_GET_MEM_CTX(ndr);
328 NDR_PULL_SET_MEM_CTX(ndr, r->eas, 0);
329 for (cntr_eas_1 = 0; cntr_eas_1 < r->num_eas; cntr_eas_1++) {
330 NDR_CHECK(ndr_pull_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_1]));
332 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_eas_1, 0);
333 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_eas_0, 0);
335 if (r->eas) {
336 NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->eas, r->num_eas));
339 return NDR_ERR_SUCCESS;
342 _PUBLIC_ void ndr_print_xattr_DosEAs(struct ndr_print *ndr, const char *name, const struct xattr_DosEAs *r)
344 uint32_t cntr_eas_1;
345 ndr_print_struct(ndr, name, "xattr_DosEAs");
346 ndr->depth++;
347 ndr_print_uint16(ndr, "num_eas", r->num_eas);
348 ndr_print_ptr(ndr, "eas", r->eas);
349 ndr->depth++;
350 if (r->eas) {
351 ndr->print(ndr, "%s: ARRAY(%d)", "eas", (int)r->num_eas);
352 ndr->depth++;
353 for (cntr_eas_1=0;cntr_eas_1<r->num_eas;cntr_eas_1++) {
354 char *idx_1=NULL;
355 if (asprintf(&idx_1, "[%d]", cntr_eas_1) != -1) {
356 ndr_print_xattr_EA(ndr, "eas", &r->eas[cntr_eas_1]);
357 free(idx_1);
360 ndr->depth--;
362 ndr->depth--;
363 ndr->depth--;
366 _PUBLIC_ enum ndr_err_code ndr_push_tdb_xattrs(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattrs *r)
368 uint32_t cntr_eas_0;
369 if (ndr_flags & NDR_SCALARS) {
370 NDR_CHECK(ndr_push_align(ndr, 4));
371 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_eas));
372 for (cntr_eas_0 = 0; cntr_eas_0 < r->num_eas; cntr_eas_0++) {
373 NDR_CHECK(ndr_push_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_0]));
376 if (ndr_flags & NDR_BUFFERS) {
378 return NDR_ERR_SUCCESS;
381 _PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattrs(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattrs *r)
383 uint32_t cntr_eas_0;
384 TALLOC_CTX *_mem_save_eas_0;
385 if (ndr_flags & NDR_SCALARS) {
386 NDR_CHECK(ndr_pull_align(ndr, 4));
387 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_eas));
388 NDR_PULL_ALLOC_N(ndr, r->eas, r->num_eas);
389 _mem_save_eas_0 = NDR_PULL_GET_MEM_CTX(ndr);
390 NDR_PULL_SET_MEM_CTX(ndr, r->eas, 0);
391 for (cntr_eas_0 = 0; cntr_eas_0 < r->num_eas; cntr_eas_0++) {
392 NDR_CHECK(ndr_pull_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_0]));
394 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_eas_0, 0);
396 if (ndr_flags & NDR_BUFFERS) {
398 return NDR_ERR_SUCCESS;
401 _PUBLIC_ void ndr_print_tdb_xattrs(struct ndr_print *ndr, const char *name, const struct tdb_xattrs *r)
403 uint32_t cntr_eas_0;
404 ndr_print_struct(ndr, name, "tdb_xattrs");
405 ndr->depth++;
406 ndr_print_uint32(ndr, "num_eas", r->num_eas);
407 ndr->print(ndr, "%s: ARRAY(%d)", "eas", (int)r->num_eas);
408 ndr->depth++;
409 for (cntr_eas_0=0;cntr_eas_0<r->num_eas;cntr_eas_0++) {
410 char *idx_0=NULL;
411 if (asprintf(&idx_0, "[%d]", cntr_eas_0) != -1) {
412 ndr_print_xattr_EA(ndr, "eas", &r->eas[cntr_eas_0]);
413 free(idx_0);
416 ndr->depth--;
417 ndr->depth--;
420 static enum ndr_err_code ndr_push_xattr_DosStream(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosStream *r)
422 if (ndr_flags & NDR_SCALARS) {
423 NDR_CHECK(ndr_push_align(ndr, 4));
424 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->flags));
425 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->size));
426 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->alloc_size));
428 uint32_t _flags_save_string = ndr->flags;
429 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
430 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name));
431 ndr->flags = _flags_save_string;
434 if (ndr_flags & NDR_BUFFERS) {
436 return NDR_ERR_SUCCESS;
439 static enum ndr_err_code ndr_pull_xattr_DosStream(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosStream *r)
441 if (ndr_flags & NDR_SCALARS) {
442 NDR_CHECK(ndr_pull_align(ndr, 4));
443 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->flags));
444 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->size));
445 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->alloc_size));
447 uint32_t _flags_save_string = ndr->flags;
448 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
449 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name));
450 ndr->flags = _flags_save_string;
453 if (ndr_flags & NDR_BUFFERS) {
455 return NDR_ERR_SUCCESS;
458 _PUBLIC_ void ndr_print_xattr_DosStream(struct ndr_print *ndr, const char *name, const struct xattr_DosStream *r)
460 ndr_print_struct(ndr, name, "xattr_DosStream");
461 ndr->depth++;
462 ndr_print_uint32(ndr, "flags", r->flags);
463 ndr_print_udlong(ndr, "size", r->size);
464 ndr_print_udlong(ndr, "alloc_size", r->alloc_size);
465 ndr_print_string(ndr, "name", r->name);
466 ndr->depth--;
469 _PUBLIC_ enum ndr_err_code ndr_push_xattr_DosStreams(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosStreams *r)
471 uint32_t cntr_streams_1;
472 if (ndr_flags & NDR_SCALARS) {
473 NDR_CHECK(ndr_push_align(ndr, 4));
474 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_streams));
475 NDR_CHECK(ndr_push_unique_ptr(ndr, r->streams));
477 if (ndr_flags & NDR_BUFFERS) {
478 if (r->streams) {
479 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_streams));
480 for (cntr_streams_1 = 0; cntr_streams_1 < r->num_streams; cntr_streams_1++) {
481 NDR_CHECK(ndr_push_xattr_DosStream(ndr, NDR_SCALARS, &r->streams[cntr_streams_1]));
485 return NDR_ERR_SUCCESS;
488 _PUBLIC_ enum ndr_err_code ndr_pull_xattr_DosStreams(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosStreams *r)
490 uint32_t _ptr_streams;
491 uint32_t cntr_streams_1;
492 TALLOC_CTX *_mem_save_streams_0;
493 TALLOC_CTX *_mem_save_streams_1;
494 if (ndr_flags & NDR_SCALARS) {
495 NDR_CHECK(ndr_pull_align(ndr, 4));
496 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_streams));
497 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_streams));
498 if (_ptr_streams) {
499 NDR_PULL_ALLOC(ndr, r->streams);
500 } else {
501 r->streams = NULL;
504 if (ndr_flags & NDR_BUFFERS) {
505 if (r->streams) {
506 _mem_save_streams_0 = NDR_PULL_GET_MEM_CTX(ndr);
507 NDR_PULL_SET_MEM_CTX(ndr, r->streams, 0);
508 NDR_CHECK(ndr_pull_array_size(ndr, &r->streams));
509 NDR_PULL_ALLOC_N(ndr, r->streams, ndr_get_array_size(ndr, &r->streams));
510 _mem_save_streams_1 = NDR_PULL_GET_MEM_CTX(ndr);
511 NDR_PULL_SET_MEM_CTX(ndr, r->streams, 0);
512 for (cntr_streams_1 = 0; cntr_streams_1 < r->num_streams; cntr_streams_1++) {
513 NDR_CHECK(ndr_pull_xattr_DosStream(ndr, NDR_SCALARS, &r->streams[cntr_streams_1]));
515 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_streams_1, 0);
516 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_streams_0, 0);
518 if (r->streams) {
519 NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->streams, r->num_streams));
522 return NDR_ERR_SUCCESS;
525 _PUBLIC_ void ndr_print_xattr_DosStreams(struct ndr_print *ndr, const char *name, const struct xattr_DosStreams *r)
527 uint32_t cntr_streams_1;
528 ndr_print_struct(ndr, name, "xattr_DosStreams");
529 ndr->depth++;
530 ndr_print_uint32(ndr, "num_streams", r->num_streams);
531 ndr_print_ptr(ndr, "streams", r->streams);
532 ndr->depth++;
533 if (r->streams) {
534 ndr->print(ndr, "%s: ARRAY(%d)", "streams", (int)r->num_streams);
535 ndr->depth++;
536 for (cntr_streams_1=0;cntr_streams_1<r->num_streams;cntr_streams_1++) {
537 char *idx_1=NULL;
538 if (asprintf(&idx_1, "[%d]", cntr_streams_1) != -1) {
539 ndr_print_xattr_DosStream(ndr, "streams", &r->streams[cntr_streams_1]);
540 free(idx_1);
543 ndr->depth--;
545 ndr->depth--;
546 ndr->depth--;
549 _PUBLIC_ enum ndr_err_code ndr_push_security_descriptor_hash(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor_hash *r)
551 if (ndr_flags & NDR_SCALARS) {
552 NDR_CHECK(ndr_push_align(ndr, 4));
553 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd));
554 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->hash, 16));
556 if (ndr_flags & NDR_BUFFERS) {
557 if (r->sd) {
558 NDR_CHECK(ndr_push_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd));
561 return NDR_ERR_SUCCESS;
564 _PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor_hash(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor_hash *r)
566 uint32_t _ptr_sd;
567 TALLOC_CTX *_mem_save_sd_0;
568 if (ndr_flags & NDR_SCALARS) {
569 NDR_CHECK(ndr_pull_align(ndr, 4));
570 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd));
571 if (_ptr_sd) {
572 NDR_PULL_ALLOC(ndr, r->sd);
573 } else {
574 r->sd = NULL;
576 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->hash, 16));
578 if (ndr_flags & NDR_BUFFERS) {
579 if (r->sd) {
580 _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
581 NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0);
582 NDR_CHECK(ndr_pull_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd));
583 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0);
586 return NDR_ERR_SUCCESS;
589 _PUBLIC_ void ndr_print_security_descriptor_hash(struct ndr_print *ndr, const char *name, const struct security_descriptor_hash *r)
591 ndr_print_struct(ndr, name, "security_descriptor_hash");
592 ndr->depth++;
593 ndr_print_ptr(ndr, "sd", r->sd);
594 ndr->depth++;
595 if (r->sd) {
596 ndr_print_security_descriptor(ndr, "sd", r->sd);
598 ndr->depth--;
599 ndr_print_array_uint8(ndr, "hash", r->hash, 16);
600 ndr->depth--;
603 static enum ndr_err_code ndr_push_xattr_NTACL_Info(struct ndr_push *ndr, int ndr_flags, const union xattr_NTACL_Info *r)
605 if (ndr_flags & NDR_SCALARS) {
606 int level = ndr_push_get_switch_value(ndr, r);
607 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level));
608 switch (level) {
609 case 1: {
610 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd));
611 break; }
613 case 2: {
614 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd_hs));
615 break; }
617 default:
618 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
621 if (ndr_flags & NDR_BUFFERS) {
622 int level = ndr_push_get_switch_value(ndr, r);
623 switch (level) {
624 case 1:
625 if (r->sd) {
626 NDR_CHECK(ndr_push_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd));
628 break;
630 case 2:
631 if (r->sd_hs) {
632 NDR_CHECK(ndr_push_security_descriptor_hash(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd_hs));
634 break;
636 default:
637 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
640 return NDR_ERR_SUCCESS;
643 static enum ndr_err_code ndr_pull_xattr_NTACL_Info(struct ndr_pull *ndr, int ndr_flags, union xattr_NTACL_Info *r)
645 int level;
646 uint16_t _level;
647 TALLOC_CTX *_mem_save_sd_0;
648 TALLOC_CTX *_mem_save_sd_hs_0;
649 level = ndr_pull_get_switch_value(ndr, r);
650 if (ndr_flags & NDR_SCALARS) {
651 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
652 if (_level != level) {
653 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
655 switch (level) {
656 case 1: {
657 uint32_t _ptr_sd;
658 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd));
659 if (_ptr_sd) {
660 NDR_PULL_ALLOC(ndr, r->sd);
661 } else {
662 r->sd = NULL;
664 break; }
666 case 2: {
667 uint32_t _ptr_sd_hs;
668 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd_hs));
669 if (_ptr_sd_hs) {
670 NDR_PULL_ALLOC(ndr, r->sd_hs);
671 } else {
672 r->sd_hs = NULL;
674 break; }
676 default:
677 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
680 if (ndr_flags & NDR_BUFFERS) {
681 switch (level) {
682 case 1:
683 if (r->sd) {
684 _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
685 NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0);
686 NDR_CHECK(ndr_pull_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd));
687 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0);
689 break;
691 case 2:
692 if (r->sd_hs) {
693 _mem_save_sd_hs_0 = NDR_PULL_GET_MEM_CTX(ndr);
694 NDR_PULL_SET_MEM_CTX(ndr, r->sd_hs, 0);
695 NDR_CHECK(ndr_pull_security_descriptor_hash(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd_hs));
696 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_hs_0, 0);
698 break;
700 default:
701 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
704 return NDR_ERR_SUCCESS;
707 _PUBLIC_ void ndr_print_xattr_NTACL_Info(struct ndr_print *ndr, const char *name, const union xattr_NTACL_Info *r)
709 int level;
710 level = ndr_print_get_switch_value(ndr, r);
711 ndr_print_union(ndr, name, level, "xattr_NTACL_Info");
712 switch (level) {
713 case 1:
714 ndr_print_ptr(ndr, "sd", r->sd);
715 ndr->depth++;
716 if (r->sd) {
717 ndr_print_security_descriptor(ndr, "sd", r->sd);
719 ndr->depth--;
720 break;
722 case 2:
723 ndr_print_ptr(ndr, "sd_hs", r->sd_hs);
724 ndr->depth++;
725 if (r->sd_hs) {
726 ndr_print_security_descriptor_hash(ndr, "sd_hs", r->sd_hs);
728 ndr->depth--;
729 break;
731 default:
732 ndr_print_bad_level(ndr, name, level);
736 _PUBLIC_ enum ndr_err_code ndr_push_xattr_NTACL(struct ndr_push *ndr, int ndr_flags, const struct xattr_NTACL *r)
738 if (ndr_flags & NDR_SCALARS) {
739 NDR_CHECK(ndr_push_align(ndr, 4));
740 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->version));
741 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->info, r->version));
742 NDR_CHECK(ndr_push_xattr_NTACL_Info(ndr, NDR_SCALARS, &r->info));
744 if (ndr_flags & NDR_BUFFERS) {
745 NDR_CHECK(ndr_push_xattr_NTACL_Info(ndr, NDR_BUFFERS, &r->info));
747 return NDR_ERR_SUCCESS;
750 _PUBLIC_ enum ndr_err_code ndr_pull_xattr_NTACL(struct ndr_pull *ndr, int ndr_flags, struct xattr_NTACL *r)
752 if (ndr_flags & NDR_SCALARS) {
753 NDR_CHECK(ndr_pull_align(ndr, 4));
754 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->version));
755 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->info, r->version));
756 NDR_CHECK(ndr_pull_xattr_NTACL_Info(ndr, NDR_SCALARS, &r->info));
758 if (ndr_flags & NDR_BUFFERS) {
759 NDR_CHECK(ndr_pull_xattr_NTACL_Info(ndr, NDR_BUFFERS, &r->info));
761 return NDR_ERR_SUCCESS;
764 _PUBLIC_ void ndr_print_xattr_NTACL(struct ndr_print *ndr, const char *name, const struct xattr_NTACL *r)
766 ndr_print_struct(ndr, name, "xattr_NTACL");
767 ndr->depth++;
768 ndr_print_uint16(ndr, "version", r->version);
769 ndr_print_set_switch_value(ndr, &r->info, r->version);
770 ndr_print_xattr_NTACL_Info(ndr, "info", &r->info);
771 ndr->depth--;