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_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_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
);
96 case SEC_ACE_OBJECT_TYPE_PRESENT
: {
97 NDR_CHECK(ndr_push_GUID(ndr
, NDR_SCALARS
, &r
->type
));
105 if (ndr_flags
& NDR_BUFFERS
) {
106 int level
= ndr_push_get_switch_value(ndr
, r
);
108 case SEC_ACE_OBJECT_TYPE_PRESENT
:
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
)
122 level
= ndr_pull_get_switch_value(ndr
, r
);
123 if (ndr_flags
& NDR_SCALARS
) {
125 case SEC_ACE_OBJECT_TYPE_PRESENT
: {
126 NDR_CHECK(ndr_pull_GUID(ndr
, NDR_SCALARS
, &r
->type
));
134 if (ndr_flags
& NDR_BUFFERS
) {
136 case SEC_ACE_OBJECT_TYPE_PRESENT
:
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
)
150 level
= ndr_print_get_switch_value(ndr
, r
);
151 ndr_print_union(ndr
, name
, level
, "security_ace_object_type");
153 case SEC_ACE_OBJECT_TYPE_PRESENT
:
154 ndr_print_GUID(ndr
, "type", &r
->type
);
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
);
168 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT
: {
169 NDR_CHECK(ndr_push_GUID(ndr
, NDR_SCALARS
, &r
->inherited_type
));
177 if (ndr_flags
& NDR_BUFFERS
) {
178 int level
= ndr_push_get_switch_value(ndr
, r
);
180 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT
:
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
)
194 level
= ndr_pull_get_switch_value(ndr
, r
);
195 if (ndr_flags
& NDR_SCALARS
) {
197 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT
: {
198 NDR_CHECK(ndr_pull_GUID(ndr
, NDR_SCALARS
, &r
->inherited_type
));
206 if (ndr_flags
& NDR_BUFFERS
) {
208 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT
:
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
)
222 level
= ndr_print_get_switch_value(ndr
, r
);
223 ndr_print_union(ndr
, name
, level
, "security_ace_object_inherited_type");
225 case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT
:
226 ndr_print_GUID(ndr
, "inherited_type", &r
->inherited_type
);
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");
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
);
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
);
286 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT
: {
287 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
290 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT
: {
291 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
294 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT
: {
295 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
298 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT
: {
299 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
307 if (ndr_flags
& NDR_BUFFERS
) {
308 int level
= ndr_push_get_switch_value(ndr
, r
);
310 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT
:
311 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
314 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT
:
315 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
318 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT
:
319 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
322 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT
:
323 NDR_CHECK(ndr_push_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
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
)
337 level
= ndr_pull_get_switch_value(ndr
, r
);
338 if (ndr_flags
& NDR_SCALARS
) {
340 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT
: {
341 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
344 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT
: {
345 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
348 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT
: {
349 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
352 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT
: {
353 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_SCALARS
, &r
->object
));
361 if (ndr_flags
& NDR_BUFFERS
) {
363 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT
:
364 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
367 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT
:
368 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
371 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT
:
372 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
375 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT
:
376 NDR_CHECK(ndr_pull_security_ace_object(ndr
, NDR_BUFFERS
, &r
->object
));
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
)
390 level
= ndr_print_get_switch_value(ndr
, r
);
391 ndr_print_union(ndr
, name
, level
, "security_ace_object_ctr");
393 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT
:
394 ndr_print_security_ace_object(ndr
, "object", &r
->object
);
397 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT
:
398 ndr_print_security_ace_object(ndr
, "object", &r
->object
);
401 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT
:
402 ndr_print_security_ace_object(ndr
, "object", &r
->object
);
405 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT
:
406 ndr_print_security_ace_object(ndr
, "object", &r
->object
);
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");
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
);
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
)
456 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &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
;
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");
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
);
533 for (cntr_aces_0
=0;cntr_aces_0
<r
->num_aces
;cntr_aces_0
++) {
535 if (asprintf(&idx_0
, "[%d]", cntr_aces_0
) != -1) {
536 ndr_print_security_ace(ndr
, "aces", &r
->aces
[cntr_aces_0
]);
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
)
553 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &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
;
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
)
577 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &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
);
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
);
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
) {
621 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->owner_sid
));
622 NDR_CHECK(ndr_push_dom_sid(ndr
, NDR_SCALARS
, r
->owner_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
));
629 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->sacl
));
630 NDR_CHECK(ndr_push_security_acl(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->sacl
));
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
;
649 TALLOC_CTX
*_mem_save_sacl_0
;
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
));
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
));
673 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_sacl
));
675 NDR_PULL_ALLOC(ndr
, r
->sacl
);
676 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->sacl
, _ptr_sacl
));
680 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_dacl
));
682 NDR_PULL_ALLOC(ndr
, r
->dacl
);
683 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->dacl
, _ptr_dacl
));
688 if (ndr_flags
& NDR_BUFFERS
) {
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
;
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
;
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
;
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
);
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
);
747 ndr_print_dom_sid(ndr
, "owner_sid", r
->owner_sid
);
750 ndr_print_ptr(ndr
, "group_sid", r
->group_sid
);
753 ndr_print_dom_sid(ndr
, "group_sid", r
->group_sid
);
756 ndr_print_ptr(ndr
, "sacl", r
->sacl
);
759 ndr_print_security_acl(ndr
, "sacl", r
->sacl
);
762 ndr_print_ptr(ndr
, "dacl", r
->dacl
);
765 ndr_print_security_acl(ndr
, "dacl", r
->dacl
);
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
) {
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
)
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
));
805 NDR_PULL_ALLOC(ndr
, r
->sd
);
810 if (ndr_flags
& NDR_BUFFERS
) {
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");
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
);
834 ndr_print_security_descriptor(ndr
, "sd", r
->sd
);
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
));
853 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->default_dacl
));
855 if (ndr_flags
& NDR_BUFFERS
) {
857 NDR_CHECK(ndr_push_dom_sid(ndr
, NDR_SCALARS
, r
->user_sid
));
860 NDR_CHECK(ndr_push_dom_sid(ndr
, NDR_SCALARS
, r
->group_sid
));
862 for (cntr_sids_0
= 0; cntr_sids_0
< r
->num_sids
; cntr_sids_0
++) {
863 if (r
->sids
[cntr_sids_0
]) {
864 NDR_CHECK(ndr_push_dom_sid(ndr
, NDR_SCALARS
, r
->sids
[cntr_sids_0
]));
867 if (r
->default_dacl
) {
868 NDR_CHECK(ndr_push_security_acl(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->default_dacl
));
871 return NDR_ERR_SUCCESS
;
874 _PUBLIC_
enum ndr_err_code
ndr_pull_security_token(struct ndr_pull
*ndr
, int ndr_flags
, struct security_token
*r
)
876 uint32_t _ptr_user_sid
;
877 TALLOC_CTX
*_mem_save_user_sid_0
;
878 uint32_t _ptr_group_sid
;
879 TALLOC_CTX
*_mem_save_group_sid_0
;
881 uint32_t cntr_sids_0
;
882 TALLOC_CTX
*_mem_save_sids_0
;
883 TALLOC_CTX
*_mem_save_sids_1
;
884 uint32_t _ptr_default_dacl
;
885 TALLOC_CTX
*_mem_save_default_dacl_0
;
886 if (ndr_flags
& NDR_SCALARS
) {
887 NDR_CHECK(ndr_pull_align(ndr
, 4));
888 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_user_sid
));
890 NDR_PULL_ALLOC(ndr
, r
->user_sid
);
894 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_group_sid
));
895 if (_ptr_group_sid
) {
896 NDR_PULL_ALLOC(ndr
, r
->group_sid
);
900 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->num_sids
));
901 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->sids
));
902 NDR_PULL_ALLOC_N(ndr
, r
->sids
, ndr_get_array_size(ndr
, &r
->sids
));
903 _mem_save_sids_0
= NDR_PULL_GET_MEM_CTX(ndr
);
904 NDR_PULL_SET_MEM_CTX(ndr
, r
->sids
, 0);
905 for (cntr_sids_0
= 0; cntr_sids_0
< r
->num_sids
; cntr_sids_0
++) {
906 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_sids
));
908 NDR_PULL_ALLOC(ndr
, r
->sids
[cntr_sids_0
]);
910 r
->sids
[cntr_sids_0
] = NULL
;
913 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_sids_0
, 0);
914 NDR_CHECK(ndr_pull_udlong(ndr
, NDR_SCALARS
, &r
->privilege_mask
));
915 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_default_dacl
));
916 if (_ptr_default_dacl
) {
917 NDR_PULL_ALLOC(ndr
, r
->default_dacl
);
919 r
->default_dacl
= NULL
;
922 NDR_CHECK(ndr_check_array_size(ndr
, (void*)&r
->sids
, r
->num_sids
));
925 if (ndr_flags
& NDR_BUFFERS
) {
927 _mem_save_user_sid_0
= NDR_PULL_GET_MEM_CTX(ndr
);
928 NDR_PULL_SET_MEM_CTX(ndr
, r
->user_sid
, 0);
929 NDR_CHECK(ndr_pull_dom_sid(ndr
, NDR_SCALARS
, r
->user_sid
));
930 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_user_sid_0
, 0);
933 _mem_save_group_sid_0
= NDR_PULL_GET_MEM_CTX(ndr
);
934 NDR_PULL_SET_MEM_CTX(ndr
, r
->group_sid
, 0);
935 NDR_CHECK(ndr_pull_dom_sid(ndr
, NDR_SCALARS
, r
->group_sid
));
936 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_group_sid_0
, 0);
938 _mem_save_sids_0
= NDR_PULL_GET_MEM_CTX(ndr
);
939 NDR_PULL_SET_MEM_CTX(ndr
, r
->sids
, 0);
940 for (cntr_sids_0
= 0; cntr_sids_0
< r
->num_sids
; cntr_sids_0
++) {
941 if (r
->sids
[cntr_sids_0
]) {
942 _mem_save_sids_1
= NDR_PULL_GET_MEM_CTX(ndr
);
943 NDR_PULL_SET_MEM_CTX(ndr
, r
->sids
[cntr_sids_0
], 0);
944 NDR_CHECK(ndr_pull_dom_sid(ndr
, NDR_SCALARS
, r
->sids
[cntr_sids_0
]));
945 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_sids_1
, 0);
948 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_sids_0
, 0);
949 if (r
->default_dacl
) {
950 _mem_save_default_dacl_0
= NDR_PULL_GET_MEM_CTX(ndr
);
951 NDR_PULL_SET_MEM_CTX(ndr
, r
->default_dacl
, 0);
952 NDR_CHECK(ndr_pull_security_acl(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->default_dacl
));
953 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_default_dacl_0
, 0);
956 return NDR_ERR_SUCCESS
;
959 _PUBLIC_
void ndr_print_security_token(struct ndr_print
*ndr
, const char *name
, const struct security_token
*r
)
961 uint32_t cntr_sids_0
;
962 ndr_print_struct(ndr
, name
, "security_token");
964 ndr_print_ptr(ndr
, "user_sid", r
->user_sid
);
967 ndr_print_dom_sid(ndr
, "user_sid", r
->user_sid
);
970 ndr_print_ptr(ndr
, "group_sid", r
->group_sid
);
973 ndr_print_dom_sid(ndr
, "group_sid", r
->group_sid
);
976 ndr_print_uint32(ndr
, "num_sids", r
->num_sids
);
977 ndr
->print(ndr
, "%s: ARRAY(%d)", "sids", (int)r
->num_sids
);
979 for (cntr_sids_0
=0;cntr_sids_0
<r
->num_sids
;cntr_sids_0
++) {
981 if (asprintf(&idx_0
, "[%d]", cntr_sids_0
) != -1) {
982 ndr_print_ptr(ndr
, "sids", r
->sids
[cntr_sids_0
]);
984 if (r
->sids
[cntr_sids_0
]) {
985 ndr_print_dom_sid(ndr
, "sids", r
->sids
[cntr_sids_0
]);
992 ndr_print_udlong(ndr
, "privilege_mask", r
->privilege_mask
);
993 ndr_print_ptr(ndr
, "default_dacl", r
->default_dacl
);
995 if (r
->default_dacl
) {
996 ndr_print_security_acl(ndr
, "default_dacl", r
->default_dacl
);
1002 _PUBLIC_
enum ndr_err_code
ndr_push_security_secinfo(struct ndr_push
*ndr
, int ndr_flags
, uint32_t r
)
1004 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
));
1005 return NDR_ERR_SUCCESS
;
1008 _PUBLIC_
enum ndr_err_code
ndr_pull_security_secinfo(struct ndr_pull
*ndr
, int ndr_flags
, uint32_t *r
)
1011 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &v
));
1013 return NDR_ERR_SUCCESS
;
1016 _PUBLIC_
void ndr_print_security_secinfo(struct ndr_print
*ndr
, const char *name
, uint32_t r
)
1018 ndr_print_uint32(ndr
, name
, r
);
1020 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_OWNER", SECINFO_OWNER
, r
);
1021 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_GROUP", SECINFO_GROUP
, r
);
1022 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_DACL", SECINFO_DACL
, r
);
1023 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_SACL", SECINFO_SACL
, r
);
1024 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_UNPROTECTED_SACL", SECINFO_UNPROTECTED_SACL
, r
);
1025 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_UNPROTECTED_DACL", SECINFO_UNPROTECTED_DACL
, r
);
1026 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_PROTECTED_SACL", SECINFO_PROTECTED_SACL
, r
);
1027 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_PROTECTED_DACL", SECINFO_PROTECTED_DACL
, r
);
1031 _PUBLIC_
enum ndr_err_code
ndr_push_kerb_EncTypes(struct ndr_push
*ndr
, int ndr_flags
, uint32_t r
)
1033 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
));
1034 return NDR_ERR_SUCCESS
;
1037 _PUBLIC_
enum ndr_err_code
ndr_pull_kerb_EncTypes(struct ndr_pull
*ndr
, int ndr_flags
, uint32_t *r
)
1040 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &v
));
1042 return NDR_ERR_SUCCESS
;
1045 _PUBLIC_
void ndr_print_kerb_EncTypes(struct ndr_print
*ndr
, const char *name
, uint32_t r
)
1047 ndr_print_uint32(ndr
, name
, r
);
1049 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "KERB_ENCTYPE_DES_CBC_CRC", KERB_ENCTYPE_DES_CBC_CRC
, r
);
1050 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "KERB_ENCTYPE_DES_CBC_MD5", KERB_ENCTYPE_DES_CBC_MD5
, r
);
1051 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "KERB_ENCTYPE_RC4_HMAC_MD5", KERB_ENCTYPE_RC4_HMAC_MD5
, r
);
1052 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96", KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96
, r
);
1053 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96", KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96
, r
);
1057 _PUBLIC_
enum ndr_err_code
ndr_push_security_autoinherit(struct ndr_push
*ndr
, int ndr_flags
, uint32_t r
)
1059 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
));
1060 return NDR_ERR_SUCCESS
;
1063 _PUBLIC_
enum ndr_err_code
ndr_pull_security_autoinherit(struct ndr_pull
*ndr
, int ndr_flags
, uint32_t *r
)
1066 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &v
));
1068 return NDR_ERR_SUCCESS
;
1071 _PUBLIC_
void ndr_print_security_autoinherit(struct ndr_print
*ndr
, const char *name
, uint32_t r
)
1073 ndr_print_uint32(ndr
, name
, r
);
1075 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SEC_DACL_AUTO_INHERIT", SEC_DACL_AUTO_INHERIT
, r
);
1076 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SEC_SACL_AUTO_INHERIT", SEC_SACL_AUTO_INHERIT
, r
);
1077 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SEC_DEFAULT_DESCRIPTOR", SEC_DEFAULT_DESCRIPTOR
, r
);
1078 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SEC_OWNER_FROM_PARENT", SEC_OWNER_FROM_PARENT
, r
);
1079 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SEC_GROUP_FROM_PARENT", SEC_GROUP_FROM_PARENT
, r
);