libreplace: also use AC_LIBREPLACE_NETWORK_CHECKS for the standalone build
[Samba.git] / source / librpc / gen_ndr / ndr_security.c
blobcbeabf48e55d687760a7cad873e84f35444bad86
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 static 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 static 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 static 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_uint8(ndr, NDR_SCALARS, r));
39 return NDR_ERR_SUCCESS;
42 static 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_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 switch (level) {
96 case SEC_ACE_OBJECT_TYPE_PRESENT: {
97 NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->type));
98 break; }
100 default: {
101 break; }
105 if (ndr_flags & NDR_BUFFERS) {
106 int level = ndr_push_get_switch_value(ndr, r);
107 switch (level) {
108 case SEC_ACE_OBJECT_TYPE_PRESENT:
109 break;
111 default:
112 break;
116 return NDR_ERR_SUCCESS;
119 static enum ndr_err_code ndr_pull_security_ace_object_type(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_type *r)
121 int level;
122 level = ndr_pull_get_switch_value(ndr, r);
123 if (ndr_flags & NDR_SCALARS) {
124 switch (level) {
125 case SEC_ACE_OBJECT_TYPE_PRESENT: {
126 NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->type));
127 break; }
129 default: {
130 break; }
134 if (ndr_flags & NDR_BUFFERS) {
135 switch (level) {
136 case SEC_ACE_OBJECT_TYPE_PRESENT:
137 break;
139 default:
140 break;
144 return NDR_ERR_SUCCESS;
147 _PUBLIC_ void ndr_print_security_ace_object_type(struct ndr_print *ndr, const char *name, const union security_ace_object_type *r)
149 int level;
150 level = ndr_print_get_switch_value(ndr, r);
151 ndr_print_union(ndr, name, level, "security_ace_object_type");
152 switch (level) {
153 case SEC_ACE_OBJECT_TYPE_PRESENT:
154 ndr_print_GUID(ndr, "type", &r->type);
155 break;
157 default:
158 break;
163 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)
165 if (ndr_flags & NDR_SCALARS) {
166 int level = ndr_push_get_switch_value(ndr, r);
167 switch (level) {
168 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: {
169 NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->inherited_type));
170 break; }
172 default: {
173 break; }
177 if (ndr_flags & NDR_BUFFERS) {
178 int level = ndr_push_get_switch_value(ndr, r);
179 switch (level) {
180 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
181 break;
183 default:
184 break;
188 return NDR_ERR_SUCCESS;
191 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)
193 int level;
194 level = ndr_pull_get_switch_value(ndr, r);
195 if (ndr_flags & NDR_SCALARS) {
196 switch (level) {
197 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: {
198 NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->inherited_type));
199 break; }
201 default: {
202 break; }
206 if (ndr_flags & NDR_BUFFERS) {
207 switch (level) {
208 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
209 break;
211 default:
212 break;
216 return NDR_ERR_SUCCESS;
219 _PUBLIC_ void ndr_print_security_ace_object_inherited_type(struct ndr_print *ndr, const char *name, const union security_ace_object_inherited_type *r)
221 int level;
222 level = ndr_print_get_switch_value(ndr, r);
223 ndr_print_union(ndr, name, level, "security_ace_object_inherited_type");
224 switch (level) {
225 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
226 ndr_print_GUID(ndr, "inherited_type", &r->inherited_type);
227 break;
229 default:
230 break;
235 static enum ndr_err_code ndr_push_security_ace_object(struct ndr_push *ndr, int ndr_flags, const struct security_ace_object *r)
237 if (ndr_flags & NDR_SCALARS) {
238 NDR_CHECK(ndr_push_align(ndr, 4));
239 NDR_CHECK(ndr_push_security_ace_object_flags(ndr, NDR_SCALARS, r->flags));
240 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->type, r->flags & SEC_ACE_OBJECT_TYPE_PRESENT));
241 NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_SCALARS, &r->type));
242 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->inherited_type, r->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT));
243 NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type));
245 if (ndr_flags & NDR_BUFFERS) {
246 NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_BUFFERS, &r->type));
247 NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type));
249 return NDR_ERR_SUCCESS;
252 static enum ndr_err_code ndr_pull_security_ace_object(struct ndr_pull *ndr, int ndr_flags, struct security_ace_object *r)
254 if (ndr_flags & NDR_SCALARS) {
255 NDR_CHECK(ndr_pull_align(ndr, 4));
256 NDR_CHECK(ndr_pull_security_ace_object_flags(ndr, NDR_SCALARS, &r->flags));
257 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->type, r->flags & SEC_ACE_OBJECT_TYPE_PRESENT));
258 NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_SCALARS, &r->type));
259 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->inherited_type, r->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT));
260 NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type));
262 if (ndr_flags & NDR_BUFFERS) {
263 NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_BUFFERS, &r->type));
264 NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type));
266 return NDR_ERR_SUCCESS;
269 _PUBLIC_ void ndr_print_security_ace_object(struct ndr_print *ndr, const char *name, const struct security_ace_object *r)
271 ndr_print_struct(ndr, name, "security_ace_object");
272 ndr->depth++;
273 ndr_print_security_ace_object_flags(ndr, "flags", r->flags);
274 ndr_print_set_switch_value(ndr, &r->type, r->flags & SEC_ACE_OBJECT_TYPE_PRESENT);
275 ndr_print_security_ace_object_type(ndr, "type", &r->type);
276 ndr_print_set_switch_value(ndr, &r->inherited_type, r->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT);
277 ndr_print_security_ace_object_inherited_type(ndr, "inherited_type", &r->inherited_type);
278 ndr->depth--;
281 static enum ndr_err_code ndr_push_security_ace_object_ctr(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_ctr *r)
283 if (ndr_flags & NDR_SCALARS) {
284 int level = ndr_push_get_switch_value(ndr, r);
285 switch (level) {
286 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: {
287 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
288 break; }
290 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: {
291 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
292 break; }
294 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: {
295 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
296 break; }
298 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: {
299 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
300 break; }
302 default: {
303 break; }
307 if (ndr_flags & NDR_BUFFERS) {
308 int level = ndr_push_get_switch_value(ndr, r);
309 switch (level) {
310 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
311 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
312 break;
314 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
315 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
316 break;
318 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
319 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
320 break;
322 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
323 NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
324 break;
326 default:
327 break;
331 return NDR_ERR_SUCCESS;
334 static enum ndr_err_code ndr_pull_security_ace_object_ctr(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_ctr *r)
336 int level;
337 level = ndr_pull_get_switch_value(ndr, r);
338 if (ndr_flags & NDR_SCALARS) {
339 switch (level) {
340 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: {
341 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
342 break; }
344 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: {
345 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
346 break; }
348 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: {
349 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
350 break; }
352 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: {
353 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
354 break; }
356 default: {
357 break; }
361 if (ndr_flags & NDR_BUFFERS) {
362 switch (level) {
363 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
364 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
365 break;
367 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
368 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
369 break;
371 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
372 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
373 break;
375 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
376 NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
377 break;
379 default:
380 break;
384 return NDR_ERR_SUCCESS;
387 _PUBLIC_ void ndr_print_security_ace_object_ctr(struct ndr_print *ndr, const char *name, const union security_ace_object_ctr *r)
389 int level;
390 level = ndr_print_get_switch_value(ndr, r);
391 ndr_print_union(ndr, name, level, "security_ace_object_ctr");
392 switch (level) {
393 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
394 ndr_print_security_ace_object(ndr, "object", &r->object);
395 break;
397 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
398 ndr_print_security_ace_object(ndr, "object", &r->object);
399 break;
401 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
402 ndr_print_security_ace_object(ndr, "object", &r->object);
403 break;
405 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
406 ndr_print_security_ace_object(ndr, "object", &r->object);
407 break;
409 default:
410 break;
415 _PUBLIC_ enum ndr_err_code ndr_push_security_ace(struct ndr_push *ndr, int ndr_flags, const struct security_ace *r)
417 if (ndr_flags & NDR_SCALARS) {
418 NDR_CHECK(ndr_push_align(ndr, 4));
419 NDR_CHECK(ndr_push_security_ace_type(ndr, NDR_SCALARS, r->type));
420 NDR_CHECK(ndr_push_security_ace_flags(ndr, NDR_SCALARS, r->flags));
421 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_ace(r, ndr->flags)));
422 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->access_mask));
423 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->object, r->type));
424 NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object));
425 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->trustee));
427 if (ndr_flags & NDR_BUFFERS) {
428 NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object));
429 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_BUFFERS, &r->trustee));
431 return NDR_ERR_SUCCESS;
434 _PUBLIC_ enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, struct security_ace *r)
436 if (ndr_flags & NDR_SCALARS) {
437 NDR_CHECK(ndr_pull_align(ndr, 4));
438 NDR_CHECK(ndr_pull_security_ace_type(ndr, NDR_SCALARS, &r->type));
439 NDR_CHECK(ndr_pull_security_ace_flags(ndr, NDR_SCALARS, &r->flags));
440 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
441 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->access_mask));
442 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->object, r->type));
443 NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object));
444 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->trustee));
446 if (ndr_flags & NDR_BUFFERS) {
447 NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object));
448 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_BUFFERS, &r->trustee));
450 return NDR_ERR_SUCCESS;
453 _PUBLIC_ void ndr_print_security_ace(struct ndr_print *ndr, const char *name, const struct security_ace *r)
455 ndr_print_struct(ndr, name, "security_ace");
456 ndr->depth++;
457 ndr_print_security_ace_type(ndr, "type", r->type);
458 ndr_print_security_ace_flags(ndr, "flags", r->flags);
459 ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_ace(r, ndr->flags):r->size);
460 ndr_print_uint32(ndr, "access_mask", r->access_mask);
461 ndr_print_set_switch_value(ndr, &r->object, r->type);
462 ndr_print_security_ace_object_ctr(ndr, "object", &r->object);
463 ndr_print_dom_sid(ndr, "trustee", &r->trustee);
464 ndr->depth--;
467 static enum ndr_err_code ndr_push_security_acl_revision(struct ndr_push *ndr, int ndr_flags, enum security_acl_revision r)
469 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
470 return NDR_ERR_SUCCESS;
473 static enum ndr_err_code ndr_pull_security_acl_revision(struct ndr_pull *ndr, int ndr_flags, enum security_acl_revision *r)
475 uint16_t v;
476 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
477 *r = v;
478 return NDR_ERR_SUCCESS;
481 _PUBLIC_ void ndr_print_security_acl_revision(struct ndr_print *ndr, const char *name, enum security_acl_revision r)
483 const char *val = NULL;
485 switch (r) {
486 case SECURITY_ACL_REVISION_NT4: val = "SECURITY_ACL_REVISION_NT4"; break;
487 case SECURITY_ACL_REVISION_ADS: val = "SECURITY_ACL_REVISION_ADS"; break;
489 ndr_print_enum(ndr, name, "ENUM", val, r);
492 _PUBLIC_ enum ndr_err_code ndr_push_security_acl(struct ndr_push *ndr, int ndr_flags, const struct security_acl *r)
494 uint32_t cntr_aces_0;
495 if (ndr_flags & NDR_SCALARS) {
496 NDR_CHECK(ndr_push_align(ndr, 4));
497 NDR_CHECK(ndr_push_security_acl_revision(ndr, NDR_SCALARS, r->revision));
498 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_acl(r, ndr->flags)));
499 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_aces));
500 for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
501 NDR_CHECK(ndr_push_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0]));
504 if (ndr_flags & NDR_BUFFERS) {
505 for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
506 NDR_CHECK(ndr_push_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0]));
509 return NDR_ERR_SUCCESS;
512 _PUBLIC_ enum ndr_err_code ndr_pull_security_acl(struct ndr_pull *ndr, int ndr_flags, struct security_acl *r)
514 uint32_t cntr_aces_0;
515 TALLOC_CTX *_mem_save_aces_0;
516 if (ndr_flags & NDR_SCALARS) {
517 NDR_CHECK(ndr_pull_align(ndr, 4));
518 NDR_CHECK(ndr_pull_security_acl_revision(ndr, NDR_SCALARS, &r->revision));
519 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
520 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_aces));
521 if (r->num_aces < 0 || r->num_aces > 1000) {
522 return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
524 NDR_PULL_ALLOC_N(ndr, r->aces, r->num_aces);
525 _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
526 NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
527 for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
528 NDR_CHECK(ndr_pull_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0]));
530 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
532 if (ndr_flags & NDR_BUFFERS) {
533 _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
534 NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
535 for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
536 NDR_CHECK(ndr_pull_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0]));
538 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
540 return NDR_ERR_SUCCESS;
543 _PUBLIC_ void ndr_print_security_acl(struct ndr_print *ndr, const char *name, const struct security_acl *r)
545 uint32_t cntr_aces_0;
546 ndr_print_struct(ndr, name, "security_acl");
547 ndr->depth++;
548 ndr_print_security_acl_revision(ndr, "revision", r->revision);
549 ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_acl(r, ndr->flags):r->size);
550 ndr_print_uint32(ndr, "num_aces", r->num_aces);
551 ndr->print(ndr, "%s: ARRAY(%d)", "aces", r->num_aces);
552 ndr->depth++;
553 for (cntr_aces_0=0;cntr_aces_0<r->num_aces;cntr_aces_0++) {
554 char *idx_0=NULL;
555 if (asprintf(&idx_0, "[%d]", cntr_aces_0) != -1) {
556 ndr_print_security_ace(ndr, "aces", &r->aces[cntr_aces_0]);
557 free(idx_0);
560 ndr->depth--;
561 ndr->depth--;
564 static enum ndr_err_code ndr_push_security_descriptor_revision(struct ndr_push *ndr, int ndr_flags, enum security_descriptor_revision r)
566 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
567 return NDR_ERR_SUCCESS;
570 static enum ndr_err_code ndr_pull_security_descriptor_revision(struct ndr_pull *ndr, int ndr_flags, enum security_descriptor_revision *r)
572 uint8_t v;
573 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
574 *r = v;
575 return NDR_ERR_SUCCESS;
578 _PUBLIC_ void ndr_print_security_descriptor_revision(struct ndr_print *ndr, const char *name, enum security_descriptor_revision r)
580 const char *val = NULL;
582 switch (r) {
583 case SECURITY_DESCRIPTOR_REVISION_1: val = "SECURITY_DESCRIPTOR_REVISION_1"; break;
585 ndr_print_enum(ndr, name, "ENUM", val, r);
588 static enum ndr_err_code ndr_push_security_descriptor_type(struct ndr_push *ndr, int ndr_flags, uint16_t r)
590 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
591 return NDR_ERR_SUCCESS;
594 static enum ndr_err_code ndr_pull_security_descriptor_type(struct ndr_pull *ndr, int ndr_flags, uint16_t *r)
596 uint16_t v;
597 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
598 *r = v;
599 return NDR_ERR_SUCCESS;
602 _PUBLIC_ void ndr_print_security_descriptor_type(struct ndr_print *ndr, const char *name, uint16_t r)
604 ndr_print_uint16(ndr, name, r);
605 ndr->depth++;
606 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_OWNER_DEFAULTED", SEC_DESC_OWNER_DEFAULTED, r);
607 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_GROUP_DEFAULTED", SEC_DESC_GROUP_DEFAULTED, r);
608 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PRESENT", SEC_DESC_DACL_PRESENT, r);
609 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_DEFAULTED", SEC_DESC_DACL_DEFAULTED, r);
610 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PRESENT", SEC_DESC_SACL_PRESENT, r);
611 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_DEFAULTED", SEC_DESC_SACL_DEFAULTED, r);
612 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_TRUSTED", SEC_DESC_DACL_TRUSTED, r);
613 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SERVER_SECURITY", SEC_DESC_SERVER_SECURITY, r);
614 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERIT_REQ", SEC_DESC_DACL_AUTO_INHERIT_REQ, r);
615 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERIT_REQ", SEC_DESC_SACL_AUTO_INHERIT_REQ, r);
616 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERITED", SEC_DESC_DACL_AUTO_INHERITED, r);
617 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERITED", SEC_DESC_SACL_AUTO_INHERITED, r);
618 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PROTECTED", SEC_DESC_DACL_PROTECTED, r);
619 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PROTECTED", SEC_DESC_SACL_PROTECTED, r);
620 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_RM_CONTROL_VALID", SEC_DESC_RM_CONTROL_VALID, r);
621 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SELF_RELATIVE", SEC_DESC_SELF_RELATIVE, r);
622 ndr->depth--;
625 _PUBLIC_ enum ndr_err_code ndr_push_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r)
628 uint32_t _flags_save_STRUCT = ndr->flags;
629 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
630 if (ndr_flags & NDR_SCALARS) {
631 NDR_CHECK(ndr_push_align(ndr, 4));
632 NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision));
633 NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type));
634 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid));
635 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid));
636 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl));
637 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl));
639 if (ndr_flags & NDR_BUFFERS) {
640 if (r->owner_sid) {
641 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->owner_sid));
642 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->owner_sid));
644 if (r->group_sid) {
645 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->group_sid));
646 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->group_sid));
648 if (r->sacl) {
649 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->sacl));
650 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
652 if (r->dacl) {
653 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->dacl));
654 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
657 ndr->flags = _flags_save_STRUCT;
659 return NDR_ERR_SUCCESS;
662 _PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r)
664 uint32_t _ptr_owner_sid;
665 TALLOC_CTX *_mem_save_owner_sid_0;
666 uint32_t _ptr_group_sid;
667 TALLOC_CTX *_mem_save_group_sid_0;
668 uint32_t _ptr_sacl;
669 TALLOC_CTX *_mem_save_sacl_0;
670 uint32_t _ptr_dacl;
671 TALLOC_CTX *_mem_save_dacl_0;
673 uint32_t _flags_save_STRUCT = ndr->flags;
674 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
675 if (ndr_flags & NDR_SCALARS) {
676 NDR_CHECK(ndr_pull_align(ndr, 4));
677 NDR_CHECK(ndr_pull_security_descriptor_revision(ndr, NDR_SCALARS, &r->revision));
678 NDR_CHECK(ndr_pull_security_descriptor_type(ndr, NDR_SCALARS, &r->type));
679 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_owner_sid));
680 if (_ptr_owner_sid) {
681 NDR_PULL_ALLOC(ndr, r->owner_sid);
682 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->owner_sid, _ptr_owner_sid));
683 } else {
684 r->owner_sid = NULL;
686 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid));
687 if (_ptr_group_sid) {
688 NDR_PULL_ALLOC(ndr, r->group_sid);
689 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->group_sid, _ptr_group_sid));
690 } else {
691 r->group_sid = NULL;
693 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sacl));
694 if (_ptr_sacl) {
695 NDR_PULL_ALLOC(ndr, r->sacl);
696 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->sacl, _ptr_sacl));
697 } else {
698 r->sacl = NULL;
700 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dacl));
701 if (_ptr_dacl) {
702 NDR_PULL_ALLOC(ndr, r->dacl);
703 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->dacl, _ptr_dacl));
704 } else {
705 r->dacl = NULL;
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|NDR_BUFFERS, 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|NDR_BUFFERS, 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, 4));
797 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_security_descriptor(r->sd, ndr->flags)));
798 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd));
800 if (ndr_flags & NDR_BUFFERS) {
801 if (r->sd) {
803 struct ndr_push *_ndr_sd;
804 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sd, 4, -1));
805 NDR_CHECK(ndr_push_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
806 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sd, 4, -1));
810 return NDR_ERR_SUCCESS;
813 _PUBLIC_ enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r)
815 uint32_t _ptr_sd;
816 TALLOC_CTX *_mem_save_sd_0;
817 if (ndr_flags & NDR_SCALARS) {
818 NDR_CHECK(ndr_pull_align(ndr, 4));
819 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sd_size));
820 if (r->sd_size < 0 || r->sd_size > 0x40000) {
821 return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
823 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd));
824 if (_ptr_sd) {
825 NDR_PULL_ALLOC(ndr, r->sd);
826 } else {
827 r->sd = NULL;
830 if (ndr_flags & NDR_BUFFERS) {
831 if (r->sd) {
832 _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
833 NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0);
835 struct ndr_pull *_ndr_sd;
836 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sd, 4, -1));
837 NDR_CHECK(ndr_pull_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
838 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sd, 4, -1));
840 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0);
843 return NDR_ERR_SUCCESS;
846 _PUBLIC_ void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, const struct sec_desc_buf *r)
848 ndr_print_struct(ndr, name, "sec_desc_buf");
849 ndr->depth++;
850 ndr_print_uint32(ndr, "sd_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_descriptor(r->sd, ndr->flags):r->sd_size);
851 ndr_print_ptr(ndr, "sd", r->sd);
852 ndr->depth++;
853 if (r->sd) {
854 ndr_print_security_descriptor(ndr, "sd", r->sd);
856 ndr->depth--;
857 ndr->depth--;
860 _PUBLIC_ enum ndr_err_code ndr_push_security_token(struct ndr_push *ndr, int ndr_flags, const struct security_token *r)
862 uint32_t cntr_sids_0;
863 if (ndr_flags & NDR_SCALARS) {
864 NDR_CHECK(ndr_push_align(ndr, 4));
865 NDR_CHECK(ndr_push_unique_ptr(ndr, r->user_sid));
866 NDR_CHECK(ndr_push_unique_ptr(ndr, r->group_sid));
867 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sids));
868 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sids));
869 for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
870 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sids[cntr_sids_0]));
872 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->privilege_mask));
874 if (ndr_flags & NDR_BUFFERS) {
875 if (r->user_sid) {
876 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->user_sid));
878 if (r->group_sid) {
879 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->group_sid));
881 for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
882 if (r->sids[cntr_sids_0]) {
883 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->sids[cntr_sids_0]));
887 return NDR_ERR_SUCCESS;
890 _PUBLIC_ enum ndr_err_code ndr_pull_security_token(struct ndr_pull *ndr, int ndr_flags, struct security_token *r)
892 uint32_t _ptr_user_sid;
893 TALLOC_CTX *_mem_save_user_sid_0;
894 uint32_t _ptr_group_sid;
895 TALLOC_CTX *_mem_save_group_sid_0;
896 uint32_t _ptr_sids;
897 uint32_t cntr_sids_0;
898 TALLOC_CTX *_mem_save_sids_0;
899 TALLOC_CTX *_mem_save_sids_1;
900 if (ndr_flags & NDR_SCALARS) {
901 NDR_CHECK(ndr_pull_align(ndr, 4));
902 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_user_sid));
903 if (_ptr_user_sid) {
904 NDR_PULL_ALLOC(ndr, r->user_sid);
905 } else {
906 r->user_sid = NULL;
908 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid));
909 if (_ptr_group_sid) {
910 NDR_PULL_ALLOC(ndr, r->group_sid);
911 } else {
912 r->group_sid = NULL;
914 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_sids));
915 NDR_CHECK(ndr_pull_array_size(ndr, &r->sids));
916 NDR_PULL_ALLOC_N(ndr, r->sids, ndr_get_array_size(ndr, &r->sids));
917 _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
918 NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
919 for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
920 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sids));
921 if (_ptr_sids) {
922 NDR_PULL_ALLOC(ndr, r->sids[cntr_sids_0]);
923 } else {
924 r->sids[cntr_sids_0] = NULL;
927 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0);
928 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->privilege_mask));
929 if (r->sids) {
930 NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->sids, r->num_sids));
933 if (ndr_flags & NDR_BUFFERS) {
934 if (r->user_sid) {
935 _mem_save_user_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
936 NDR_PULL_SET_MEM_CTX(ndr, r->user_sid, 0);
937 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->user_sid));
938 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_sid_0, 0);
940 if (r->group_sid) {
941 _mem_save_group_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
942 NDR_PULL_SET_MEM_CTX(ndr, r->group_sid, 0);
943 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->group_sid));
944 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_sid_0, 0);
946 _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
947 NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
948 for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
949 if (r->sids[cntr_sids_0]) {
950 _mem_save_sids_1 = NDR_PULL_GET_MEM_CTX(ndr);
951 NDR_PULL_SET_MEM_CTX(ndr, r->sids[cntr_sids_0], 0);
952 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->sids[cntr_sids_0]));
953 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_1, 0);
956 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0);
958 return NDR_ERR_SUCCESS;
961 _PUBLIC_ void ndr_print_security_token(struct ndr_print *ndr, const char *name, const struct security_token *r)
963 uint32_t cntr_sids_0;
964 ndr_print_struct(ndr, name, "security_token");
965 ndr->depth++;
966 ndr_print_ptr(ndr, "user_sid", r->user_sid);
967 ndr->depth++;
968 if (r->user_sid) {
969 ndr_print_dom_sid(ndr, "user_sid", r->user_sid);
971 ndr->depth--;
972 ndr_print_ptr(ndr, "group_sid", r->group_sid);
973 ndr->depth++;
974 if (r->group_sid) {
975 ndr_print_dom_sid(ndr, "group_sid", r->group_sid);
977 ndr->depth--;
978 ndr_print_uint32(ndr, "num_sids", r->num_sids);
979 ndr->print(ndr, "%s: ARRAY(%d)", "sids", r->num_sids);
980 ndr->depth++;
981 for (cntr_sids_0=0;cntr_sids_0<r->num_sids;cntr_sids_0++) {
982 char *idx_0=NULL;
983 if (asprintf(&idx_0, "[%d]", cntr_sids_0) != -1) {
984 ndr_print_ptr(ndr, "sids", r->sids[cntr_sids_0]);
985 ndr->depth++;
986 if (r->sids[cntr_sids_0]) {
987 ndr_print_dom_sid(ndr, "sids", r->sids[cntr_sids_0]);
989 ndr->depth--;
990 free(idx_0);
993 ndr->depth--;
994 ndr_print_udlong(ndr, "privilege_mask", r->privilege_mask);
995 ndr->depth--;
998 _PUBLIC_ enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r)
1000 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
1001 return NDR_ERR_SUCCESS;
1004 _PUBLIC_ enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
1006 uint32_t v;
1007 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
1008 *r = v;
1009 return NDR_ERR_SUCCESS;
1012 _PUBLIC_ void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name, uint32_t r)
1014 ndr_print_uint32(ndr, name, r);
1015 ndr->depth++;
1016 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_OWNER", SECINFO_OWNER, r);
1017 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_GROUP", SECINFO_GROUP, r);
1018 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_DACL", SECINFO_DACL, r);
1019 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_SACL", SECINFO_SACL, r);
1020 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_SACL", SECINFO_UNPROTECTED_SACL, r);
1021 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_DACL", SECINFO_UNPROTECTED_DACL, r);
1022 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_SACL", SECINFO_PROTECTED_SACL, r);
1023 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_DACL", SECINFO_PROTECTED_DACL, r);
1024 ndr->depth--;