s4:librpc/ndr: if uninitialized variable in string_array code
[Samba/gbeck.git] / librpc / gen_ndr / ndr_security.c
blobc227170779ae5d95246022d581d01b177c76f610
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_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_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 _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)
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 _PUBLIC_ 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->iconv_convenience, 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));
430 return NDR_ERR_SUCCESS;
433 _PUBLIC_ void ndr_print_security_ace(struct ndr_print *ndr, const char *name, const struct security_ace *r)
435 ndr_print_struct(ndr, name, "security_ace");
436 ndr->depth++;
437 ndr_print_security_ace_type(ndr, "type", r->type);
438 ndr_print_security_ace_flags(ndr, "flags", r->flags);
439 ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_ace(r, ndr->iconv_convenience, ndr->flags):r->size);
440 ndr_print_uint32(ndr, "access_mask", r->access_mask);
441 ndr_print_set_switch_value(ndr, &r->object, r->type);
442 ndr_print_security_ace_object_ctr(ndr, "object", &r->object);
443 ndr_print_dom_sid(ndr, "trustee", &r->trustee);
444 ndr->depth--;
447 static enum ndr_err_code ndr_push_security_acl_revision(struct ndr_push *ndr, int ndr_flags, enum security_acl_revision r)
449 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
450 return NDR_ERR_SUCCESS;
453 static enum ndr_err_code ndr_pull_security_acl_revision(struct ndr_pull *ndr, int ndr_flags, enum security_acl_revision *r)
455 uint16_t v;
456 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
457 *r = v;
458 return NDR_ERR_SUCCESS;
461 _PUBLIC_ void ndr_print_security_acl_revision(struct ndr_print *ndr, const char *name, enum security_acl_revision r)
463 const char *val = NULL;
465 switch (r) {
466 case SECURITY_ACL_REVISION_NT4: val = "SECURITY_ACL_REVISION_NT4"; break;
467 case SECURITY_ACL_REVISION_ADS: val = "SECURITY_ACL_REVISION_ADS"; break;
469 ndr_print_enum(ndr, name, "ENUM", val, r);
472 _PUBLIC_ enum ndr_err_code ndr_push_security_acl(struct ndr_push *ndr, int ndr_flags, const struct security_acl *r)
474 uint32_t cntr_aces_0;
475 if (ndr_flags & NDR_SCALARS) {
476 NDR_CHECK(ndr_push_align(ndr, 4));
477 NDR_CHECK(ndr_push_security_acl_revision(ndr, NDR_SCALARS, r->revision));
478 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_acl(r, ndr->iconv_convenience, ndr->flags)));
479 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_aces));
480 for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
481 NDR_CHECK(ndr_push_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0]));
484 if (ndr_flags & NDR_BUFFERS) {
485 for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
486 NDR_CHECK(ndr_push_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0]));
489 return NDR_ERR_SUCCESS;
492 _PUBLIC_ enum ndr_err_code ndr_pull_security_acl(struct ndr_pull *ndr, int ndr_flags, struct security_acl *r)
494 uint32_t cntr_aces_0;
495 TALLOC_CTX *_mem_save_aces_0;
496 if (ndr_flags & NDR_SCALARS) {
497 NDR_CHECK(ndr_pull_align(ndr, 4));
498 NDR_CHECK(ndr_pull_security_acl_revision(ndr, NDR_SCALARS, &r->revision));
499 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
500 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_aces));
501 if (r->num_aces > 1000) {
502 return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
504 NDR_PULL_ALLOC_N(ndr, r->aces, r->num_aces);
505 _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
506 NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
507 for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
508 NDR_CHECK(ndr_pull_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0]));
510 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
512 if (ndr_flags & NDR_BUFFERS) {
513 _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
514 NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
515 for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
516 NDR_CHECK(ndr_pull_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0]));
518 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
520 return NDR_ERR_SUCCESS;
523 _PUBLIC_ void ndr_print_security_acl(struct ndr_print *ndr, const char *name, const struct security_acl *r)
525 uint32_t cntr_aces_0;
526 ndr_print_struct(ndr, name, "security_acl");
527 ndr->depth++;
528 ndr_print_security_acl_revision(ndr, "revision", r->revision);
529 ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_acl(r, ndr->iconv_convenience, ndr->flags):r->size);
530 ndr_print_uint32(ndr, "num_aces", r->num_aces);
531 ndr->print(ndr, "%s: ARRAY(%d)", "aces", (int)r->num_aces);
532 ndr->depth++;
533 for (cntr_aces_0=0;cntr_aces_0<r->num_aces;cntr_aces_0++) {
534 char *idx_0=NULL;
535 if (asprintf(&idx_0, "[%d]", cntr_aces_0) != -1) {
536 ndr_print_security_ace(ndr, "aces", &r->aces[cntr_aces_0]);
537 free(idx_0);
540 ndr->depth--;
541 ndr->depth--;
544 static enum ndr_err_code ndr_push_security_descriptor_revision(struct ndr_push *ndr, int ndr_flags, enum security_descriptor_revision r)
546 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
547 return NDR_ERR_SUCCESS;
550 static enum ndr_err_code ndr_pull_security_descriptor_revision(struct ndr_pull *ndr, int ndr_flags, enum security_descriptor_revision *r)
552 uint8_t v;
553 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
554 *r = v;
555 return NDR_ERR_SUCCESS;
558 _PUBLIC_ void ndr_print_security_descriptor_revision(struct ndr_print *ndr, const char *name, enum security_descriptor_revision r)
560 const char *val = NULL;
562 switch (r) {
563 case SECURITY_DESCRIPTOR_REVISION_1: val = "SECURITY_DESCRIPTOR_REVISION_1"; break;
565 ndr_print_enum(ndr, name, "ENUM", val, r);
568 static enum ndr_err_code ndr_push_security_descriptor_type(struct ndr_push *ndr, int ndr_flags, uint16_t r)
570 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
571 return NDR_ERR_SUCCESS;
574 static enum ndr_err_code ndr_pull_security_descriptor_type(struct ndr_pull *ndr, int ndr_flags, uint16_t *r)
576 uint16_t v;
577 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
578 *r = v;
579 return NDR_ERR_SUCCESS;
582 _PUBLIC_ void ndr_print_security_descriptor_type(struct ndr_print *ndr, const char *name, uint16_t r)
584 ndr_print_uint16(ndr, name, r);
585 ndr->depth++;
586 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_OWNER_DEFAULTED", SEC_DESC_OWNER_DEFAULTED, r);
587 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_GROUP_DEFAULTED", SEC_DESC_GROUP_DEFAULTED, r);
588 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PRESENT", SEC_DESC_DACL_PRESENT, r);
589 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_DEFAULTED", SEC_DESC_DACL_DEFAULTED, r);
590 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PRESENT", SEC_DESC_SACL_PRESENT, r);
591 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_DEFAULTED", SEC_DESC_SACL_DEFAULTED, r);
592 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_TRUSTED", SEC_DESC_DACL_TRUSTED, r);
593 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SERVER_SECURITY", SEC_DESC_SERVER_SECURITY, r);
594 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERIT_REQ", SEC_DESC_DACL_AUTO_INHERIT_REQ, r);
595 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERIT_REQ", SEC_DESC_SACL_AUTO_INHERIT_REQ, r);
596 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERITED", SEC_DESC_DACL_AUTO_INHERITED, r);
597 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERITED", SEC_DESC_SACL_AUTO_INHERITED, r);
598 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PROTECTED", SEC_DESC_DACL_PROTECTED, r);
599 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PROTECTED", SEC_DESC_SACL_PROTECTED, r);
600 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_RM_CONTROL_VALID", SEC_DESC_RM_CONTROL_VALID, r);
601 ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SELF_RELATIVE", SEC_DESC_SELF_RELATIVE, r);
602 ndr->depth--;
605 _PUBLIC_ enum ndr_err_code ndr_push_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r)
608 uint32_t _flags_save_STRUCT = ndr->flags;
609 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
610 if (ndr_flags & NDR_SCALARS) {
611 NDR_CHECK(ndr_push_align(ndr, 4));
612 NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision));
613 NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type));
614 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid));
615 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid));
616 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl));
617 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl));
619 if (ndr_flags & NDR_BUFFERS) {
620 if (r->owner_sid) {
621 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->owner_sid));
622 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->owner_sid));
624 if (r->group_sid) {
625 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->group_sid));
626 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->group_sid));
628 if (r->sacl) {
629 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->sacl));
630 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
632 if (r->dacl) {
633 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->dacl));
634 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
637 ndr->flags = _flags_save_STRUCT;
639 return NDR_ERR_SUCCESS;
642 _PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r)
644 uint32_t _ptr_owner_sid;
645 TALLOC_CTX *_mem_save_owner_sid_0;
646 uint32_t _ptr_group_sid;
647 TALLOC_CTX *_mem_save_group_sid_0;
648 uint32_t _ptr_sacl;
649 TALLOC_CTX *_mem_save_sacl_0;
650 uint32_t _ptr_dacl;
651 TALLOC_CTX *_mem_save_dacl_0;
653 uint32_t _flags_save_STRUCT = ndr->flags;
654 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
655 if (ndr_flags & NDR_SCALARS) {
656 NDR_CHECK(ndr_pull_align(ndr, 4));
657 NDR_CHECK(ndr_pull_security_descriptor_revision(ndr, NDR_SCALARS, &r->revision));
658 NDR_CHECK(ndr_pull_security_descriptor_type(ndr, NDR_SCALARS, &r->type));
659 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_owner_sid));
660 if (_ptr_owner_sid) {
661 NDR_PULL_ALLOC(ndr, r->owner_sid);
662 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->owner_sid, _ptr_owner_sid));
663 } else {
664 r->owner_sid = NULL;
666 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid));
667 if (_ptr_group_sid) {
668 NDR_PULL_ALLOC(ndr, r->group_sid);
669 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->group_sid, _ptr_group_sid));
670 } else {
671 r->group_sid = NULL;
673 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sacl));
674 if (_ptr_sacl) {
675 NDR_PULL_ALLOC(ndr, r->sacl);
676 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->sacl, _ptr_sacl));
677 } else {
678 r->sacl = NULL;
680 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dacl));
681 if (_ptr_dacl) {
682 NDR_PULL_ALLOC(ndr, r->dacl);
683 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->dacl, _ptr_dacl));
684 } else {
685 r->dacl = NULL;
688 if (ndr_flags & NDR_BUFFERS) {
689 if (r->owner_sid) {
690 uint32_t _relative_save_offset;
691 _relative_save_offset = ndr->offset;
692 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->owner_sid));
693 _mem_save_owner_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
694 NDR_PULL_SET_MEM_CTX(ndr, r->owner_sid, 0);
695 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->owner_sid));
696 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_owner_sid_0, 0);
697 ndr->offset = _relative_save_offset;
699 if (r->group_sid) {
700 uint32_t _relative_save_offset;
701 _relative_save_offset = ndr->offset;
702 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->group_sid));
703 _mem_save_group_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
704 NDR_PULL_SET_MEM_CTX(ndr, r->group_sid, 0);
705 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->group_sid));
706 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_sid_0, 0);
707 ndr->offset = _relative_save_offset;
709 if (r->sacl) {
710 uint32_t _relative_save_offset;
711 _relative_save_offset = ndr->offset;
712 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->sacl));
713 _mem_save_sacl_0 = NDR_PULL_GET_MEM_CTX(ndr);
714 NDR_PULL_SET_MEM_CTX(ndr, r->sacl, 0);
715 NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
716 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sacl_0, 0);
717 ndr->offset = _relative_save_offset;
719 if (r->dacl) {
720 uint32_t _relative_save_offset;
721 _relative_save_offset = ndr->offset;
722 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->dacl));
723 _mem_save_dacl_0 = NDR_PULL_GET_MEM_CTX(ndr);
724 NDR_PULL_SET_MEM_CTX(ndr, r->dacl, 0);
725 NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
726 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dacl_0, 0);
727 ndr->offset = _relative_save_offset;
730 ndr->flags = _flags_save_STRUCT;
732 return NDR_ERR_SUCCESS;
735 _PUBLIC_ void ndr_print_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r)
737 ndr_print_struct(ndr, name, "security_descriptor");
739 uint32_t _flags_save_STRUCT = ndr->flags;
740 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
741 ndr->depth++;
742 ndr_print_security_descriptor_revision(ndr, "revision", r->revision);
743 ndr_print_security_descriptor_type(ndr, "type", r->type);
744 ndr_print_ptr(ndr, "owner_sid", r->owner_sid);
745 ndr->depth++;
746 if (r->owner_sid) {
747 ndr_print_dom_sid(ndr, "owner_sid", r->owner_sid);
749 ndr->depth--;
750 ndr_print_ptr(ndr, "group_sid", r->group_sid);
751 ndr->depth++;
752 if (r->group_sid) {
753 ndr_print_dom_sid(ndr, "group_sid", r->group_sid);
755 ndr->depth--;
756 ndr_print_ptr(ndr, "sacl", r->sacl);
757 ndr->depth++;
758 if (r->sacl) {
759 ndr_print_security_acl(ndr, "sacl", r->sacl);
761 ndr->depth--;
762 ndr_print_ptr(ndr, "dacl", r->dacl);
763 ndr->depth++;
764 if (r->dacl) {
765 ndr_print_security_acl(ndr, "dacl", r->dacl);
767 ndr->depth--;
768 ndr->depth--;
769 ndr->flags = _flags_save_STRUCT;
773 _PUBLIC_ enum ndr_err_code ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r)
775 if (ndr_flags & NDR_SCALARS) {
776 NDR_CHECK(ndr_push_align(ndr, 4));
777 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_security_descriptor(r->sd, ndr->iconv_convenience, ndr->flags)));
778 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd));
780 if (ndr_flags & NDR_BUFFERS) {
781 if (r->sd) {
783 struct ndr_push *_ndr_sd;
784 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sd, 4, -1));
785 NDR_CHECK(ndr_push_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
786 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sd, 4, -1));
790 return NDR_ERR_SUCCESS;
793 _PUBLIC_ enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r)
795 uint32_t _ptr_sd;
796 TALLOC_CTX *_mem_save_sd_0;
797 if (ndr_flags & NDR_SCALARS) {
798 NDR_CHECK(ndr_pull_align(ndr, 4));
799 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sd_size));
800 if (r->sd_size > 0x40000) {
801 return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
803 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd));
804 if (_ptr_sd) {
805 NDR_PULL_ALLOC(ndr, r->sd);
806 } else {
807 r->sd = NULL;
810 if (ndr_flags & NDR_BUFFERS) {
811 if (r->sd) {
812 _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
813 NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0);
815 struct ndr_pull *_ndr_sd;
816 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sd, 4, -1));
817 NDR_CHECK(ndr_pull_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
818 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sd, 4, -1));
820 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0);
823 return NDR_ERR_SUCCESS;
826 _PUBLIC_ void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, const struct sec_desc_buf *r)
828 ndr_print_struct(ndr, name, "sec_desc_buf");
829 ndr->depth++;
830 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);
831 ndr_print_ptr(ndr, "sd", r->sd);
832 ndr->depth++;
833 if (r->sd) {
834 ndr_print_security_descriptor(ndr, "sd", r->sd);
836 ndr->depth--;
837 ndr->depth--;
840 _PUBLIC_ enum ndr_err_code ndr_push_security_token(struct ndr_push *ndr, int ndr_flags, const struct security_token *r)
842 uint32_t cntr_sids_0;
843 if (ndr_flags & NDR_SCALARS) {
844 NDR_CHECK(ndr_push_align(ndr, 4));
845 NDR_CHECK(ndr_push_unique_ptr(ndr, r->user_sid));
846 NDR_CHECK(ndr_push_unique_ptr(ndr, r->group_sid));
847 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sids));
848 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sids));
849 for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
850 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sids[cntr_sids_0]));
852 NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->privilege_mask));
854 if (ndr_flags & NDR_BUFFERS) {
855 if (r->user_sid) {
856 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->user_sid));
858 if (r->group_sid) {
859 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->group_sid));
861 for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
862 if (r->sids[cntr_sids_0]) {
863 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->sids[cntr_sids_0]));
867 return NDR_ERR_SUCCESS;
870 _PUBLIC_ enum ndr_err_code ndr_pull_security_token(struct ndr_pull *ndr, int ndr_flags, struct security_token *r)
872 uint32_t _ptr_user_sid;
873 TALLOC_CTX *_mem_save_user_sid_0;
874 uint32_t _ptr_group_sid;
875 TALLOC_CTX *_mem_save_group_sid_0;
876 uint32_t _ptr_sids;
877 uint32_t cntr_sids_0;
878 TALLOC_CTX *_mem_save_sids_0;
879 TALLOC_CTX *_mem_save_sids_1;
880 if (ndr_flags & NDR_SCALARS) {
881 NDR_CHECK(ndr_pull_align(ndr, 4));
882 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_user_sid));
883 if (_ptr_user_sid) {
884 NDR_PULL_ALLOC(ndr, r->user_sid);
885 } else {
886 r->user_sid = NULL;
888 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid));
889 if (_ptr_group_sid) {
890 NDR_PULL_ALLOC(ndr, r->group_sid);
891 } else {
892 r->group_sid = NULL;
894 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_sids));
895 NDR_CHECK(ndr_pull_array_size(ndr, &r->sids));
896 NDR_PULL_ALLOC_N(ndr, r->sids, ndr_get_array_size(ndr, &r->sids));
897 _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
898 NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
899 for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
900 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sids));
901 if (_ptr_sids) {
902 NDR_PULL_ALLOC(ndr, r->sids[cntr_sids_0]);
903 } else {
904 r->sids[cntr_sids_0] = NULL;
907 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0);
908 NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->privilege_mask));
909 if (r->sids) {
910 NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->sids, r->num_sids));
913 if (ndr_flags & NDR_BUFFERS) {
914 if (r->user_sid) {
915 _mem_save_user_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
916 NDR_PULL_SET_MEM_CTX(ndr, r->user_sid, 0);
917 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->user_sid));
918 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_sid_0, 0);
920 if (r->group_sid) {
921 _mem_save_group_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
922 NDR_PULL_SET_MEM_CTX(ndr, r->group_sid, 0);
923 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->group_sid));
924 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_sid_0, 0);
926 _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
927 NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
928 for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
929 if (r->sids[cntr_sids_0]) {
930 _mem_save_sids_1 = NDR_PULL_GET_MEM_CTX(ndr);
931 NDR_PULL_SET_MEM_CTX(ndr, r->sids[cntr_sids_0], 0);
932 NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->sids[cntr_sids_0]));
933 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_1, 0);
936 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0);
938 return NDR_ERR_SUCCESS;
941 _PUBLIC_ void ndr_print_security_token(struct ndr_print *ndr, const char *name, const struct security_token *r)
943 uint32_t cntr_sids_0;
944 ndr_print_struct(ndr, name, "security_token");
945 ndr->depth++;
946 ndr_print_ptr(ndr, "user_sid", r->user_sid);
947 ndr->depth++;
948 if (r->user_sid) {
949 ndr_print_dom_sid(ndr, "user_sid", r->user_sid);
951 ndr->depth--;
952 ndr_print_ptr(ndr, "group_sid", r->group_sid);
953 ndr->depth++;
954 if (r->group_sid) {
955 ndr_print_dom_sid(ndr, "group_sid", r->group_sid);
957 ndr->depth--;
958 ndr_print_uint32(ndr, "num_sids", r->num_sids);
959 ndr->print(ndr, "%s: ARRAY(%d)", "sids", (int)r->num_sids);
960 ndr->depth++;
961 for (cntr_sids_0=0;cntr_sids_0<r->num_sids;cntr_sids_0++) {
962 char *idx_0=NULL;
963 if (asprintf(&idx_0, "[%d]", cntr_sids_0) != -1) {
964 ndr_print_ptr(ndr, "sids", r->sids[cntr_sids_0]);
965 ndr->depth++;
966 if (r->sids[cntr_sids_0]) {
967 ndr_print_dom_sid(ndr, "sids", r->sids[cntr_sids_0]);
969 ndr->depth--;
970 free(idx_0);
973 ndr->depth--;
974 ndr_print_udlong(ndr, "privilege_mask", r->privilege_mask);
975 ndr->depth--;
978 _PUBLIC_ enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r)
980 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
981 return NDR_ERR_SUCCESS;
984 _PUBLIC_ enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
986 uint32_t v;
987 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
988 *r = v;
989 return NDR_ERR_SUCCESS;
992 _PUBLIC_ void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name, uint32_t r)
994 ndr_print_uint32(ndr, name, r);
995 ndr->depth++;
996 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_OWNER", SECINFO_OWNER, r);
997 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_GROUP", SECINFO_GROUP, r);
998 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_DACL", SECINFO_DACL, r);
999 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_SACL", SECINFO_SACL, r);
1000 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_SACL", SECINFO_UNPROTECTED_SACL, r);
1001 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_DACL", SECINFO_UNPROTECTED_DACL, r);
1002 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_SACL", SECINFO_PROTECTED_SACL, r);
1003 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_DACL", SECINFO_PROTECTED_DACL, r);
1004 ndr->depth--;
1007 _PUBLIC_ enum ndr_err_code ndr_push_kerb_EncTypes(struct ndr_push *ndr, int ndr_flags, uint32_t r)
1009 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
1010 return NDR_ERR_SUCCESS;
1013 _PUBLIC_ enum ndr_err_code ndr_pull_kerb_EncTypes(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
1015 uint32_t v;
1016 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
1017 *r = v;
1018 return NDR_ERR_SUCCESS;
1021 _PUBLIC_ void ndr_print_kerb_EncTypes(struct ndr_print *ndr, const char *name, uint32_t r)
1023 ndr_print_uint32(ndr, name, r);
1024 ndr->depth++;
1025 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_DES_CBC_CRC", KERB_ENCTYPE_DES_CBC_CRC, r);
1026 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_DES_CBC_MD5", KERB_ENCTYPE_DES_CBC_MD5, r);
1027 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_RC4_HMAC_MD5", KERB_ENCTYPE_RC4_HMAC_MD5, r);
1028 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96", KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96, r);
1029 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96", KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96, r);
1030 ndr->depth--;