1 /* parser auto-generated by pidl */
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
)
16 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &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
);
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
);
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
)
45 NDR_CHECK(ndr_pull_enum_uint8(ndr
, NDR_SCALARS
, &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
;
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
)
77 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &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
);
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
);
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));
97 case SEC_ACE_OBJECT_TYPE_PRESENT
: {
98 NDR_CHECK(ndr_push_GUID(ndr
, NDR_SCALARS
, &r
->type
));
106 if (ndr_flags
& NDR_BUFFERS
) {
107 int level
= ndr_push_get_switch_value(ndr
, r
);
109 case SEC_ACE_OBJECT_TYPE_PRESENT
:
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
)
123 level
= ndr_pull_get_switch_value(ndr
, r
);
124 if (ndr_flags
& NDR_SCALARS
) {
125 NDR_CHECK(ndr_pull_union_align(ndr
, 4));
127 case SEC_ACE_OBJECT_TYPE_PRESENT
: {
128 NDR_CHECK(ndr_pull_GUID(ndr
, NDR_SCALARS
, &r
->type
));
136 if (ndr_flags
& NDR_BUFFERS
) {
138 case SEC_ACE_OBJECT_TYPE_PRESENT
:
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
)
152 level
= ndr_print_get_switch_value(ndr
, r
);
153 ndr_print_union(ndr
, name
, level
, "security_ace_object_type");
155 case SEC_ACE_OBJECT_TYPE_PRESENT
:
156 ndr_print_GUID(ndr
, "type", &r
->type
);
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));
171 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT
: {
172 NDR_CHECK(ndr_push_GUID(ndr
, NDR_SCALARS
, &r
->inherited_type
));
180 if (ndr_flags
& NDR_BUFFERS
) {
181 int level
= ndr_push_get_switch_value(ndr
, r
);
183 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT
:
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
)
197 level
= ndr_pull_get_switch_value(ndr
, r
);
198 if (ndr_flags
& NDR_SCALARS
) {
199 NDR_CHECK(ndr_pull_union_align(ndr
, 4));
201 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT
: {
202 NDR_CHECK(ndr_pull_GUID(ndr
, NDR_SCALARS
, &r
->inherited_type
));
210 if (ndr_flags
& NDR_BUFFERS
) {
212 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT
:
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
)
226 level
= ndr_print_get_switch_value(ndr
, r
);
227 ndr_print_union(ndr
, name
, level
, "security_ace_object_inherited_type");
229 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT
:
230 ndr_print_GUID(ndr
, "inherited_type", &r
->inherited_type
);
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");
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
);
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));
293 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT
: {
294 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
297 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT
: {
298 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
301 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT
: {
302 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
305 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT
: {
306 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
314 if (ndr_flags
& NDR_BUFFERS
) {
315 int level
= ndr_push_get_switch_value(ndr
, r
);
317 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT
:
318 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
321 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT
:
322 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
325 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT
:
326 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
329 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT
:
330 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
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
)
344 level
= ndr_pull_get_switch_value(ndr
, r
);
345 if (ndr_flags
& NDR_SCALARS
) {
346 NDR_CHECK(ndr_pull_union_align(ndr
, 4));
348 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT
: {
349 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
352 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT
: {
353 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
356 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT
: {
357 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
360 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT
: {
361 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
369 if (ndr_flags
& NDR_BUFFERS
) {
371 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT
:
372 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
375 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT
:
376 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
379 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT
:
380 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
383 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT
:
384 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
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
)
398 level
= ndr_print_get_switch_value(ndr
, r
);
399 ndr_print_union(ndr
, name
, level
, "security_ace_object_ctr");
401 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT
:
402 ndr_print_security_ace_object(ndr
, "object", &r
->object
);
405 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT
:
406 ndr_print_security_ace_object(ndr
, "object", &r
->object
);
409 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT
:
410 ndr_print_security_ace_object(ndr
, "object", &r
->object
);
413 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT
:
414 ndr_print_security_ace_object(ndr
, "object", &r
->object
);
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");
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
);
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
)
465 NDR_CHECK(ndr_pull_enum_uint1632(ndr
, NDR_SCALARS
, &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
;
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");
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
);
547 for (cntr_aces_0
=0;cntr_aces_0
<r
->num_aces
;cntr_aces_0
++) {
549 if (asprintf(&idx_0
, "[%d]", cntr_aces_0
) != -1) {
550 ndr_print_security_ace(ndr
, "aces", &r
->aces
[cntr_aces_0
]);
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
)
567 NDR_CHECK(ndr_pull_enum_uint8(ndr
, NDR_SCALARS
, &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
;
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
)
591 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &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
);
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
);
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
) {
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
));
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
));
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
));
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
;
668 TALLOC_CTX
*_mem_save_sacl_0
;
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
));
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
));
692 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_sacl
));
694 NDR_PULL_ALLOC(ndr
, r
->sacl
);
695 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->sacl
, _ptr_sacl
));
699 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_dacl
));
701 NDR_PULL_ALLOC(ndr
, r
->dacl
);
702 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->dacl
, _ptr_dacl
));
706 NDR_CHECK(ndr_pull_trailer_align(ndr
, 5));
708 if (ndr_flags
& NDR_BUFFERS
) {
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
;
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
;
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
;
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
);
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
);
767 ndr_print_dom_sid(ndr
, "owner_sid", r
->owner_sid
);
770 ndr_print_ptr(ndr
, "group_sid", r
->group_sid
);
773 ndr_print_dom_sid(ndr
, "group_sid", r
->group_sid
);
776 ndr_print_ptr(ndr
, "sacl", r
->sacl
);
779 ndr_print_security_acl(ndr
, "sacl", r
->sacl
);
782 ndr_print_ptr(ndr
, "dacl", r
->dacl
);
785 ndr_print_security_acl(ndr
, "dacl", r
->dacl
);
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
) {
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
)
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
));
826 NDR_PULL_ALLOC(ndr
, r
->sd
);
830 NDR_CHECK(ndr_pull_trailer_align(ndr
, 5));
832 if (ndr_flags
& NDR_BUFFERS
) {
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");
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
);
856 ndr_print_security_descriptor(ndr
, "sd", r
->sd
);
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
) {
880 NDR_CHECK(ndr_push_dom_sid(ndr
, NDR_SCALARS
, r
->user_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
;
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
));
914 NDR_PULL_ALLOC(ndr
, r
->user_sid
);
918 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_group_sid
));
919 if (_ptr_group_sid
) {
920 NDR_PULL_ALLOC(ndr
, r
->group_sid
);
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
));
933 NDR_PULL_ALLOC(ndr
, r
->sids
[cntr_sids_0
]);
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
);
944 r
->default_dacl
= NULL
;
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
) {
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);
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");
991 ndr_print_ptr(ndr
, "user_sid", r
->user_sid
);
994 ndr_print_dom_sid(ndr
, "user_sid", r
->user_sid
);
997 ndr_print_ptr(ndr
, "group_sid", r
->group_sid
);
1000 ndr_print_dom_sid(ndr
, "group_sid", r
->group_sid
);
1003 ndr_print_uint32(ndr
, "num_sids", r
->num_sids
);
1004 ndr
->print(ndr
, "%s: ARRAY(%d)", "sids", (int)r
->num_sids
);
1006 for (cntr_sids_0
=0;cntr_sids_0
<r
->num_sids
;cntr_sids_0
++) {
1008 if (asprintf(&idx_0
, "[%d]", cntr_sids_0
) != -1) {
1009 ndr_print_ptr(ndr
, "sids", r
->sids
[cntr_sids_0
]);
1011 if (r
->sids
[cntr_sids_0
]) {
1012 ndr_print_dom_sid(ndr
, "sids", r
->sids
[cntr_sids_0
]);
1019 ndr_print_udlong(ndr
, "privilege_mask", r
->privilege_mask
);
1020 ndr_print_ptr(ndr
, "default_dacl", r
->default_dacl
);
1022 if (r
->default_dacl
) {
1023 ndr_print_security_acl(ndr
, "default_dacl", r
->default_dacl
);
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
)
1038 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &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
);
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
);
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
)
1068 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &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
);
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
);
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
)
1094 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &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
);
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
);