s3-utils: Use ads_do_search_retry in net ads search
[Samba.git] / librpc / gen_ndr / ndr_security.c
blob4c80b00d245192052116c8902d88eb94d31cb6b9
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 size_aces_0 = 0;
505 uint32_t cntr_aces_0;
506 TALLOC_CTX *_mem_save_aces_0;
507 if (ndr_flags & NDR_SCALARS) {
508 NDR_CHECK(ndr_pull_align(ndr, 4));
509 NDR_CHECK(ndr_pull_security_acl_revision(ndr, NDR_SCALARS, &r->revision));
510 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
511 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_aces));
512 if (r->num_aces > 1000) {
513 return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
515 size_aces_0 = r->num_aces;
516 NDR_PULL_ALLOC_N(ndr, r->aces, size_aces_0);
517 _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
518 NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
519 for (cntr_aces_0 = 0; cntr_aces_0 < size_aces_0; cntr_aces_0++) {
520 NDR_CHECK(ndr_pull_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0]));
522 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
523 NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
525 if (ndr_flags & NDR_BUFFERS) {
526 size_aces_0 = r->num_aces;
527 _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
528 NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
529 for (cntr_aces_0 = 0; cntr_aces_0 < size_aces_0; cntr_aces_0++) {
530 NDR_CHECK(ndr_pull_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0]));
532 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
534 return NDR_ERR_SUCCESS;
537 _PUBLIC_ void ndr_print_security_acl(struct ndr_print *ndr, const char *name, const struct security_acl *r)
539 uint32_t cntr_aces_0;
540 ndr_print_struct(ndr, name, "security_acl");
541 ndr->depth++;
542 ndr_print_security_acl_revision(ndr, "revision", r->revision);
543 ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_acl(r, ndr->iconv_convenience, ndr->flags):r->size);
544 ndr_print_uint32(ndr, "num_aces", r->num_aces);
545 ndr->print(ndr, "%s: ARRAY(%d)", "aces", (int)r->num_aces);
546 ndr->depth++;
547 for (cntr_aces_0=0;cntr_aces_0<r->num_aces;cntr_aces_0++) {
548 char *idx_0=NULL;
549 if (asprintf(&idx_0, "[%d]", cntr_aces_0) != -1) {
550 ndr_print_security_ace(ndr, "aces", &r->aces[cntr_aces_0]);
551 free(idx_0);
554 ndr->depth--;
555 ndr->depth--;
558 _PUBLIC_ enum ndr_err_code ndr_push_security_descriptor_revision(struct ndr_push *ndr, int ndr_flags, enum security_descriptor_revision r)
560 NDR_CHECK(ndr_push_enum_uint8(ndr, NDR_SCALARS, r));
561 return NDR_ERR_SUCCESS;
564 _PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor_revision(struct ndr_pull *ndr, int ndr_flags, enum security_descriptor_revision *r)
566 uint8_t v;
567 NDR_CHECK(ndr_pull_enum_uint8(ndr, NDR_SCALARS, &v));
568 *r = v;
569 return NDR_ERR_SUCCESS;
572 _PUBLIC_ void ndr_print_security_descriptor_revision(struct ndr_print *ndr, const char *name, enum security_descriptor_revision r)
574 const char *val = NULL;
576 switch (r) {
577 case SECURITY_DESCRIPTOR_REVISION_1: val = "SECURITY_DESCRIPTOR_REVISION_1"; break;
579 ndr_print_enum(ndr, name, "ENUM", val, r);
582 _PUBLIC_ enum ndr_err_code ndr_push_security_descriptor_type(struct ndr_push *ndr, int ndr_flags, uint16_t r)
584 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
585 return NDR_ERR_SUCCESS;
588 _PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor_type(struct ndr_pull *ndr, int ndr_flags, uint16_t *r)
590 uint16_t v;
591 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
592 *r = v;
593 return NDR_ERR_SUCCESS;
596 _PUBLIC_ void ndr_print_security_descriptor_type(struct ndr_print *ndr, const char *name, uint16_t r)
598 ndr_print_uint16(ndr, name, r);
599 ndr->depth++;
600 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_OWNER_DEFAULTED", SEC_DESC_OWNER_DEFAULTED, r);
601 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_GROUP_DEFAULTED", SEC_DESC_GROUP_DEFAULTED, r);
602 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PRESENT", SEC_DESC_DACL_PRESENT, r);
603 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_DEFAULTED", SEC_DESC_DACL_DEFAULTED, r);
604 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PRESENT", SEC_DESC_SACL_PRESENT, r);
605 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_DEFAULTED", SEC_DESC_SACL_DEFAULTED, r);
606 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_TRUSTED", SEC_DESC_DACL_TRUSTED, r);
607 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SERVER_SECURITY", SEC_DESC_SERVER_SECURITY, r);
608 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERIT_REQ", SEC_DESC_DACL_AUTO_INHERIT_REQ, r);
609 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERIT_REQ", SEC_DESC_SACL_AUTO_INHERIT_REQ, r);
610 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERITED", SEC_DESC_DACL_AUTO_INHERITED, r);
611 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERITED", SEC_DESC_SACL_AUTO_INHERITED, r);
612 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PROTECTED", SEC_DESC_DACL_PROTECTED, r);
613 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PROTECTED", SEC_DESC_SACL_PROTECTED, r);
614 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_RM_CONTROL_VALID", SEC_DESC_RM_CONTROL_VALID, r);
615 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SELF_RELATIVE", SEC_DESC_SELF_RELATIVE, r);
616 ndr->depth--;
619 _PUBLIC_ enum ndr_err_code ndr_push_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r)
622 uint32_t _flags_save_STRUCT = ndr->flags;
623 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
624 if (ndr_flags & NDR_SCALARS) {
625 NDR_CHECK(ndr_push_align(ndr, 5));
626 NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision));
627 NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type));
628 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid));
629 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid));
630 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl));
631 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl));
632 NDR_CHECK(ndr_push_trailer_align(ndr, 5));
634 if (ndr_flags & NDR_BUFFERS) {
635 if (r->owner_sid) {
636 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->owner_sid));
637 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->owner_sid));
638 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->owner_sid));
640 if (r->group_sid) {
641 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->group_sid));
642 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->group_sid));
643 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->group_sid));
645 if (r->sacl) {
646 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sacl));
647 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
648 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sacl));
650 if (r->dacl) {
651 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->dacl));
652 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
653 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->dacl));
656 ndr->flags = _flags_save_STRUCT;
658 return NDR_ERR_SUCCESS;
661 _PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r)
663 uint32_t _ptr_owner_sid;
664 TALLOC_CTX *_mem_save_owner_sid_0;
665 uint32_t _ptr_group_sid;
666 TALLOC_CTX *_mem_save_group_sid_0;
667 uint32_t _ptr_sacl;
668 TALLOC_CTX *_mem_save_sacl_0;
669 uint32_t _ptr_dacl;
670 TALLOC_CTX *_mem_save_dacl_0;
672 uint32_t _flags_save_STRUCT = ndr->flags;
673 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
674 if (ndr_flags & NDR_SCALARS) {
675 NDR_CHECK(ndr_pull_align(ndr, 5));
676 NDR_CHECK(ndr_pull_security_descriptor_revision(ndr, NDR_SCALARS, &r->revision));
677 NDR_CHECK(ndr_pull_security_descriptor_type(ndr, NDR_SCALARS, &r->type));
678 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_owner_sid));
679 if (_ptr_owner_sid) {
680 NDR_PULL_ALLOC(ndr, r->owner_sid);
681 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->owner_sid, _ptr_owner_sid));
682 } else {
683 r->owner_sid = NULL;
685 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid));
686 if (_ptr_group_sid) {
687 NDR_PULL_ALLOC(ndr, r->group_sid);
688 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->group_sid, _ptr_group_sid));
689 } else {
690 r->group_sid = NULL;
692 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sacl));
693 if (_ptr_sacl) {
694 NDR_PULL_ALLOC(ndr, r->sacl);
695 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->sacl, _ptr_sacl));
696 } else {
697 r->sacl = NULL;
699 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dacl));
700 if (_ptr_dacl) {
701 NDR_PULL_ALLOC(ndr, r->dacl);
702 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->dacl, _ptr_dacl));
703 } else {
704 r->dacl = NULL;
706 NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
708 if (ndr_flags & NDR_BUFFERS) {
709 if (r->owner_sid) {
710 uint32_t _relative_save_offset;
711 _relative_save_offset = ndr->offset;
712 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->owner_sid));
713 _mem_save_owner_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
714 NDR_PULL_SET_MEM_CTX(ndr, r->owner_sid, 0);
715 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->owner_sid));
716 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_owner_sid_0, 0);
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 ndr->offset = _relative_save_offset;
729 if (r->sacl) {
730 uint32_t _relative_save_offset;
731 _relative_save_offset = ndr->offset;
732 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->sacl));
733 _mem_save_sacl_0 = NDR_PULL_GET_MEM_CTX(ndr);
734 NDR_PULL_SET_MEM_CTX(ndr, r->sacl, 0);
735 NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
736 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sacl_0, 0);
737 ndr->offset = _relative_save_offset;
739 if (r->dacl) {
740 uint32_t _relative_save_offset;
741 _relative_save_offset = ndr->offset;
742 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->dacl));
743 _mem_save_dacl_0 = NDR_PULL_GET_MEM_CTX(ndr);
744 NDR_PULL_SET_MEM_CTX(ndr, r->dacl, 0);
745 NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
746 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dacl_0, 0);
747 ndr->offset = _relative_save_offset;
750 ndr->flags = _flags_save_STRUCT;
752 return NDR_ERR_SUCCESS;
755 _PUBLIC_ void ndr_print_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r)
757 ndr_print_struct(ndr, name, "security_descriptor");
759 uint32_t _flags_save_STRUCT = ndr->flags;
760 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
761 ndr->depth++;
762 ndr_print_security_descriptor_revision(ndr, "revision", r->revision);
763 ndr_print_security_descriptor_type(ndr, "type", r->type);
764 ndr_print_ptr(ndr, "owner_sid", r->owner_sid);
765 ndr->depth++;
766 if (r->owner_sid) {
767 ndr_print_dom_sid(ndr, "owner_sid", r->owner_sid);
769 ndr->depth--;
770 ndr_print_ptr(ndr, "group_sid", r->group_sid);
771 ndr->depth++;
772 if (r->group_sid) {
773 ndr_print_dom_sid(ndr, "group_sid", r->group_sid);
775 ndr->depth--;
776 ndr_print_ptr(ndr, "sacl", r->sacl);
777 ndr->depth++;
778 if (r->sacl) {
779 ndr_print_security_acl(ndr, "sacl", r->sacl);
781 ndr->depth--;
782 ndr_print_ptr(ndr, "dacl", r->dacl);
783 ndr->depth++;
784 if (r->dacl) {
785 ndr_print_security_acl(ndr, "dacl", r->dacl);
787 ndr->depth--;
788 ndr->depth--;
789 ndr->flags = _flags_save_STRUCT;
793 _PUBLIC_ enum ndr_err_code ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r)
795 if (ndr_flags & NDR_SCALARS) {
796 NDR_CHECK(ndr_push_align(ndr, 5));
797 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_security_descriptor(r->sd, ndr->iconv_convenience, ndr->flags)));
798 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd));
799 NDR_CHECK(ndr_push_trailer_align(ndr, 5));
801 if (ndr_flags & NDR_BUFFERS) {
802 if (r->sd) {
804 struct ndr_push *_ndr_sd;
805 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sd, 4, -1));
806 NDR_CHECK(ndr_push_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
807 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sd, 4, -1));
811 return NDR_ERR_SUCCESS;
814 _PUBLIC_ enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r)
816 uint32_t _ptr_sd;
817 TALLOC_CTX *_mem_save_sd_0;
818 if (ndr_flags & NDR_SCALARS) {
819 NDR_CHECK(ndr_pull_align(ndr, 5));
820 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sd_size));
821 if (r->sd_size > 0x40000) {
822 return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
824 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd));
825 if (_ptr_sd) {
826 NDR_PULL_ALLOC(ndr, r->sd);
827 } else {
828 r->sd = NULL;
830 NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
832 if (ndr_flags & NDR_BUFFERS) {
833 if (r->sd) {
834 _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
835 NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0);
837 struct ndr_pull *_ndr_sd;
838 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sd, 4, -1));
839 NDR_CHECK(ndr_pull_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
840 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sd, 4, -1));
842 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0);
845 return NDR_ERR_SUCCESS;
848 _PUBLIC_ void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, const struct sec_desc_buf *r)
850 ndr_print_struct(ndr, name, "sec_desc_buf");
851 ndr->depth++;
852 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);
853 ndr_print_ptr(ndr, "sd", r->sd);
854 ndr->depth++;
855 if (r->sd) {
856 ndr_print_security_descriptor(ndr, "sd", r->sd);
858 ndr->depth--;
859 ndr->depth--;
862 _PUBLIC_ enum ndr_err_code ndr_push_security_token(struct ndr_push *ndr, int ndr_flags, const struct security_token *r)
864 uint32_t cntr_sids_0;
865 if (ndr_flags & NDR_SCALARS) {
866 NDR_CHECK(ndr_push_align(ndr, 5));
867 NDR_CHECK(ndr_push_unique_ptr(ndr, r->user_sid));
868 NDR_CHECK(ndr_push_unique_ptr(ndr, r->group_sid));
869 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sids));
870 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->num_sids));
871 for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
872 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sids[cntr_sids_0]));
874 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->privilege_mask));
875 NDR_CHECK(ndr_push_unique_ptr(ndr, r->default_dacl));
876 NDR_CHECK(ndr_push_trailer_align(ndr, 5));
878 if (ndr_flags & NDR_BUFFERS) {
879 if (r->user_sid) {
880 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->user_sid));
882 if (r->group_sid) {
883 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->group_sid));
885 for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
886 if (r->sids[cntr_sids_0]) {
887 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->sids[cntr_sids_0]));
890 if (r->default_dacl) {
891 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->default_dacl));
894 return NDR_ERR_SUCCESS;
897 _PUBLIC_ enum ndr_err_code ndr_pull_security_token(struct ndr_pull *ndr, int ndr_flags, struct security_token *r)
899 uint32_t _ptr_user_sid;
900 TALLOC_CTX *_mem_save_user_sid_0;
901 uint32_t _ptr_group_sid;
902 TALLOC_CTX *_mem_save_group_sid_0;
903 uint32_t _ptr_sids;
904 uint32_t size_sids_0 = 0;
905 uint32_t cntr_sids_0;
906 TALLOC_CTX *_mem_save_sids_0;
907 TALLOC_CTX *_mem_save_sids_1;
908 uint32_t _ptr_default_dacl;
909 TALLOC_CTX *_mem_save_default_dacl_0;
910 if (ndr_flags & NDR_SCALARS) {
911 NDR_CHECK(ndr_pull_align(ndr, 5));
912 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_user_sid));
913 if (_ptr_user_sid) {
914 NDR_PULL_ALLOC(ndr, r->user_sid);
915 } else {
916 r->user_sid = NULL;
918 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid));
919 if (_ptr_group_sid) {
920 NDR_PULL_ALLOC(ndr, r->group_sid);
921 } else {
922 r->group_sid = NULL;
924 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_sids));
925 NDR_CHECK(ndr_pull_array_size(ndr, &r->sids));
926 size_sids_0 = ndr_get_array_size(ndr, &r->sids);
927 NDR_PULL_ALLOC_N(ndr, r->sids, size_sids_0);
928 _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
929 NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
930 for (cntr_sids_0 = 0; cntr_sids_0 < size_sids_0; cntr_sids_0++) {
931 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sids));
932 if (_ptr_sids) {
933 NDR_PULL_ALLOC(ndr, r->sids[cntr_sids_0]);
934 } else {
935 r->sids[cntr_sids_0] = NULL;
938 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0);
939 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->privilege_mask));
940 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_default_dacl));
941 if (_ptr_default_dacl) {
942 NDR_PULL_ALLOC(ndr, r->default_dacl);
943 } else {
944 r->default_dacl = NULL;
946 if (r->sids) {
947 NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->sids, r->num_sids));
949 NDR_CHECK(ndr_pull_trailer_align(ndr, 5));
951 if (ndr_flags & NDR_BUFFERS) {
952 if (r->user_sid) {
953 _mem_save_user_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
954 NDR_PULL_SET_MEM_CTX(ndr, r->user_sid, 0);
955 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->user_sid));
956 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_sid_0, 0);
958 if (r->group_sid) {
959 _mem_save_group_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
960 NDR_PULL_SET_MEM_CTX(ndr, r->group_sid, 0);
961 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->group_sid));
962 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_sid_0, 0);
964 size_sids_0 = ndr_get_array_size(ndr, &r->sids);
965 _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
966 NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
967 for (cntr_sids_0 = 0; cntr_sids_0 < size_sids_0; cntr_sids_0++) {
968 if (r->sids[cntr_sids_0]) {
969 _mem_save_sids_1 = NDR_PULL_GET_MEM_CTX(ndr);
970 NDR_PULL_SET_MEM_CTX(ndr, r->sids[cntr_sids_0], 0);
971 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->sids[cntr_sids_0]));
972 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_1, 0);
975 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0);
976 if (r->default_dacl) {
977 _mem_save_default_dacl_0 = NDR_PULL_GET_MEM_CTX(ndr);
978 NDR_PULL_SET_MEM_CTX(ndr, r->default_dacl, 0);
979 NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->default_dacl));
980 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_default_dacl_0, 0);
983 return NDR_ERR_SUCCESS;
986 _PUBLIC_ void ndr_print_security_token(struct ndr_print *ndr, const char *name, const struct security_token *r)
988 uint32_t cntr_sids_0;
989 ndr_print_struct(ndr, name, "security_token");
990 ndr->depth++;
991 ndr_print_ptr(ndr, "user_sid", r->user_sid);
992 ndr->depth++;
993 if (r->user_sid) {
994 ndr_print_dom_sid(ndr, "user_sid", r->user_sid);
996 ndr->depth--;
997 ndr_print_ptr(ndr, "group_sid", r->group_sid);
998 ndr->depth++;
999 if (r->group_sid) {
1000 ndr_print_dom_sid(ndr, "group_sid", r->group_sid);
1002 ndr->depth--;
1003 ndr_print_uint32(ndr, "num_sids", r->num_sids);
1004 ndr->print(ndr, "%s: ARRAY(%d)", "sids", (int)r->num_sids);
1005 ndr->depth++;
1006 for (cntr_sids_0=0;cntr_sids_0<r->num_sids;cntr_sids_0++) {
1007 char *idx_0=NULL;
1008 if (asprintf(&idx_0, "[%d]", cntr_sids_0) != -1) {
1009 ndr_print_ptr(ndr, "sids", r->sids[cntr_sids_0]);
1010 ndr->depth++;
1011 if (r->sids[cntr_sids_0]) {
1012 ndr_print_dom_sid(ndr, "sids", r->sids[cntr_sids_0]);
1014 ndr->depth--;
1015 free(idx_0);
1018 ndr->depth--;
1019 ndr_print_udlong(ndr, "privilege_mask", r->privilege_mask);
1020 ndr_print_ptr(ndr, "default_dacl", r->default_dacl);
1021 ndr->depth++;
1022 if (r->default_dacl) {
1023 ndr_print_security_acl(ndr, "default_dacl", r->default_dacl);
1025 ndr->depth--;
1026 ndr->depth--;
1029 _PUBLIC_ enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r)
1031 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
1032 return NDR_ERR_SUCCESS;
1035 _PUBLIC_ enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
1037 uint32_t v;
1038 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
1039 *r = v;
1040 return NDR_ERR_SUCCESS;
1043 _PUBLIC_ void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name, uint32_t r)
1045 ndr_print_uint32(ndr, name, r);
1046 ndr->depth++;
1047 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_OWNER", SECINFO_OWNER, r);
1048 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_GROUP", SECINFO_GROUP, r);
1049 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_DACL", SECINFO_DACL, r);
1050 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_SACL", SECINFO_SACL, r);
1051 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_LABEL", SECINFO_LABEL, r);
1052 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_SACL", SECINFO_UNPROTECTED_SACL, r);
1053 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_DACL", SECINFO_UNPROTECTED_DACL, r);
1054 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_SACL", SECINFO_PROTECTED_SACL, r);
1055 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_DACL", SECINFO_PROTECTED_DACL, r);
1056 ndr->depth--;
1059 _PUBLIC_ enum ndr_err_code ndr_push_kerb_EncTypes(struct ndr_push *ndr, int ndr_flags, uint32_t r)
1061 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
1062 return NDR_ERR_SUCCESS;
1065 _PUBLIC_ enum ndr_err_code ndr_pull_kerb_EncTypes(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
1067 uint32_t v;
1068 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
1069 *r = v;
1070 return NDR_ERR_SUCCESS;
1073 _PUBLIC_ void ndr_print_kerb_EncTypes(struct ndr_print *ndr, const char *name, uint32_t r)
1075 ndr_print_uint32(ndr, name, r);
1076 ndr->depth++;
1077 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_DES_CBC_CRC", KERB_ENCTYPE_DES_CBC_CRC, r);
1078 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_DES_CBC_MD5", KERB_ENCTYPE_DES_CBC_MD5, r);
1079 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_RC4_HMAC_MD5", KERB_ENCTYPE_RC4_HMAC_MD5, r);
1080 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96", KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96, r);
1081 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96", KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96, r);
1082 ndr->depth--;
1085 _PUBLIC_ enum ndr_err_code ndr_push_security_autoinherit(struct ndr_push *ndr, int ndr_flags, uint32_t r)
1087 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
1088 return NDR_ERR_SUCCESS;
1091 _PUBLIC_ enum ndr_err_code ndr_pull_security_autoinherit(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
1093 uint32_t v;
1094 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
1095 *r = v;
1096 return NDR_ERR_SUCCESS;
1099 _PUBLIC_ void ndr_print_security_autoinherit(struct ndr_print *ndr, const char *name, uint32_t r)
1101 ndr_print_uint32(ndr, name, r);
1102 ndr->depth++;
1103 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_DACL_AUTO_INHERIT", SEC_DACL_AUTO_INHERIT, r);
1104 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_SACL_AUTO_INHERIT", SEC_SACL_AUTO_INHERIT, r);
1105 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_DEFAULT_DESCRIPTOR", SEC_DEFAULT_DESCRIPTOR, r);
1106 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_OWNER_FROM_PARENT", SEC_OWNER_FROM_PARENT, r);
1107 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_GROUP_FROM_PARENT", SEC_GROUP_FROM_PARENT, r);
1108 ndr->depth--;