Fix hash function in acl_xattr to be SHA256, make
[ira/wip.git] / librpc / gen_ndr / ndr_xattr.c
1 /* parser auto-generated by pidl */
2
3 #include "includes.h"
4 #include "../librpc/gen_ndr/ndr_xattr.h"
5
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)
8 {
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));
17         }
18         if (ndr_flags & NDR_BUFFERS) {
19         }
20         return NDR_ERR_SUCCESS;
21 }
22
23 static enum ndr_err_code ndr_pull_xattr_DosInfo1(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosInfo1 *r)
24 {
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));
33         }
34         if (ndr_flags & NDR_BUFFERS) {
35         }
36         return NDR_ERR_SUCCESS;
37 }
38
39 _PUBLIC_ void ndr_print_xattr_DosInfo1(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo1 *r)
40 {
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--;
50 }
51
52 static enum ndr_err_code ndr_push_xattr_DosInfo2Old(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosInfo2Old *r)
53 {
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));
64                 {
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;
69                 }
70         }
71         if (ndr_flags & NDR_BUFFERS) {
72         }
73         return NDR_ERR_SUCCESS;
74 }
75
76 static enum ndr_err_code ndr_pull_xattr_DosInfo2Old(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosInfo2Old *r)
77 {
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));
88                 {
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;
93                 }
94         }
95         if (ndr_flags & NDR_BUFFERS) {
96         }
97         return NDR_ERR_SUCCESS;
98 }
99
100 _PUBLIC_ void ndr_print_xattr_DosInfo2Old(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo2Old *r)
101 {
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--;
114 }
115
116 static enum ndr_err_code ndr_push_xattr_DosInfo(struct ndr_push *ndr, int ndr_flags, const union xattr_DosInfo *r)
117 {
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; }
125
126                         case 2: {
127                                 NDR_CHECK(ndr_push_xattr_DosInfo2Old(ndr, NDR_SCALARS, &r->oldinfo2));
128                         break; }
129
130                         default:
131                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
132                 }
133         }
134         if (ndr_flags & NDR_BUFFERS) {
135                 int level = ndr_push_get_switch_value(ndr, r);
136                 switch (level) {
137                         case 1:
138                         break;
139
140                         case 2:
141                         break;
142
143                         default:
144                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
145                 }
146         }
147         return NDR_ERR_SUCCESS;
148 }
149
150 static enum ndr_err_code ndr_pull_xattr_DosInfo(struct ndr_pull *ndr, int ndr_flags, union xattr_DosInfo *r)
151 {
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);
159                 }
160                 switch (level) {
161                         case 1: {
162                                 NDR_CHECK(ndr_pull_xattr_DosInfo1(ndr, NDR_SCALARS, &r->info1));
163                         break; }
164
165                         case 2: {
166                                 NDR_CHECK(ndr_pull_xattr_DosInfo2Old(ndr, NDR_SCALARS, &r->oldinfo2));
167                         break; }
168
169                         default:
170                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
171                 }
172         }
173         if (ndr_flags & NDR_BUFFERS) {
174                 switch (level) {
175                         case 1:
176                         break;
177
178                         case 2:
179                         break;
180
181                         default:
182                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
183                 }
184         }
185         return NDR_ERR_SUCCESS;
186 }
187
188 _PUBLIC_ void ndr_print_xattr_DosInfo(struct ndr_print *ndr, const char *name, const union xattr_DosInfo *r)
189 {
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;
197
198                 case 2:
199                         ndr_print_xattr_DosInfo2Old(ndr, "oldinfo2", &r->oldinfo2);
200                 break;
201
202                 default:
203                         ndr_print_bad_level(ndr, name, level);
204         }
205 }
206
207 _PUBLIC_ enum ndr_err_code ndr_push_xattr_DosAttrib(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosAttrib *r)
208 {
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));
214         }
215         if (ndr_flags & NDR_BUFFERS) {
216         }
217         return NDR_ERR_SUCCESS;
218 }
219
220 _PUBLIC_ enum ndr_err_code ndr_pull_xattr_DosAttrib(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosAttrib *r)
221 {
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));
227         }
228         if (ndr_flags & NDR_BUFFERS) {
229         }
230         return NDR_ERR_SUCCESS;
231 }
232
233 _PUBLIC_ void ndr_print_xattr_DosAttrib(struct ndr_print *ndr, const char *name, const struct xattr_DosAttrib *r)
234 {
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--;
241 }
242
243 static enum ndr_err_code ndr_push_xattr_EA(struct ndr_push *ndr, int ndr_flags, const struct xattr_EA *r)
244 {
245         if (ndr_flags & NDR_SCALARS) {
246                 NDR_CHECK(ndr_push_align(ndr, 4));
247                 {
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;
252                 }
253                 NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->value));
254         }
255         if (ndr_flags & NDR_BUFFERS) {
256         }
257         return NDR_ERR_SUCCESS;
258 }
259
260 static enum ndr_err_code ndr_pull_xattr_EA(struct ndr_pull *ndr, int ndr_flags, struct xattr_EA *r)
261 {
262         if (ndr_flags & NDR_SCALARS) {
263                 NDR_CHECK(ndr_pull_align(ndr, 4));
264                 {
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;
269                 }
270                 NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->value));
271         }
272         if (ndr_flags & NDR_BUFFERS) {
273         }
274         return NDR_ERR_SUCCESS;
275 }
276
277 _PUBLIC_ void ndr_print_xattr_EA(struct ndr_print *ndr, const char *name, const struct xattr_EA *r)
278 {
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--;
284 }
285
286 _PUBLIC_ enum ndr_err_code ndr_push_xattr_DosEAs(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosEAs *r)
287 {
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));
293         }
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]));
299                         }
300                 }
301         }
302         return NDR_ERR_SUCCESS;
303 }
304
305 _PUBLIC_ enum ndr_err_code ndr_pull_xattr_DosEAs(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosEAs *r)
306 {
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;
319                 }
320         }
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]));
331                         }
332                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_eas_1, 0);
333                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_eas_0, 0);
334                 }
335                 if (r->eas) {
336                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->eas, r->num_eas));
337                 }
338         }
339         return NDR_ERR_SUCCESS;
340 }
341
342 _PUBLIC_ void ndr_print_xattr_DosEAs(struct ndr_print *ndr, const char *name, const struct xattr_DosEAs *r)
343 {
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);
358                         }
359                 }
360                 ndr->depth--;
361         }
362         ndr->depth--;
363         ndr->depth--;
364 }
365
366 _PUBLIC_ enum ndr_err_code ndr_push_tdb_xattrs(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattrs *r)
367 {
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]));
374                 }
375         }
376         if (ndr_flags & NDR_BUFFERS) {
377         }
378         return NDR_ERR_SUCCESS;
379 }
380
381 _PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattrs(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattrs *r)
382 {
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]));
393                 }
394                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_eas_0, 0);
395         }
396         if (ndr_flags & NDR_BUFFERS) {
397         }
398         return NDR_ERR_SUCCESS;
399 }
400
401 _PUBLIC_ void ndr_print_tdb_xattrs(struct ndr_print *ndr, const char *name, const struct tdb_xattrs *r)
402 {
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);
414                 }
415         }
416         ndr->depth--;
417         ndr->depth--;
418 }
419
420 static enum ndr_err_code ndr_push_xattr_DosStream(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosStream *r)
421 {
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));
427                 {
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;
432                 }
433         }
434         if (ndr_flags & NDR_BUFFERS) {
435         }
436         return NDR_ERR_SUCCESS;
437 }
438
439 static enum ndr_err_code ndr_pull_xattr_DosStream(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosStream *r)
440 {
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));
446                 {
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;
451                 }
452         }
453         if (ndr_flags & NDR_BUFFERS) {
454         }
455         return NDR_ERR_SUCCESS;
456 }
457
458 _PUBLIC_ void ndr_print_xattr_DosStream(struct ndr_print *ndr, const char *name, const struct xattr_DosStream *r)
459 {
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--;
467 }
468
469 _PUBLIC_ enum ndr_err_code ndr_push_xattr_DosStreams(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosStreams *r)
470 {
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));
476         }
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]));
482                         }
483                 }
484         }
485         return NDR_ERR_SUCCESS;
486 }
487
488 _PUBLIC_ enum ndr_err_code ndr_pull_xattr_DosStreams(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosStreams *r)
489 {
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;
502                 }
503         }
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]));
514                         }
515                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_streams_1, 0);
516                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_streams_0, 0);
517                 }
518                 if (r->streams) {
519                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->streams, r->num_streams));
520                 }
521         }
522         return NDR_ERR_SUCCESS;
523 }
524
525 _PUBLIC_ void ndr_print_xattr_DosStreams(struct ndr_print *ndr, const char *name, const struct xattr_DosStreams *r)
526 {
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);
541                         }
542                 }
543                 ndr->depth--;
544         }
545         ndr->depth--;
546         ndr->depth--;
547 }
548
549 _PUBLIC_ enum ndr_err_code ndr_push_security_descriptor_hash_v2(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor_hash_v2 *r)
550 {
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));
555         }
556         if (ndr_flags & NDR_BUFFERS) {
557                 if (r->sd) {
558                         NDR_CHECK(ndr_push_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd));
559                 }
560         }
561         return NDR_ERR_SUCCESS;
562 }
563
564 _PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor_hash_v2(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor_hash_v2 *r)
565 {
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;
575                 }
576                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->hash, 16));
577         }
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);
584                 }
585         }
586         return NDR_ERR_SUCCESS;
587 }
588
589 _PUBLIC_ void ndr_print_security_descriptor_hash_v2(struct ndr_print *ndr, const char *name, const struct security_descriptor_hash_v2 *r)
590 {
591         ndr_print_struct(ndr, name, "security_descriptor_hash_v2");
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);
597         }
598         ndr->depth--;
599         ndr_print_array_uint8(ndr, "hash", r->hash, 16);
600         ndr->depth--;
601 }
602
603 _PUBLIC_ enum ndr_err_code ndr_push_security_descriptor_hash_v3(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor_hash_v3 *r)
604 {
605         if (ndr_flags & NDR_SCALARS) {
606                 NDR_CHECK(ndr_push_align(ndr, 4));
607                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd));
608                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->hash_type));
609                 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->hash, XATTR_SD_HASH_SIZE));
610         }
611         if (ndr_flags & NDR_BUFFERS) {
612                 if (r->sd) {
613                         NDR_CHECK(ndr_push_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd));
614                 }
615         }
616         return NDR_ERR_SUCCESS;
617 }
618
619 _PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor_hash_v3(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor_hash_v3 *r)
620 {
621         uint32_t _ptr_sd;
622         TALLOC_CTX *_mem_save_sd_0;
623         if (ndr_flags & NDR_SCALARS) {
624                 NDR_CHECK(ndr_pull_align(ndr, 4));
625                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd));
626                 if (_ptr_sd) {
627                         NDR_PULL_ALLOC(ndr, r->sd);
628                 } else {
629                         r->sd = NULL;
630                 }
631                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->hash_type));
632                 NDR_PULL_ALLOC_N(ndr, r->hash, XATTR_SD_HASH_SIZE);
633                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->hash, XATTR_SD_HASH_SIZE));
634         }
635         if (ndr_flags & NDR_BUFFERS) {
636                 if (r->sd) {
637                         _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
638                         NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0);
639                         NDR_CHECK(ndr_pull_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd));
640                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0);
641                 }
642         }
643         return NDR_ERR_SUCCESS;
644 }
645
646 _PUBLIC_ void ndr_print_security_descriptor_hash_v3(struct ndr_print *ndr, const char *name, const struct security_descriptor_hash_v3 *r)
647 {
648         ndr_print_struct(ndr, name, "security_descriptor_hash_v3");
649         ndr->depth++;
650         ndr_print_ptr(ndr, "sd", r->sd);
651         ndr->depth++;
652         if (r->sd) {
653                 ndr_print_security_descriptor(ndr, "sd", r->sd);
654         }
655         ndr->depth--;
656         ndr_print_uint16(ndr, "hash_type", r->hash_type);
657         ndr_print_array_uint8(ndr, "hash", r->hash, XATTR_SD_HASH_SIZE);
658         ndr->depth--;
659 }
660
661 static enum ndr_err_code ndr_push_xattr_NTACL_Info(struct ndr_push *ndr, int ndr_flags, const union xattr_NTACL_Info *r)
662 {
663         if (ndr_flags & NDR_SCALARS) {
664                 int level = ndr_push_get_switch_value(ndr, r);
665                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level));
666                 switch (level) {
667                         case 1: {
668                                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd));
669                         break; }
670
671                         case 2: {
672                                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd_hs2));
673                         break; }
674
675                         case 3: {
676                                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd_hs3));
677                         break; }
678
679                         default:
680                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
681                 }
682         }
683         if (ndr_flags & NDR_BUFFERS) {
684                 int level = ndr_push_get_switch_value(ndr, r);
685                 switch (level) {
686                         case 1:
687                                 if (r->sd) {
688                                         NDR_CHECK(ndr_push_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd));
689                                 }
690                         break;
691
692                         case 2:
693                                 if (r->sd_hs2) {
694                                         NDR_CHECK(ndr_push_security_descriptor_hash_v2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd_hs2));
695                                 }
696                         break;
697
698                         case 3:
699                                 if (r->sd_hs3) {
700                                         NDR_CHECK(ndr_push_security_descriptor_hash_v3(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd_hs3));
701                                 }
702                         break;
703
704                         default:
705                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
706                 }
707         }
708         return NDR_ERR_SUCCESS;
709 }
710
711 static enum ndr_err_code ndr_pull_xattr_NTACL_Info(struct ndr_pull *ndr, int ndr_flags, union xattr_NTACL_Info *r)
712 {
713         int level;
714         uint16_t _level;
715         TALLOC_CTX *_mem_save_sd_0;
716         TALLOC_CTX *_mem_save_sd_hs2_0;
717         TALLOC_CTX *_mem_save_sd_hs3_0;
718         level = ndr_pull_get_switch_value(ndr, r);
719         if (ndr_flags & NDR_SCALARS) {
720                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
721                 if (_level != level) {
722                         return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
723                 }
724                 switch (level) {
725                         case 1: {
726                                 uint32_t _ptr_sd;
727                                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd));
728                                 if (_ptr_sd) {
729                                         NDR_PULL_ALLOC(ndr, r->sd);
730                                 } else {
731                                         r->sd = NULL;
732                                 }
733                         break; }
734
735                         case 2: {
736                                 uint32_t _ptr_sd_hs2;
737                                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd_hs2));
738                                 if (_ptr_sd_hs2) {
739                                         NDR_PULL_ALLOC(ndr, r->sd_hs2);
740                                 } else {
741                                         r->sd_hs2 = NULL;
742                                 }
743                         break; }
744
745                         case 3: {
746                                 uint32_t _ptr_sd_hs3;
747                                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd_hs3));
748                                 if (_ptr_sd_hs3) {
749                                         NDR_PULL_ALLOC(ndr, r->sd_hs3);
750                                 } else {
751                                         r->sd_hs3 = NULL;
752                                 }
753                         break; }
754
755                         default:
756                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
757                 }
758         }
759         if (ndr_flags & NDR_BUFFERS) {
760                 switch (level) {
761                         case 1:
762                                 if (r->sd) {
763                                         _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
764                                         NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0);
765                                         NDR_CHECK(ndr_pull_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd));
766                                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0);
767                                 }
768                         break;
769
770                         case 2:
771                                 if (r->sd_hs2) {
772                                         _mem_save_sd_hs2_0 = NDR_PULL_GET_MEM_CTX(ndr);
773                                         NDR_PULL_SET_MEM_CTX(ndr, r->sd_hs2, 0);
774                                         NDR_CHECK(ndr_pull_security_descriptor_hash_v2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd_hs2));
775                                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_hs2_0, 0);
776                                 }
777                         break;
778
779                         case 3:
780                                 if (r->sd_hs3) {
781                                         _mem_save_sd_hs3_0 = NDR_PULL_GET_MEM_CTX(ndr);
782                                         NDR_PULL_SET_MEM_CTX(ndr, r->sd_hs3, 0);
783                                         NDR_CHECK(ndr_pull_security_descriptor_hash_v3(ndr, NDR_SCALARS|NDR_BUFFERS, r->sd_hs3));
784                                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_hs3_0, 0);
785                                 }
786                         break;
787
788                         default:
789                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
790                 }
791         }
792         return NDR_ERR_SUCCESS;
793 }
794
795 _PUBLIC_ void ndr_print_xattr_NTACL_Info(struct ndr_print *ndr, const char *name, const union xattr_NTACL_Info *r)
796 {
797         int level;
798         level = ndr_print_get_switch_value(ndr, r);
799         ndr_print_union(ndr, name, level, "xattr_NTACL_Info");
800         switch (level) {
801                 case 1:
802                         ndr_print_ptr(ndr, "sd", r->sd);
803                         ndr->depth++;
804                         if (r->sd) {
805                                 ndr_print_security_descriptor(ndr, "sd", r->sd);
806                         }
807                         ndr->depth--;
808                 break;
809
810                 case 2:
811                         ndr_print_ptr(ndr, "sd_hs2", r->sd_hs2);
812                         ndr->depth++;
813                         if (r->sd_hs2) {
814                                 ndr_print_security_descriptor_hash_v2(ndr, "sd_hs2", r->sd_hs2);
815                         }
816                         ndr->depth--;
817                 break;
818
819                 case 3:
820                         ndr_print_ptr(ndr, "sd_hs3", r->sd_hs3);
821                         ndr->depth++;
822                         if (r->sd_hs3) {
823                                 ndr_print_security_descriptor_hash_v3(ndr, "sd_hs3", r->sd_hs3);
824                         }
825                         ndr->depth--;
826                 break;
827
828                 default:
829                         ndr_print_bad_level(ndr, name, level);
830         }
831 }
832
833 _PUBLIC_ enum ndr_err_code ndr_push_xattr_NTACL(struct ndr_push *ndr, int ndr_flags, const struct xattr_NTACL *r)
834 {
835         if (ndr_flags & NDR_SCALARS) {
836                 NDR_CHECK(ndr_push_align(ndr, 4));
837                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->version));
838                 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->info, r->version));
839                 NDR_CHECK(ndr_push_xattr_NTACL_Info(ndr, NDR_SCALARS, &r->info));
840         }
841         if (ndr_flags & NDR_BUFFERS) {
842                 NDR_CHECK(ndr_push_xattr_NTACL_Info(ndr, NDR_BUFFERS, &r->info));
843         }
844         return NDR_ERR_SUCCESS;
845 }
846
847 _PUBLIC_ enum ndr_err_code ndr_pull_xattr_NTACL(struct ndr_pull *ndr, int ndr_flags, struct xattr_NTACL *r)
848 {
849         if (ndr_flags & NDR_SCALARS) {
850                 NDR_CHECK(ndr_pull_align(ndr, 4));
851                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->version));
852                 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->info, r->version));
853                 NDR_CHECK(ndr_pull_xattr_NTACL_Info(ndr, NDR_SCALARS, &r->info));
854         }
855         if (ndr_flags & NDR_BUFFERS) {
856                 NDR_CHECK(ndr_pull_xattr_NTACL_Info(ndr, NDR_BUFFERS, &r->info));
857         }
858         return NDR_ERR_SUCCESS;
859 }
860
861 _PUBLIC_ void ndr_print_xattr_NTACL(struct ndr_print *ndr, const char *name, const struct xattr_NTACL *r)
862 {
863         ndr_print_struct(ndr, name, "xattr_NTACL");
864         ndr->depth++;
865         ndr_print_uint16(ndr, "version", r->version);
866         ndr_print_set_switch_value(ndr, &r->info, r->version);
867         ndr_print_xattr_NTACL_Info(ndr, "info", &r->info);
868         ndr->depth--;
869 }
870