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 cntr_aces_0
;
505 TALLOC_CTX
*_mem_save_aces_0
;
506 if (ndr_flags
& NDR_SCALARS
) {
507 NDR_CHECK(ndr_pull_align(ndr
, 4));
508 NDR_CHECK(ndr_pull_security_acl_revision(ndr
, NDR_SCALARS
, &r
->revision
));
509 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->size
));
510 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->num_aces
));
511 if (r
->num_aces
> 1000) {
512 return ndr_pull_error(ndr
, NDR_ERR_RANGE
, "value out of range");
514 NDR_PULL_ALLOC_N(ndr
, r
->aces
, r
->num_aces
);
515 _mem_save_aces_0
= NDR_PULL_GET_MEM_CTX(ndr
);
516 NDR_PULL_SET_MEM_CTX(ndr
, r
->aces
, 0);
517 for (cntr_aces_0
= 0; cntr_aces_0
< r
->num_aces
; cntr_aces_0
++) {
518 NDR_CHECK(ndr_pull_security_ace(ndr
, NDR_SCALARS
, &r
->aces
[cntr_aces_0
]));
520 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_aces_0
, 0);
521 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
523 if (ndr_flags
& NDR_BUFFERS
) {
524 _mem_save_aces_0
= NDR_PULL_GET_MEM_CTX(ndr
);
525 NDR_PULL_SET_MEM_CTX(ndr
, r
->aces
, 0);
526 for (cntr_aces_0
= 0; cntr_aces_0
< r
->num_aces
; cntr_aces_0
++) {
527 NDR_CHECK(ndr_pull_security_ace(ndr
, NDR_BUFFERS
, &r
->aces
[cntr_aces_0
]));
529 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_aces_0
, 0);
531 return NDR_ERR_SUCCESS
;
534 _PUBLIC_
void ndr_print_security_acl(struct ndr_print
*ndr
, const char *name
, const struct security_acl
*r
)
536 uint32_t cntr_aces_0
;
537 ndr_print_struct(ndr
, name
, "security_acl");
539 ndr_print_security_acl_revision(ndr
, "revision", r
->revision
);
540 ndr_print_uint16(ndr
, "size", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?ndr_size_security_acl(r
, ndr
->iconv_convenience
, ndr
->flags
):r
->size
);
541 ndr_print_uint32(ndr
, "num_aces", r
->num_aces
);
542 ndr
->print(ndr
, "%s: ARRAY(%d)", "aces", (int)r
->num_aces
);
544 for (cntr_aces_0
=0;cntr_aces_0
<r
->num_aces
;cntr_aces_0
++) {
546 if (asprintf(&idx_0
, "[%d]", cntr_aces_0
) != -1) {
547 ndr_print_security_ace(ndr
, "aces", &r
->aces
[cntr_aces_0
]);
555 static enum ndr_err_code
ndr_push_security_descriptor_revision(struct ndr_push
*ndr
, int ndr_flags
, enum security_descriptor_revision r
)
557 NDR_CHECK(ndr_push_enum_uint8(ndr
, NDR_SCALARS
, r
));
558 return NDR_ERR_SUCCESS
;
561 static enum ndr_err_code
ndr_pull_security_descriptor_revision(struct ndr_pull
*ndr
, int ndr_flags
, enum security_descriptor_revision
*r
)
564 NDR_CHECK(ndr_pull_enum_uint8(ndr
, NDR_SCALARS
, &v
));
566 return NDR_ERR_SUCCESS
;
569 _PUBLIC_
void ndr_print_security_descriptor_revision(struct ndr_print
*ndr
, const char *name
, enum security_descriptor_revision r
)
571 const char *val
= NULL
;
574 case SECURITY_DESCRIPTOR_REVISION_1
: val
= "SECURITY_DESCRIPTOR_REVISION_1"; break;
576 ndr_print_enum(ndr
, name
, "ENUM", val
, r
);
579 static enum ndr_err_code
ndr_push_security_descriptor_type(struct ndr_push
*ndr
, int ndr_flags
, uint16_t r
)
581 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
));
582 return NDR_ERR_SUCCESS
;
585 static enum ndr_err_code
ndr_pull_security_descriptor_type(struct ndr_pull
*ndr
, int ndr_flags
, uint16_t *r
)
588 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &v
));
590 return NDR_ERR_SUCCESS
;
593 _PUBLIC_
void ndr_print_security_descriptor_type(struct ndr_print
*ndr
, const char *name
, uint16_t r
)
595 ndr_print_uint16(ndr
, name
, r
);
597 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_OWNER_DEFAULTED", SEC_DESC_OWNER_DEFAULTED
, r
);
598 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_GROUP_DEFAULTED", SEC_DESC_GROUP_DEFAULTED
, r
);
599 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_DACL_PRESENT", SEC_DESC_DACL_PRESENT
, r
);
600 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_DACL_DEFAULTED", SEC_DESC_DACL_DEFAULTED
, r
);
601 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_SACL_PRESENT", SEC_DESC_SACL_PRESENT
, r
);
602 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_SACL_DEFAULTED", SEC_DESC_SACL_DEFAULTED
, r
);
603 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_DACL_TRUSTED", SEC_DESC_DACL_TRUSTED
, r
);
604 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_SERVER_SECURITY", SEC_DESC_SERVER_SECURITY
, r
);
605 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERIT_REQ", SEC_DESC_DACL_AUTO_INHERIT_REQ
, r
);
606 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERIT_REQ", SEC_DESC_SACL_AUTO_INHERIT_REQ
, r
);
607 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERITED", SEC_DESC_DACL_AUTO_INHERITED
, r
);
608 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERITED", SEC_DESC_SACL_AUTO_INHERITED
, r
);
609 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_DACL_PROTECTED", SEC_DESC_DACL_PROTECTED
, r
);
610 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_SACL_PROTECTED", SEC_DESC_SACL_PROTECTED
, r
);
611 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_RM_CONTROL_VALID", SEC_DESC_RM_CONTROL_VALID
, r
);
612 ndr_print_bitmap_flag(ndr
, sizeof(uint16_t), "SEC_DESC_SELF_RELATIVE", SEC_DESC_SELF_RELATIVE
, r
);
616 _PUBLIC_
enum ndr_err_code
ndr_push_security_descriptor(struct ndr_push
*ndr
, int ndr_flags
, const struct security_descriptor
*r
)
619 uint32_t _flags_save_STRUCT
= ndr
->flags
;
620 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_LITTLE_ENDIAN
);
621 if (ndr_flags
& NDR_SCALARS
) {
622 NDR_CHECK(ndr_push_align(ndr
, 5));
623 NDR_CHECK(ndr_push_security_descriptor_revision(ndr
, NDR_SCALARS
, r
->revision
));
624 NDR_CHECK(ndr_push_security_descriptor_type(ndr
, NDR_SCALARS
, r
->type
));
625 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->owner_sid
));
626 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->group_sid
));
627 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->sacl
));
628 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->dacl
));
629 NDR_CHECK(ndr_push_trailer_align(ndr
, 5));
631 if (ndr_flags
& NDR_BUFFERS
) {
633 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->owner_sid
));
634 NDR_CHECK(ndr_push_dom_sid(ndr
, NDR_SCALARS
, r
->owner_sid
));
637 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->group_sid
));
638 NDR_CHECK(ndr_push_dom_sid(ndr
, NDR_SCALARS
, r
->group_sid
));
641 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->sacl
));
642 NDR_CHECK(ndr_push_security_acl(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->sacl
));
645 NDR_CHECK(ndr_push_relative_ptr2(ndr
, r
->dacl
));
646 NDR_CHECK(ndr_push_security_acl(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->dacl
));
649 ndr
->flags
= _flags_save_STRUCT
;
651 return NDR_ERR_SUCCESS
;
654 _PUBLIC_
enum ndr_err_code
ndr_pull_security_descriptor(struct ndr_pull
*ndr
, int ndr_flags
, struct security_descriptor
*r
)
656 uint32_t _ptr_owner_sid
;
657 TALLOC_CTX
*_mem_save_owner_sid_0
;
658 uint32_t _ptr_group_sid
;
659 TALLOC_CTX
*_mem_save_group_sid_0
;
661 TALLOC_CTX
*_mem_save_sacl_0
;
663 TALLOC_CTX
*_mem_save_dacl_0
;
665 uint32_t _flags_save_STRUCT
= ndr
->flags
;
666 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_LITTLE_ENDIAN
);
667 if (ndr_flags
& NDR_SCALARS
) {
668 NDR_CHECK(ndr_pull_align(ndr
, 5));
669 NDR_CHECK(ndr_pull_security_descriptor_revision(ndr
, NDR_SCALARS
, &r
->revision
));
670 NDR_CHECK(ndr_pull_security_descriptor_type(ndr
, NDR_SCALARS
, &r
->type
));
671 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_owner_sid
));
672 if (_ptr_owner_sid
) {
673 NDR_PULL_ALLOC(ndr
, r
->owner_sid
);
674 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->owner_sid
, _ptr_owner_sid
));
678 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_group_sid
));
679 if (_ptr_group_sid
) {
680 NDR_PULL_ALLOC(ndr
, r
->group_sid
);
681 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->group_sid
, _ptr_group_sid
));
685 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_sacl
));
687 NDR_PULL_ALLOC(ndr
, r
->sacl
);
688 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->sacl
, _ptr_sacl
));
692 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_dacl
));
694 NDR_PULL_ALLOC(ndr
, r
->dacl
);
695 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->dacl
, _ptr_dacl
));
699 NDR_CHECK(ndr_pull_trailer_align(ndr
, 5));
701 if (ndr_flags
& NDR_BUFFERS
) {
703 uint32_t _relative_save_offset
;
704 _relative_save_offset
= ndr
->offset
;
705 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->owner_sid
));
706 _mem_save_owner_sid_0
= NDR_PULL_GET_MEM_CTX(ndr
);
707 NDR_PULL_SET_MEM_CTX(ndr
, r
->owner_sid
, 0);
708 NDR_CHECK(ndr_pull_dom_sid(ndr
, NDR_SCALARS
, r
->owner_sid
));
709 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_owner_sid_0
, 0);
710 if (ndr
->offset
> ndr
->relative_highest_offset
) {
711 ndr
->relative_highest_offset
= ndr
->offset
;
713 ndr
->offset
= _relative_save_offset
;
716 uint32_t _relative_save_offset
;
717 _relative_save_offset
= ndr
->offset
;
718 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->group_sid
));
719 _mem_save_group_sid_0
= NDR_PULL_GET_MEM_CTX(ndr
);
720 NDR_PULL_SET_MEM_CTX(ndr
, r
->group_sid
, 0);
721 NDR_CHECK(ndr_pull_dom_sid(ndr
, NDR_SCALARS
, r
->group_sid
));
722 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_group_sid_0
, 0);
723 if (ndr
->offset
> ndr
->relative_highest_offset
) {
724 ndr
->relative_highest_offset
= ndr
->offset
;
726 ndr
->offset
= _relative_save_offset
;
729 uint32_t _relative_save_offset
;
730 _relative_save_offset
= ndr
->offset
;
731 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->sacl
));
732 _mem_save_sacl_0
= NDR_PULL_GET_MEM_CTX(ndr
);
733 NDR_PULL_SET_MEM_CTX(ndr
, r
->sacl
, 0);
734 NDR_CHECK(ndr_pull_security_acl(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->sacl
));
735 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_sacl_0
, 0);
736 if (ndr
->offset
> ndr
->relative_highest_offset
) {
737 ndr
->relative_highest_offset
= ndr
->offset
;
739 ndr
->offset
= _relative_save_offset
;
742 uint32_t _relative_save_offset
;
743 _relative_save_offset
= ndr
->offset
;
744 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->dacl
));
745 _mem_save_dacl_0
= NDR_PULL_GET_MEM_CTX(ndr
);
746 NDR_PULL_SET_MEM_CTX(ndr
, r
->dacl
, 0);
747 NDR_CHECK(ndr_pull_security_acl(ndr
, NDR_SCALARS
|NDR_BUFFERS
, r
->dacl
));
748 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_dacl_0
, 0);
749 if (ndr
->offset
> ndr
->relative_highest_offset
) {
750 ndr
->relative_highest_offset
= ndr
->offset
;
752 ndr
->offset
= _relative_save_offset
;
755 ndr
->flags
= _flags_save_STRUCT
;
757 return NDR_ERR_SUCCESS
;
760 _PUBLIC_
void ndr_print_security_descriptor(struct ndr_print
*ndr
, const char *name
, const struct security_descriptor
*r
)
762 ndr_print_struct(ndr
, name
, "security_descriptor");
764 uint32_t _flags_save_STRUCT
= ndr
->flags
;
765 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_LITTLE_ENDIAN
);
767 ndr_print_security_descriptor_revision(ndr
, "revision", r
->revision
);
768 ndr_print_security_descriptor_type(ndr
, "type", r
->type
);
769 ndr_print_ptr(ndr
, "owner_sid", r
->owner_sid
);
772 ndr_print_dom_sid(ndr
, "owner_sid", r
->owner_sid
);
775 ndr_print_ptr(ndr
, "group_sid", r
->group_sid
);
778 ndr_print_dom_sid(ndr
, "group_sid", r
->group_sid
);
781 ndr_print_ptr(ndr
, "sacl", r
->sacl
);
784 ndr_print_security_acl(ndr
, "sacl", r
->sacl
);
787 ndr_print_ptr(ndr
, "dacl", r
->dacl
);
790 ndr_print_security_acl(ndr
, "dacl", r
->dacl
);
794 ndr
->flags
= _flags_save_STRUCT
;
798 _PUBLIC_
enum ndr_err_code
ndr_push_sec_desc_buf(struct ndr_push
*ndr
, int ndr_flags
, const struct sec_desc_buf
*r
)
800 if (ndr_flags
& NDR_SCALARS
) {
801 NDR_CHECK(ndr_push_align(ndr
, 5));
802 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, ndr_size_security_descriptor(r
->sd
, ndr
->iconv_convenience
, ndr
->flags
)));
803 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->sd
));
804 NDR_CHECK(ndr_push_trailer_align(ndr
, 5));
806 if (ndr_flags
& NDR_BUFFERS
) {
809 struct ndr_push
*_ndr_sd
;
810 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_sd
, 4, -1));
811 NDR_CHECK(ndr_push_security_descriptor(_ndr_sd
, NDR_SCALARS
|NDR_BUFFERS
, r
->sd
));
812 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_sd
, 4, -1));
816 return NDR_ERR_SUCCESS
;
819 _PUBLIC_
enum ndr_err_code
ndr_pull_sec_desc_buf(struct ndr_pull
*ndr
, int ndr_flags
, struct sec_desc_buf
*r
)
822 TALLOC_CTX
*_mem_save_sd_0
;
823 if (ndr_flags
& NDR_SCALARS
) {
824 NDR_CHECK(ndr_pull_align(ndr
, 5));
825 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->sd_size
));
826 if (r
->sd_size
> 0x40000) {
827 return ndr_pull_error(ndr
, NDR_ERR_RANGE
, "value out of range");
829 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_sd
));
831 NDR_PULL_ALLOC(ndr
, r
->sd
);
835 NDR_CHECK(ndr_pull_trailer_align(ndr
, 5));
837 if (ndr_flags
& NDR_BUFFERS
) {
839 _mem_save_sd_0
= NDR_PULL_GET_MEM_CTX(ndr
);
840 NDR_PULL_SET_MEM_CTX(ndr
, r
->sd
, 0);
842 struct ndr_pull
*_ndr_sd
;
843 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_sd
, 4, -1));
844 NDR_CHECK(ndr_pull_security_descriptor(_ndr_sd
, NDR_SCALARS
|NDR_BUFFERS
, r
->sd
));
845 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_sd
, 4, -1));
847 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_sd_0
, 0);
850 return NDR_ERR_SUCCESS
;
853 _PUBLIC_
void ndr_print_sec_desc_buf(struct ndr_print
*ndr
, const char *name
, const struct sec_desc_buf
*r
)
855 ndr_print_struct(ndr
, name
, "sec_desc_buf");
857 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
);
858 ndr_print_ptr(ndr
, "sd", r
->sd
);
861 ndr_print_security_descriptor(ndr
, "sd", r
->sd
);
867 _PUBLIC_
enum ndr_err_code
ndr_push_security_token(struct ndr_push
*ndr
, int ndr_flags
, const struct security_token
*r
)
869 uint32_t cntr_sids_0
;
870 if (ndr_flags
& NDR_SCALARS
) {
871 NDR_CHECK(ndr_push_align(ndr
, 5));
872 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->user_sid
));
873 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->group_sid
));
874 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->num_sids
));
875 NDR_CHECK(ndr_push_uint3264(ndr
, NDR_SCALARS
, r
->num_sids
));
876 for (cntr_sids_0
= 0; cntr_sids_0
< r
->num_sids
; cntr_sids_0
++) {
877 NDR_CHECK(ndr_push_unique_ptr(ndr
, r
->sids
[cntr_sids_0
]));
879 NDR_CHECK(ndr_push_udlong(ndr
, NDR_SCALARS
, r
->privilege_mask
));
880 NDR_CHECK(ndr_push_trailer_align(ndr
, 5));
882 if (ndr_flags
& NDR_BUFFERS
) {
884 NDR_CHECK(ndr_push_dom_sid(ndr
, NDR_SCALARS
, r
->user_sid
));
887 NDR_CHECK(ndr_push_dom_sid(ndr
, NDR_SCALARS
, r
->group_sid
));
889 for (cntr_sids_0
= 0; cntr_sids_0
< r
->num_sids
; cntr_sids_0
++) {
890 if (r
->sids
[cntr_sids_0
]) {
891 NDR_CHECK(ndr_push_dom_sid(ndr
, NDR_SCALARS
, r
->sids
[cntr_sids_0
]));
895 return NDR_ERR_SUCCESS
;
898 _PUBLIC_
enum ndr_err_code
ndr_pull_security_token(struct ndr_pull
*ndr
, int ndr_flags
, struct security_token
*r
)
900 uint32_t _ptr_user_sid
;
901 TALLOC_CTX
*_mem_save_user_sid_0
;
902 uint32_t _ptr_group_sid
;
903 TALLOC_CTX
*_mem_save_group_sid_0
;
905 uint32_t cntr_sids_0
;
906 TALLOC_CTX
*_mem_save_sids_0
;
907 TALLOC_CTX
*_mem_save_sids_1
;
908 if (ndr_flags
& NDR_SCALARS
) {
909 NDR_CHECK(ndr_pull_align(ndr
, 5));
910 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_user_sid
));
912 NDR_PULL_ALLOC(ndr
, r
->user_sid
);
916 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_group_sid
));
917 if (_ptr_group_sid
) {
918 NDR_PULL_ALLOC(ndr
, r
->group_sid
);
922 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->num_sids
));
923 NDR_CHECK(ndr_pull_array_size(ndr
, &r
->sids
));
924 NDR_PULL_ALLOC_N(ndr
, r
->sids
, ndr_get_array_size(ndr
, &r
->sids
));
925 _mem_save_sids_0
= NDR_PULL_GET_MEM_CTX(ndr
);
926 NDR_PULL_SET_MEM_CTX(ndr
, r
->sids
, 0);
927 for (cntr_sids_0
= 0; cntr_sids_0
< r
->num_sids
; cntr_sids_0
++) {
928 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_sids
));
930 NDR_PULL_ALLOC(ndr
, r
->sids
[cntr_sids_0
]);
932 r
->sids
[cntr_sids_0
] = NULL
;
935 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_sids_0
, 0);
936 NDR_CHECK(ndr_pull_udlong(ndr
, NDR_SCALARS
, &r
->privilege_mask
));
938 NDR_CHECK(ndr_check_array_size(ndr
, (void*)&r
->sids
, r
->num_sids
));
940 NDR_CHECK(ndr_pull_trailer_align(ndr
, 5));
942 if (ndr_flags
& NDR_BUFFERS
) {
944 _mem_save_user_sid_0
= NDR_PULL_GET_MEM_CTX(ndr
);
945 NDR_PULL_SET_MEM_CTX(ndr
, r
->user_sid
, 0);
946 NDR_CHECK(ndr_pull_dom_sid(ndr
, NDR_SCALARS
, r
->user_sid
));
947 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_user_sid_0
, 0);
950 _mem_save_group_sid_0
= NDR_PULL_GET_MEM_CTX(ndr
);
951 NDR_PULL_SET_MEM_CTX(ndr
, r
->group_sid
, 0);
952 NDR_CHECK(ndr_pull_dom_sid(ndr
, NDR_SCALARS
, r
->group_sid
));
953 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_group_sid_0
, 0);
955 _mem_save_sids_0
= NDR_PULL_GET_MEM_CTX(ndr
);
956 NDR_PULL_SET_MEM_CTX(ndr
, r
->sids
, 0);
957 for (cntr_sids_0
= 0; cntr_sids_0
< r
->num_sids
; cntr_sids_0
++) {
958 if (r
->sids
[cntr_sids_0
]) {
959 _mem_save_sids_1
= NDR_PULL_GET_MEM_CTX(ndr
);
960 NDR_PULL_SET_MEM_CTX(ndr
, r
->sids
[cntr_sids_0
], 0);
961 NDR_CHECK(ndr_pull_dom_sid(ndr
, NDR_SCALARS
, r
->sids
[cntr_sids_0
]));
962 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_sids_1
, 0);
965 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_sids_0
, 0);
967 return NDR_ERR_SUCCESS
;
970 _PUBLIC_
void ndr_print_security_token(struct ndr_print
*ndr
, const char *name
, const struct security_token
*r
)
972 uint32_t cntr_sids_0
;
973 ndr_print_struct(ndr
, name
, "security_token");
975 ndr_print_ptr(ndr
, "user_sid", r
->user_sid
);
978 ndr_print_dom_sid(ndr
, "user_sid", r
->user_sid
);
981 ndr_print_ptr(ndr
, "group_sid", r
->group_sid
);
984 ndr_print_dom_sid(ndr
, "group_sid", r
->group_sid
);
987 ndr_print_uint32(ndr
, "num_sids", r
->num_sids
);
988 ndr
->print(ndr
, "%s: ARRAY(%d)", "sids", (int)r
->num_sids
);
990 for (cntr_sids_0
=0;cntr_sids_0
<r
->num_sids
;cntr_sids_0
++) {
992 if (asprintf(&idx_0
, "[%d]", cntr_sids_0
) != -1) {
993 ndr_print_ptr(ndr
, "sids", r
->sids
[cntr_sids_0
]);
995 if (r
->sids
[cntr_sids_0
]) {
996 ndr_print_dom_sid(ndr
, "sids", r
->sids
[cntr_sids_0
]);
1003 ndr_print_udlong(ndr
, "privilege_mask", r
->privilege_mask
);
1007 _PUBLIC_
enum ndr_err_code
ndr_push_security_secinfo(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_security_secinfo(struct ndr_pull
*ndr
, int ndr_flags
, uint32_t *r
)
1016 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &v
));
1018 return NDR_ERR_SUCCESS
;
1021 _PUBLIC_
void ndr_print_security_secinfo(struct ndr_print
*ndr
, const char *name
, uint32_t r
)
1023 ndr_print_uint32(ndr
, name
, r
);
1025 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_OWNER", SECINFO_OWNER
, r
);
1026 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_GROUP", SECINFO_GROUP
, r
);
1027 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_DACL", SECINFO_DACL
, r
);
1028 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_SACL", SECINFO_SACL
, r
);
1029 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_UNPROTECTED_SACL", SECINFO_UNPROTECTED_SACL
, r
);
1030 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_UNPROTECTED_DACL", SECINFO_UNPROTECTED_DACL
, r
);
1031 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_PROTECTED_SACL", SECINFO_PROTECTED_SACL
, r
);
1032 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SECINFO_PROTECTED_DACL", SECINFO_PROTECTED_DACL
, r
);
1036 _PUBLIC_
enum ndr_err_code
ndr_push_kerb_EncTypes(struct ndr_push
*ndr
, int ndr_flags
, uint32_t r
)
1038 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
));
1039 return NDR_ERR_SUCCESS
;
1042 _PUBLIC_
enum ndr_err_code
ndr_pull_kerb_EncTypes(struct ndr_pull
*ndr
, int ndr_flags
, uint32_t *r
)
1045 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &v
));
1047 return NDR_ERR_SUCCESS
;
1050 _PUBLIC_
void ndr_print_kerb_EncTypes(struct ndr_print
*ndr
, const char *name
, uint32_t r
)
1052 ndr_print_uint32(ndr
, name
, r
);
1054 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "KERB_ENCTYPE_DES_CBC_CRC", KERB_ENCTYPE_DES_CBC_CRC
, r
);
1055 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "KERB_ENCTYPE_DES_CBC_MD5", KERB_ENCTYPE_DES_CBC_MD5
, r
);
1056 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "KERB_ENCTYPE_RC4_HMAC_MD5", KERB_ENCTYPE_RC4_HMAC_MD5
, r
);
1057 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96", KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96
, r
);
1058 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96", KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96
, r
);
1062 _PUBLIC_
enum ndr_err_code
ndr_push_security_autoinherit(struct ndr_push
*ndr
, int ndr_flags
, uint32_t r
)
1064 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
));
1065 return NDR_ERR_SUCCESS
;
1068 _PUBLIC_
enum ndr_err_code
ndr_pull_security_autoinherit(struct ndr_pull
*ndr
, int ndr_flags
, uint32_t *r
)
1071 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &v
));
1073 return NDR_ERR_SUCCESS
;
1076 _PUBLIC_
void ndr_print_security_autoinherit(struct ndr_print
*ndr
, const char *name
, uint32_t r
)
1078 ndr_print_uint32(ndr
, name
, r
);
1080 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SEC_DACL_AUTO_INHERIT", SEC_DACL_AUTO_INHERIT
, r
);
1081 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SEC_SACL_AUTO_INHERIT", SEC_SACL_AUTO_INHERIT
, r
);
1082 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SEC_DEFAULT_DESCRIPTOR", SEC_DEFAULT_DESCRIPTOR
, r
);
1083 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SEC_OWNER_FROM_PARENT", SEC_OWNER_FROM_PARENT
, r
);
1084 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "SEC_GROUP_FROM_PARENT", SEC_GROUP_FROM_PARENT
, r
);