Spelling fixes for libutil
[Samba/ekacnet.git] / librpc / gen_ndr / ndr_security.c
blob7abb5e8e1b13d1930895efa39cc3528ea47bfd77
1 /* parser auto-generated by pidl */
3 #include "includes.h"
4 #include "../librpc/gen_ndr/ndr_security.h"
6 #include "librpc/gen_ndr/ndr_misc.h"
7 _PUBLIC_ enum ndr_err_code ndr_push_security_ace_flags(struct ndr_push *ndr, int ndr_flags, uint8_t r)
9 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
10 return NDR_ERR_SUCCESS;
13 _PUBLIC_ enum ndr_err_code ndr_pull_security_ace_flags(struct ndr_pull *ndr, int ndr_flags, uint8_t *r)
15 uint8_t v;
16 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
17 *r = v;
18 return NDR_ERR_SUCCESS;
21 _PUBLIC_ void ndr_print_security_ace_flags(struct ndr_print *ndr, const char *name, uint8_t r)
23 ndr_print_uint8(ndr, name, r);
24 ndr->depth++;
25 ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_OBJECT_INHERIT", SEC_ACE_FLAG_OBJECT_INHERIT, r);
26 ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_CONTAINER_INHERIT", SEC_ACE_FLAG_CONTAINER_INHERIT, r);
27 ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_NO_PROPAGATE_INHERIT", SEC_ACE_FLAG_NO_PROPAGATE_INHERIT, r);
28 ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_INHERIT_ONLY", SEC_ACE_FLAG_INHERIT_ONLY, r);
29 ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_INHERITED_ACE", SEC_ACE_FLAG_INHERITED_ACE, r);
30 ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_VALID_INHERIT", SEC_ACE_FLAG_VALID_INHERIT, r);
31 ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_SUCCESSFUL_ACCESS", SEC_ACE_FLAG_SUCCESSFUL_ACCESS, r);
32 ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_FAILED_ACCESS", SEC_ACE_FLAG_FAILED_ACCESS, r);
33 ndr->depth--;
36 _PUBLIC_ enum ndr_err_code ndr_push_security_ace_type(struct ndr_push *ndr, int ndr_flags, enum security_ace_type r)
38 NDR_CHECK(ndr_push_enum_uint8(ndr, NDR_SCALARS, r));
39 return NDR_ERR_SUCCESS;
42 _PUBLIC_ enum ndr_err_code ndr_pull_security_ace_type(struct ndr_pull *ndr, int ndr_flags, enum security_ace_type *r)
44 uint8_t v;
45 NDR_CHECK(ndr_pull_enum_uint8(ndr, NDR_SCALARS, &v));
46 *r = v;
47 return NDR_ERR_SUCCESS;
50 _PUBLIC_ void ndr_print_security_ace_type(struct ndr_print *ndr, const char *name, enum security_ace_type r)
52 const char *val = NULL;
54 switch (r) {
55 case SEC_ACE_TYPE_ACCESS_ALLOWED: val = "SEC_ACE_TYPE_ACCESS_ALLOWED"; break;
56 case SEC_ACE_TYPE_ACCESS_DENIED: val = "SEC_ACE_TYPE_ACCESS_DENIED"; break;
57 case SEC_ACE_TYPE_SYSTEM_AUDIT: val = "SEC_ACE_TYPE_SYSTEM_AUDIT"; break;
58 case SEC_ACE_TYPE_SYSTEM_ALARM: val = "SEC_ACE_TYPE_SYSTEM_ALARM"; break;
59 case SEC_ACE_TYPE_ALLOWED_COMPOUND: val = "SEC_ACE_TYPE_ALLOWED_COMPOUND"; break;
60 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: val = "SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT"; break;
61 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: val = "SEC_ACE_TYPE_ACCESS_DENIED_OBJECT"; break;
62 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: val = "SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT"; break;
63 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: val = "SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT"; break;
65 ndr_print_enum(ndr, name, "ENUM", val, r);
68 static enum ndr_err_code ndr_push_security_ace_object_flags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
70 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
71 return NDR_ERR_SUCCESS;
74 static enum ndr_err_code ndr_pull_security_ace_object_flags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
76 uint32_t v;
77 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
78 *r = v;
79 return NDR_ERR_SUCCESS;
82 _PUBLIC_ void ndr_print_security_ace_object_flags(struct ndr_print *ndr, const char *name, uint32_t r)
84 ndr_print_uint32(ndr, name, r);
85 ndr->depth++;
86 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_ACE_OBJECT_TYPE_PRESENT", SEC_ACE_OBJECT_TYPE_PRESENT, r);
87 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT", SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT, r);
88 ndr->depth--;
91 static enum ndr_err_code ndr_push_security_ace_object_type(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_type *r)
93 if (ndr_flags & NDR_SCALARS) {
94 int level = ndr_push_get_switch_value(ndr, r);
95 NDR_CHECK(ndr_push_union_align(ndr, 4));
96 switch (level) {
97 case SEC_ACE_OBJECT_TYPE_PRESENT: {
98 NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->type));
99 break; }
101 default: {
102 break; }
106 if (ndr_flags & NDR_BUFFERS) {
107 int level = ndr_push_get_switch_value(ndr, r);
108 switch (level) {
109 case SEC_ACE_OBJECT_TYPE_PRESENT:
110 break;
112 default:
113 break;
117 return NDR_ERR_SUCCESS;
120 static enum ndr_err_code ndr_pull_security_ace_object_type(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_type *r)
122 int level;
123 level = ndr_pull_get_switch_value(ndr, r);
124 if (ndr_flags & NDR_SCALARS) {
125 NDR_CHECK(ndr_pull_union_align(ndr, 4));
126 switch (level) {
127 case SEC_ACE_OBJECT_TYPE_PRESENT: {
128 NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->type));
129 break; }
131 default: {
132 break; }
136 if (ndr_flags & NDR_BUFFERS) {
137 switch (level) {
138 case SEC_ACE_OBJECT_TYPE_PRESENT:
139 break;
141 default:
142 break;
146 return NDR_ERR_SUCCESS;
149 _PUBLIC_ void ndr_print_security_ace_object_type(struct ndr_print *ndr, const char *name, const union security_ace_object_type *r)
151 int level;
152 level = ndr_print_get_switch_value(ndr, r);
153 ndr_print_union(ndr, name, level, "security_ace_object_type");
154 switch (level) {
155 case SEC_ACE_OBJECT_TYPE_PRESENT:
156 ndr_print_GUID(ndr, "type", &r->type);
157 break;
159 default:
160 break;
165 static enum ndr_err_code ndr_push_security_ace_object_inherited_type(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_inherited_type *r)
167 if (ndr_flags & NDR_SCALARS) {
168 int level = ndr_push_get_switch_value(ndr, r);
169 NDR_CHECK(ndr_push_union_align(ndr, 4));
170 switch (level) {
171 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: {
172 NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->inherited_type));
173 break; }
175 default: {
176 break; }
180 if (ndr_flags & NDR_BUFFERS) {
181 int level = ndr_push_get_switch_value(ndr, r);
182 switch (level) {
183 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
184 break;
186 default:
187 break;
191 return NDR_ERR_SUCCESS;
194 static enum ndr_err_code ndr_pull_security_ace_object_inherited_type(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_inherited_type *r)
196 int level;
197 level = ndr_pull_get_switch_value(ndr, r);
198 if (ndr_flags & NDR_SCALARS) {
199 NDR_CHECK(ndr_pull_union_align(ndr, 4));
200 switch (level) {
201 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: {
202 NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->inherited_type));
203 break; }
205 default: {
206 break; }
210 if (ndr_flags & NDR_BUFFERS) {
211 switch (level) {
212 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
213 break;
215 default:
216 break;
220 return NDR_ERR_SUCCESS;
223 _PUBLIC_ void ndr_print_security_ace_object_inherited_type(struct ndr_print *ndr, const char *name, const union security_ace_object_inherited_type *r)
225 int level;
226 level = ndr_print_get_switch_value(ndr, r);
227 ndr_print_union(ndr, name, level, "security_ace_object_inherited_type");
228 switch (level) {
229 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
230 ndr_print_GUID(ndr, "inherited_type", &r->inherited_type);
231 break;
233 default:
234 break;
239 static enum ndr_err_code ndr_push_security_ace_object(struct ndr_push *ndr, int ndr_flags, const struct security_ace_object *r)
241 if (ndr_flags & NDR_SCALARS) {
242 NDR_CHECK(ndr_push_align(ndr, 4));
243 NDR_CHECK(ndr_push_security_ace_object_flags(ndr, NDR_SCALARS, r->flags));
244 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->type, r->flags & SEC_ACE_OBJECT_TYPE_PRESENT));
245 NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_SCALARS, &r->type));
246 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->inherited_type, r->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT));
247 NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type));
248 NDR_CHECK(ndr_push_trailer_align(ndr, 4));
250 if (ndr_flags & NDR_BUFFERS) {
251 NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_BUFFERS, &r->type));
252 NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type));
254 return NDR_ERR_SUCCESS;
257 static enum ndr_err_code ndr_pull_security_ace_object(struct ndr_pull *ndr, int ndr_flags, struct security_ace_object *r)
259 if (ndr_flags & NDR_SCALARS) {
260 NDR_CHECK(ndr_pull_align(ndr, 4));
261 NDR_CHECK(ndr_pull_security_ace_object_flags(ndr, NDR_SCALARS, &r->flags));
262 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->type, r->flags & SEC_ACE_OBJECT_TYPE_PRESENT));
263 NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_SCALARS, &r->type));
264 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->inherited_type, r->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT));
265 NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type));
266 NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
268 if (ndr_flags & NDR_BUFFERS) {
269 NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_BUFFERS, &r->type));
270 NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type));
272 return NDR_ERR_SUCCESS;
275 _PUBLIC_ void ndr_print_security_ace_object(struct ndr_print *ndr, const char *name, const struct security_ace_object *r)
277 ndr_print_struct(ndr, name, "security_ace_object");
278 ndr->depth++;
279 ndr_print_security_ace_object_flags(ndr, "flags", r->flags);
280 ndr_print_set_switch_value(ndr, &r->type, r->flags & SEC_ACE_OBJECT_TYPE_PRESENT);
281 ndr_print_security_ace_object_type(ndr, "type", &r->type);
282 ndr_print_set_switch_value(ndr, &r->inherited_type, r->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT);
283 ndr_print_security_ace_object_inherited_type(ndr, "inherited_type", &r->inherited_type);
284 ndr->depth--;
287 _PUBLIC_ enum ndr_err_code ndr_push_security_ace_object_ctr(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_ctr *r)
289 if (ndr_flags & NDR_SCALARS) {
290 int level = ndr_push_get_switch_value(ndr, r);
291 NDR_CHECK(ndr_push_union_align(ndr, 4));
292 switch (level) {
293 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: {
294 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
295 break; }
297 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: {
298 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
299 break; }
301 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: {
302 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
303 break; }
305 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: {
306 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
307 break; }
309 default: {
310 break; }
314 if (ndr_flags & NDR_BUFFERS) {
315 int level = ndr_push_get_switch_value(ndr, r);
316 switch (level) {
317 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
318 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
319 break;
321 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
322 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
323 break;
325 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
326 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
327 break;
329 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
330 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
331 break;
333 default:
334 break;
338 return NDR_ERR_SUCCESS;
341 _PUBLIC_ enum ndr_err_code ndr_pull_security_ace_object_ctr(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_ctr *r)
343 int level;
344 level = ndr_pull_get_switch_value(ndr, r);
345 if (ndr_flags & NDR_SCALARS) {
346 NDR_CHECK(ndr_pull_union_align(ndr, 4));
347 switch (level) {
348 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: {
349 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
350 break; }
352 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: {
353 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
354 break; }
356 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: {
357 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
358 break; }
360 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: {
361 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
362 break; }
364 default: {
365 break; }
369 if (ndr_flags & NDR_BUFFERS) {
370 switch (level) {
371 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
372 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
373 break;
375 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
376 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
377 break;
379 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
380 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
381 break;
383 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
384 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
385 break;
387 default:
388 break;
392 return NDR_ERR_SUCCESS;
395 _PUBLIC_ void ndr_print_security_ace_object_ctr(struct ndr_print *ndr, const char *name, const union security_ace_object_ctr *r)
397 int level;
398 level = ndr_print_get_switch_value(ndr, r);
399 ndr_print_union(ndr, name, level, "security_ace_object_ctr");
400 switch (level) {
401 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
402 ndr_print_security_ace_object(ndr, "object", &r->object);
403 break;
405 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
406 ndr_print_security_ace_object(ndr, "object", &r->object);
407 break;
409 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
410 ndr_print_security_ace_object(ndr, "object", &r->object);
411 break;
413 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
414 ndr_print_security_ace_object(ndr, "object", &r->object);
415 break;
417 default:
418 break;
423 _PUBLIC_ enum ndr_err_code ndr_push_security_ace(struct ndr_push *ndr, int ndr_flags, const struct security_ace *r)
425 if (ndr_flags & NDR_SCALARS) {
426 NDR_CHECK(ndr_push_align(ndr, 4));
427 NDR_CHECK(ndr_push_security_ace_type(ndr, NDR_SCALARS, r->type));
428 NDR_CHECK(ndr_push_security_ace_flags(ndr, NDR_SCALARS, r->flags));
429 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_ace(r, ndr->iconv_convenience, ndr->flags)));
430 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->access_mask));
431 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->object, r->type));
432 NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object));
433 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->trustee));
434 NDR_CHECK(ndr_push_trailer_align(ndr, 4));
436 if (ndr_flags & NDR_BUFFERS) {
437 NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object));
439 return NDR_ERR_SUCCESS;
442 _PUBLIC_ void ndr_print_security_ace(struct ndr_print *ndr, const char *name, const struct security_ace *r)
444 ndr_print_struct(ndr, name, "security_ace");
445 ndr->depth++;
446 ndr_print_security_ace_type(ndr, "type", r->type);
447 ndr_print_security_ace_flags(ndr, "flags", r->flags);
448 ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_ace(r, ndr->iconv_convenience, ndr->flags):r->size);
449 ndr_print_uint32(ndr, "access_mask", r->access_mask);
450 ndr_print_set_switch_value(ndr, &r->object, r->type);
451 ndr_print_security_ace_object_ctr(ndr, "object", &r->object);
452 ndr_print_dom_sid(ndr, "trustee", &r->trustee);
453 ndr->depth--;
456 static enum ndr_err_code ndr_push_security_acl_revision(struct ndr_push *ndr, int ndr_flags, enum security_acl_revision r)
458 NDR_CHECK(ndr_push_enum_uint1632(ndr, NDR_SCALARS, r));
459 return NDR_ERR_SUCCESS;
462 static enum ndr_err_code ndr_pull_security_acl_revision(struct ndr_pull *ndr, int ndr_flags, enum security_acl_revision *r)
464 uint16_t v;
465 NDR_CHECK(ndr_pull_enum_uint1632(ndr, NDR_SCALARS, &v));
466 *r = v;
467 return NDR_ERR_SUCCESS;
470 _PUBLIC_ void ndr_print_security_acl_revision(struct ndr_print *ndr, const char *name, enum security_acl_revision r)
472 const char *val = NULL;
474 switch (r) {
475 case SECURITY_ACL_REVISION_NT4: val = "SECURITY_ACL_REVISION_NT4"; break;
476 case SECURITY_ACL_REVISION_ADS: val = "SECURITY_ACL_REVISION_ADS"; break;
478 ndr_print_enum(ndr, name, "ENUM", val, r);
481 _PUBLIC_ enum ndr_err_code ndr_push_security_acl(struct ndr_push *ndr, int ndr_flags, const struct security_acl *r)
483 uint32_t cntr_aces_0;
484 if (ndr_flags & NDR_SCALARS) {
485 NDR_CHECK(ndr_push_align(ndr, 4));
486 NDR_CHECK(ndr_push_security_acl_revision(ndr, NDR_SCALARS, r->revision));
487 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_acl(r, ndr->iconv_convenience, ndr->flags)));
488 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_aces));
489 for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
490 NDR_CHECK(ndr_push_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0]));
492 NDR_CHECK(ndr_push_trailer_align(ndr, 4));
494 if (ndr_flags & NDR_BUFFERS) {
495 for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
496 NDR_CHECK(ndr_push_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0]));
499 return NDR_ERR_SUCCESS;
502 _PUBLIC_ enum ndr_err_code ndr_pull_security_acl(struct ndr_pull *ndr, int ndr_flags, struct security_acl *r)
504 uint32_t cntr_aces_0;
505 TALLOC_CTX *_mem_save_aces_0;
506 if (ndr_flags & NDR_SCALARS) {
507 NDR_CHECK(ndr_pull_align(ndr, 4));
508 NDR_CHECK(ndr_pull_security_acl_revision(ndr, NDR_SCALARS, &r->revision));
509 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
510 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_aces));
511 if (r->num_aces > 1000) {
512 return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
514 NDR_PULL_ALLOC_N(ndr, r->aces, r->num_aces);
515 _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
516 NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
517 for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
518 NDR_CHECK(ndr_pull_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0]));
520 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
521 NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
523 if (ndr_flags & NDR_BUFFERS) {
524 _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
525 NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
526 for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
527 NDR_CHECK(ndr_pull_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0]));
529 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
531 return NDR_ERR_SUCCESS;
534 _PUBLIC_ void ndr_print_security_acl(struct ndr_print *ndr, const char *name, const struct security_acl *r)
536 uint32_t cntr_aces_0;
537 ndr_print_struct(ndr, name, "security_acl");
538 ndr->depth++;
539 ndr_print_security_acl_revision(ndr, "revision", r->revision);
540 ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_acl(r, ndr->iconv_convenience, ndr->flags):r->size);
541 ndr_print_uint32(ndr, "num_aces", r->num_aces);
542 ndr->print(ndr, "%s: ARRAY(%d)", "aces", (int)r->num_aces);
543 ndr->depth++;
544 for (cntr_aces_0=0;cntr_aces_0<r->num_aces;cntr_aces_0++) {
545 char *idx_0=NULL;
546 if (asprintf(&idx_0, "[%d]", cntr_aces_0) != -1) {
547 ndr_print_security_ace(ndr, "aces", &r->aces[cntr_aces_0]);
548 free(idx_0);
551 ndr->depth--;
552 ndr->depth--;
555 _PUBLIC_ enum ndr_err_code ndr_push_security_descriptor_revision(struct ndr_push *ndr, int ndr_flags, enum security_descriptor_revision r)
557 NDR_CHECK(ndr_push_enum_uint8(ndr, NDR_SCALARS, r));
558 return NDR_ERR_SUCCESS;
561 _PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor_revision(struct ndr_pull *ndr, int ndr_flags, enum security_descriptor_revision *r)
563 uint8_t v;
564 NDR_CHECK(ndr_pull_enum_uint8(ndr, NDR_SCALARS, &v));
565 *r = v;
566 return NDR_ERR_SUCCESS;
569 _PUBLIC_ void ndr_print_security_descriptor_revision(struct ndr_print *ndr, const char *name, enum security_descriptor_revision r)
571 const char *val = NULL;
573 switch (r) {
574 case SECURITY_DESCRIPTOR_REVISION_1: val = "SECURITY_DESCRIPTOR_REVISION_1"; break;
576 ndr_print_enum(ndr, name, "ENUM", val, r);
579 _PUBLIC_ enum ndr_err_code ndr_push_security_descriptor_type(struct ndr_push *ndr, int ndr_flags, uint16_t r)
581 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
582 return NDR_ERR_SUCCESS;
585 _PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor_type(struct ndr_pull *ndr, int ndr_flags, uint16_t *r)
587 uint16_t v;
588 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
589 *r = v;
590 return NDR_ERR_SUCCESS;
593 _PUBLIC_ void ndr_print_security_descriptor_type(struct ndr_print *ndr, const char *name, uint16_t r)
595 ndr_print_uint16(ndr, name, r);
596 ndr->depth++;
597 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_OWNER_DEFAULTED", SEC_DESC_OWNER_DEFAULTED, r);
598 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_GROUP_DEFAULTED", SEC_DESC_GROUP_DEFAULTED, r);
599 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PRESENT", SEC_DESC_DACL_PRESENT, r);
600 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_DEFAULTED", SEC_DESC_DACL_DEFAULTED, r);
601 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PRESENT", SEC_DESC_SACL_PRESENT, r);
602 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_DEFAULTED", SEC_DESC_SACL_DEFAULTED, r);
603 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_TRUSTED", SEC_DESC_DACL_TRUSTED, r);
604 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SERVER_SECURITY", SEC_DESC_SERVER_SECURITY, r);
605 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERIT_REQ", SEC_DESC_DACL_AUTO_INHERIT_REQ, r);
606 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERIT_REQ", SEC_DESC_SACL_AUTO_INHERIT_REQ, r);
607 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERITED", SEC_DESC_DACL_AUTO_INHERITED, r);
608 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERITED", SEC_DESC_SACL_AUTO_INHERITED, r);
609 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PROTECTED", SEC_DESC_DACL_PROTECTED, r);
610 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PROTECTED", SEC_DESC_SACL_PROTECTED, r);
611 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_RM_CONTROL_VALID", SEC_DESC_RM_CONTROL_VALID, r);
612 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SELF_RELATIVE", SEC_DESC_SELF_RELATIVE, r);
613 ndr->depth--;
616 _PUBLIC_ enum ndr_err_code ndr_push_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r)
619 uint32_t _flags_save_STRUCT = ndr->flags;
620 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
621 if (ndr_flags & NDR_SCALARS) {
622 NDR_CHECK(ndr_push_align(ndr, 5));
623 NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision));
624 NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type));
625 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid));
626 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid));
627 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl));
628 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl));
629 NDR_CHECK(ndr_push_trailer_align(ndr, 5));
631 if (ndr_flags & NDR_BUFFERS) {
632 if (r->owner_sid) {
633 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->owner_sid));
634 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->owner_sid));
635 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->owner_sid));
637 if (r->group_sid) {
638 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->group_sid));
639 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->group_sid));
640 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->group_sid));
642 if (r->sacl) {
643 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sacl));
644 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
645 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sacl));
647 if (r->dacl) {
648 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->dacl));
649 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
650 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->dacl));
653 ndr->flags = _flags_save_STRUCT;
655 return NDR_ERR_SUCCESS;
658 _PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r)
660 uint32_t _ptr_owner_sid;
661 TALLOC_CTX *_mem_save_owner_sid_0;
662 uint32_t _ptr_group_sid;
663 TALLOC_CTX *_mem_save_group_sid_0;
664 uint32_t _ptr_sacl;
665 TALLOC_CTX *_mem_save_sacl_0;
666 uint32_t _ptr_dacl;
667 TALLOC_CTX *_mem_save_dacl_0;
669 uint32_t _flags_save_STRUCT = ndr->flags;
670 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
671 if (ndr_flags & NDR_SCALARS) {
672 NDR_CHECK(ndr_pull_align(ndr, 5));
673 NDR_CHECK(ndr_pull_security_descriptor_revision(ndr, NDR_SCALARS, &r->revision));
674 NDR_CHECK(ndr_pull_security_descriptor_type(ndr, NDR_SCALARS, &r->type));
675 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_owner_sid));
676 if (_ptr_owner_sid) {
677 NDR_PULL_ALLOC(ndr, r->owner_sid);
678 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->owner_sid, _ptr_owner_sid));
679 } else {
680 r->owner_sid = NULL;
682 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid));
683 if (_ptr_group_sid) {
684 NDR_PULL_ALLOC(ndr, r->group_sid);
685 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->group_sid, _ptr_group_sid));
686 } else {
687 r->group_sid = NULL;
689 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sacl));
690 if (_ptr_sacl) {
691 NDR_PULL_ALLOC(ndr, r->sacl);
692 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->sacl, _ptr_sacl));
693 } else {
694 r->sacl = NULL;
696 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dacl));
697 if (_ptr_dacl) {
698 NDR_PULL_ALLOC(ndr, r->dacl);
699 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->dacl, _ptr_dacl));
700 } else {
701 r->dacl = NULL;
703 NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
705 if (ndr_flags & NDR_BUFFERS) {
706 if (r->owner_sid) {
707 uint32_t _relative_save_offset;
708 _relative_save_offset = ndr->offset;
709 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->owner_sid));
710 _mem_save_owner_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
711 NDR_PULL_SET_MEM_CTX(ndr, r->owner_sid, 0);
712 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->owner_sid));
713 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_owner_sid_0, 0);
714 if (ndr->offset > ndr->relative_highest_offset) {
715 ndr->relative_highest_offset = ndr->offset;
717 ndr->offset = _relative_save_offset;
719 if (r->group_sid) {
720 uint32_t _relative_save_offset;
721 _relative_save_offset = ndr->offset;
722 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->group_sid));
723 _mem_save_group_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
724 NDR_PULL_SET_MEM_CTX(ndr, r->group_sid, 0);
725 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->group_sid));
726 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_sid_0, 0);
727 if (ndr->offset > ndr->relative_highest_offset) {
728 ndr->relative_highest_offset = ndr->offset;
730 ndr->offset = _relative_save_offset;
732 if (r->sacl) {
733 uint32_t _relative_save_offset;
734 _relative_save_offset = ndr->offset;
735 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->sacl));
736 _mem_save_sacl_0 = NDR_PULL_GET_MEM_CTX(ndr);
737 NDR_PULL_SET_MEM_CTX(ndr, r->sacl, 0);
738 NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
739 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sacl_0, 0);
740 if (ndr->offset > ndr->relative_highest_offset) {
741 ndr->relative_highest_offset = ndr->offset;
743 ndr->offset = _relative_save_offset;
745 if (r->dacl) {
746 uint32_t _relative_save_offset;
747 _relative_save_offset = ndr->offset;
748 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->dacl));
749 _mem_save_dacl_0 = NDR_PULL_GET_MEM_CTX(ndr);
750 NDR_PULL_SET_MEM_CTX(ndr, r->dacl, 0);
751 NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
752 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dacl_0, 0);
753 if (ndr->offset > ndr->relative_highest_offset) {
754 ndr->relative_highest_offset = ndr->offset;
756 ndr->offset = _relative_save_offset;
759 ndr->flags = _flags_save_STRUCT;
761 return NDR_ERR_SUCCESS;
764 _PUBLIC_ void ndr_print_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r)
766 ndr_print_struct(ndr, name, "security_descriptor");
768 uint32_t _flags_save_STRUCT = ndr->flags;
769 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
770 ndr->depth++;
771 ndr_print_security_descriptor_revision(ndr, "revision", r->revision);
772 ndr_print_security_descriptor_type(ndr, "type", r->type);
773 ndr_print_ptr(ndr, "owner_sid", r->owner_sid);
774 ndr->depth++;
775 if (r->owner_sid) {
776 ndr_print_dom_sid(ndr, "owner_sid", r->owner_sid);
778 ndr->depth--;
779 ndr_print_ptr(ndr, "group_sid", r->group_sid);
780 ndr->depth++;
781 if (r->group_sid) {
782 ndr_print_dom_sid(ndr, "group_sid", r->group_sid);
784 ndr->depth--;
785 ndr_print_ptr(ndr, "sacl", r->sacl);
786 ndr->depth++;
787 if (r->sacl) {
788 ndr_print_security_acl(ndr, "sacl", r->sacl);
790 ndr->depth--;
791 ndr_print_ptr(ndr, "dacl", r->dacl);
792 ndr->depth++;
793 if (r->dacl) {
794 ndr_print_security_acl(ndr, "dacl", r->dacl);
796 ndr->depth--;
797 ndr->depth--;
798 ndr->flags = _flags_save_STRUCT;
802 _PUBLIC_ enum ndr_err_code ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r)
804 if (ndr_flags & NDR_SCALARS) {
805 NDR_CHECK(ndr_push_align(ndr, 5));
806 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_security_descriptor(r->sd, ndr->iconv_convenience, ndr->flags)));
807 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd));
808 NDR_CHECK(ndr_push_trailer_align(ndr, 5));
810 if (ndr_flags & NDR_BUFFERS) {
811 if (r->sd) {
813 struct ndr_push *_ndr_sd;
814 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sd, 4, -1));
815 NDR_CHECK(ndr_push_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
816 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sd, 4, -1));
820 return NDR_ERR_SUCCESS;
823 _PUBLIC_ enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r)
825 uint32_t _ptr_sd;
826 TALLOC_CTX *_mem_save_sd_0;
827 if (ndr_flags & NDR_SCALARS) {
828 NDR_CHECK(ndr_pull_align(ndr, 5));
829 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sd_size));
830 if (r->sd_size > 0x40000) {
831 return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
833 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd));
834 if (_ptr_sd) {
835 NDR_PULL_ALLOC(ndr, r->sd);
836 } else {
837 r->sd = NULL;
839 NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
841 if (ndr_flags & NDR_BUFFERS) {
842 if (r->sd) {
843 _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
844 NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0);
846 struct ndr_pull *_ndr_sd;
847 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sd, 4, -1));
848 NDR_CHECK(ndr_pull_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
849 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sd, 4, -1));
851 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0);
854 return NDR_ERR_SUCCESS;
857 _PUBLIC_ void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, const struct sec_desc_buf *r)
859 ndr_print_struct(ndr, name, "sec_desc_buf");
860 ndr->depth++;
861 ndr_print_uint32(ndr, "sd_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_descriptor(r->sd, ndr->iconv_convenience, ndr->flags):r->sd_size);
862 ndr_print_ptr(ndr, "sd", r->sd);
863 ndr->depth++;
864 if (r->sd) {
865 ndr_print_security_descriptor(ndr, "sd", r->sd);
867 ndr->depth--;
868 ndr->depth--;
871 _PUBLIC_ enum ndr_err_code ndr_push_security_token(struct ndr_push *ndr, int ndr_flags, const struct security_token *r)
873 uint32_t cntr_sids_0;
874 if (ndr_flags & NDR_SCALARS) {
875 NDR_CHECK(ndr_push_align(ndr, 5));
876 NDR_CHECK(ndr_push_unique_ptr(ndr, r->user_sid));
877 NDR_CHECK(ndr_push_unique_ptr(ndr, r->group_sid));
878 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sids));
879 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->num_sids));
880 for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
881 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sids[cntr_sids_0]));
883 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->privilege_mask));
884 NDR_CHECK(ndr_push_trailer_align(ndr, 5));
886 if (ndr_flags & NDR_BUFFERS) {
887 if (r->user_sid) {
888 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->user_sid));
890 if (r->group_sid) {
891 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->group_sid));
893 for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
894 if (r->sids[cntr_sids_0]) {
895 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->sids[cntr_sids_0]));
899 return NDR_ERR_SUCCESS;
902 _PUBLIC_ enum ndr_err_code ndr_pull_security_token(struct ndr_pull *ndr, int ndr_flags, struct security_token *r)
904 uint32_t _ptr_user_sid;
905 TALLOC_CTX *_mem_save_user_sid_0;
906 uint32_t _ptr_group_sid;
907 TALLOC_CTX *_mem_save_group_sid_0;
908 uint32_t _ptr_sids;
909 uint32_t cntr_sids_0;
910 TALLOC_CTX *_mem_save_sids_0;
911 TALLOC_CTX *_mem_save_sids_1;
912 if (ndr_flags & NDR_SCALARS) {
913 NDR_CHECK(ndr_pull_align(ndr, 5));
914 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_user_sid));
915 if (_ptr_user_sid) {
916 NDR_PULL_ALLOC(ndr, r->user_sid);
917 } else {
918 r->user_sid = NULL;
920 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid));
921 if (_ptr_group_sid) {
922 NDR_PULL_ALLOC(ndr, r->group_sid);
923 } else {
924 r->group_sid = NULL;
926 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_sids));
927 NDR_CHECK(ndr_pull_array_size(ndr, &r->sids));
928 NDR_PULL_ALLOC_N(ndr, r->sids, ndr_get_array_size(ndr, &r->sids));
929 _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
930 NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
931 for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
932 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sids));
933 if (_ptr_sids) {
934 NDR_PULL_ALLOC(ndr, r->sids[cntr_sids_0]);
935 } else {
936 r->sids[cntr_sids_0] = NULL;
939 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0);
940 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->privilege_mask));
941 if (r->sids) {
942 NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->sids, r->num_sids));
944 NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
946 if (ndr_flags & NDR_BUFFERS) {
947 if (r->user_sid) {
948 _mem_save_user_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
949 NDR_PULL_SET_MEM_CTX(ndr, r->user_sid, 0);
950 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->user_sid));
951 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_sid_0, 0);
953 if (r->group_sid) {
954 _mem_save_group_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
955 NDR_PULL_SET_MEM_CTX(ndr, r->group_sid, 0);
956 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->group_sid));
957 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_sid_0, 0);
959 _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
960 NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
961 for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
962 if (r->sids[cntr_sids_0]) {
963 _mem_save_sids_1 = NDR_PULL_GET_MEM_CTX(ndr);
964 NDR_PULL_SET_MEM_CTX(ndr, r->sids[cntr_sids_0], 0);
965 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->sids[cntr_sids_0]));
966 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_1, 0);
969 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0);
971 return NDR_ERR_SUCCESS;
974 _PUBLIC_ void ndr_print_security_token(struct ndr_print *ndr, const char *name, const struct security_token *r)
976 uint32_t cntr_sids_0;
977 ndr_print_struct(ndr, name, "security_token");
978 ndr->depth++;
979 ndr_print_ptr(ndr, "user_sid", r->user_sid);
980 ndr->depth++;
981 if (r->user_sid) {
982 ndr_print_dom_sid(ndr, "user_sid", r->user_sid);
984 ndr->depth--;
985 ndr_print_ptr(ndr, "group_sid", r->group_sid);
986 ndr->depth++;
987 if (r->group_sid) {
988 ndr_print_dom_sid(ndr, "group_sid", r->group_sid);
990 ndr->depth--;
991 ndr_print_uint32(ndr, "num_sids", r->num_sids);
992 ndr->print(ndr, "%s: ARRAY(%d)", "sids", (int)r->num_sids);
993 ndr->depth++;
994 for (cntr_sids_0=0;cntr_sids_0<r->num_sids;cntr_sids_0++) {
995 char *idx_0=NULL;
996 if (asprintf(&idx_0, "[%d]", cntr_sids_0) != -1) {
997 ndr_print_ptr(ndr, "sids", r->sids[cntr_sids_0]);
998 ndr->depth++;
999 if (r->sids[cntr_sids_0]) {
1000 ndr_print_dom_sid(ndr, "sids", r->sids[cntr_sids_0]);
1002 ndr->depth--;
1003 free(idx_0);
1006 ndr->depth--;
1007 ndr_print_udlong(ndr, "privilege_mask", r->privilege_mask);
1008 ndr->depth--;
1011 _PUBLIC_ enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r)
1013 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
1014 return NDR_ERR_SUCCESS;
1017 _PUBLIC_ enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
1019 uint32_t v;
1020 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
1021 *r = v;
1022 return NDR_ERR_SUCCESS;
1025 _PUBLIC_ void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name, uint32_t r)
1027 ndr_print_uint32(ndr, name, r);
1028 ndr->depth++;
1029 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_OWNER", SECINFO_OWNER, r);
1030 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_GROUP", SECINFO_GROUP, r);
1031 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_DACL", SECINFO_DACL, r);
1032 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_SACL", SECINFO_SACL, r);
1033 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_SACL", SECINFO_UNPROTECTED_SACL, r);
1034 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_DACL", SECINFO_UNPROTECTED_DACL, r);
1035 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_SACL", SECINFO_PROTECTED_SACL, r);
1036 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_DACL", SECINFO_PROTECTED_DACL, r);
1037 ndr->depth--;
1040 _PUBLIC_ enum ndr_err_code ndr_push_kerb_EncTypes(struct ndr_push *ndr, int ndr_flags, uint32_t r)
1042 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
1043 return NDR_ERR_SUCCESS;
1046 _PUBLIC_ enum ndr_err_code ndr_pull_kerb_EncTypes(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
1048 uint32_t v;
1049 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
1050 *r = v;
1051 return NDR_ERR_SUCCESS;
1054 _PUBLIC_ void ndr_print_kerb_EncTypes(struct ndr_print *ndr, const char *name, uint32_t r)
1056 ndr_print_uint32(ndr, name, r);
1057 ndr->depth++;
1058 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_DES_CBC_CRC", KERB_ENCTYPE_DES_CBC_CRC, r);
1059 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_DES_CBC_MD5", KERB_ENCTYPE_DES_CBC_MD5, r);
1060 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_RC4_HMAC_MD5", KERB_ENCTYPE_RC4_HMAC_MD5, r);
1061 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96", KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96, r);
1062 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96", KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96, r);
1063 ndr->depth--;
1066 _PUBLIC_ enum ndr_err_code ndr_push_security_autoinherit(struct ndr_push *ndr, int ndr_flags, uint32_t r)
1068 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
1069 return NDR_ERR_SUCCESS;
1072 _PUBLIC_ enum ndr_err_code ndr_pull_security_autoinherit(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
1074 uint32_t v;
1075 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
1076 *r = v;
1077 return NDR_ERR_SUCCESS;
1080 _PUBLIC_ void ndr_print_security_autoinherit(struct ndr_print *ndr, const char *name, uint32_t r)
1082 ndr_print_uint32(ndr, name, r);
1083 ndr->depth++;
1084 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_DACL_AUTO_INHERIT", SEC_DACL_AUTO_INHERIT, r);
1085 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_SACL_AUTO_INHERIT", SEC_SACL_AUTO_INHERIT, r);
1086 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_DEFAULT_DESCRIPTOR", SEC_DEFAULT_DESCRIPTOR, r);
1087 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_OWNER_FROM_PARENT", SEC_OWNER_FROM_PARENT, r);
1088 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_GROUP_FROM_PARENT", SEC_GROUP_FROM_PARENT, r);
1089 ndr->depth--;