summaryrefslogtreecommitdiff
path: root/source3/librpc
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-01-24 13:53:36 +0100
committerGünther Deschner <gd@samba.org>2008-01-24 13:54:45 +0100
commitdf5b03a7802f1fedb2fd91f75f3545459be9f0e0 (patch)
tree5d0faf71720bf77f91039eab3525aac460bcb695 /source3/librpc
parentb00529585d0a1d364be766e16779e5ff4ae5c43d (diff)
downloadsamba-df5b03a7802f1fedb2fd91f75f3545459be9f0e0.tar.gz
samba-df5b03a7802f1fedb2fd91f75f3545459be9f0e0.tar.bz2
samba-df5b03a7802f1fedb2fd91f75f3545459be9f0e0.zip
Re-run make idl and use generated ndr based on samba4 security.idl (except for DOM_SID).
Guenther (This used to be commit 1781a57b18f681f1bc03873330147a813f10eba2)
Diffstat (limited to 'source3/librpc')
-rw-r--r--source3/librpc/gen_ndr/ndr_security.c1032
-rw-r--r--source3/librpc/gen_ndr/ndr_security.h41
-rw-r--r--source3/librpc/gen_ndr/security.h335
-rw-r--r--source3/librpc/idl/security.idl10
-rw-r--r--source3/librpc/ndr/libndr.h2
-rw-r--r--source3/librpc/ndr/ndr_sec_helper.c815
-rw-r--r--source3/librpc/ndr/security.h257
-rw-r--r--source3/librpc/ndr/sid.c67
8 files changed, 1407 insertions, 1152 deletions
diff --git a/source3/librpc/gen_ndr/ndr_security.c b/source3/librpc/gen_ndr/ndr_security.c
new file mode 100644
index 0000000000..ab341436b4
--- /dev/null
+++ b/source3/librpc/gen_ndr/ndr_security.c
@@ -0,0 +1,1032 @@
+/* parser auto-generated by pidl */
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_security.h"
+
+#include "librpc/gen_ndr/ndr_misc.h"
+static enum ndr_err_code ndr_push_security_ace_flags(struct ndr_push *ndr, int ndr_flags, uint8_t r)
+{
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_ace_flags(struct ndr_pull *ndr, int ndr_flags, uint8_t *r)
+{
+ uint8_t v;
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace_flags(struct ndr_print *ndr, const char *name, uint8_t r)
+{
+ ndr_print_uint8(ndr, name, r);
+ ndr->depth++;
+ ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_OBJECT_INHERIT", SEC_ACE_FLAG_OBJECT_INHERIT, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_CONTAINER_INHERIT", SEC_ACE_FLAG_CONTAINER_INHERIT, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_NO_PROPAGATE_INHERIT", SEC_ACE_FLAG_NO_PROPAGATE_INHERIT, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_INHERIT_ONLY", SEC_ACE_FLAG_INHERIT_ONLY, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_INHERITED_ACE", SEC_ACE_FLAG_INHERITED_ACE, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_VALID_INHERIT", SEC_ACE_FLAG_VALID_INHERIT, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_SUCCESSFUL_ACCESS", SEC_ACE_FLAG_SUCCESSFUL_ACCESS, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_FAILED_ACCESS", SEC_ACE_FLAG_FAILED_ACCESS, r);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_security_ace_type(struct ndr_push *ndr, int ndr_flags, enum security_ace_type r)
+{
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_ace_type(struct ndr_pull *ndr, int ndr_flags, enum security_ace_type *r)
+{
+ uint8_t v;
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace_type(struct ndr_print *ndr, const char *name, enum security_ace_type r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case SEC_ACE_TYPE_ACCESS_ALLOWED: val = "SEC_ACE_TYPE_ACCESS_ALLOWED"; break;
+ case SEC_ACE_TYPE_ACCESS_DENIED: val = "SEC_ACE_TYPE_ACCESS_DENIED"; break;
+ case SEC_ACE_TYPE_SYSTEM_AUDIT: val = "SEC_ACE_TYPE_SYSTEM_AUDIT"; break;
+ case SEC_ACE_TYPE_SYSTEM_ALARM: val = "SEC_ACE_TYPE_SYSTEM_ALARM"; break;
+ case SEC_ACE_TYPE_ALLOWED_COMPOUND: val = "SEC_ACE_TYPE_ALLOWED_COMPOUND"; break;
+ case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: val = "SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT"; break;
+ case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: val = "SEC_ACE_TYPE_ACCESS_DENIED_OBJECT"; break;
+ case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: val = "SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT"; break;
+ case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: val = "SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_security_ace_object_flags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_ace_object_flags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+ uint32_t v;
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace_object_flags(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+ ndr_print_uint32(ndr, name, r);
+ ndr->depth++;
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_ACE_OBJECT_TYPE_PRESENT", SEC_ACE_OBJECT_TYPE_PRESENT, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT", SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT, r);
+ ndr->depth--;
+}
+
+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)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case SEC_ACE_OBJECT_TYPE_PRESENT:
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->type));
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case SEC_ACE_OBJECT_TYPE_PRESENT:
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->type));
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_ace_object_type(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_type *r)
+{
+ int level;
+ level = ndr_pull_get_switch_value(ndr, r);
+ if (ndr_flags & NDR_SCALARS) {
+ switch (level) {
+ case SEC_ACE_OBJECT_TYPE_PRESENT: {
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->type));
+ break; }
+
+ default: {
+ break; }
+
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ switch (level) {
+ case SEC_ACE_OBJECT_TYPE_PRESENT:
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->type));
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace_object_type(struct ndr_print *ndr, const char *name, const union security_ace_object_type *r)
+{
+ int level;
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "security_ace_object_type");
+ switch (level) {
+ case SEC_ACE_OBJECT_TYPE_PRESENT:
+ ndr_print_GUID(ndr, "type", &r->type);
+ break;
+
+ default:
+ break;
+
+ }
+}
+
+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)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->inherited_type));
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->inherited_type));
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+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)
+{
+ int level;
+ level = ndr_pull_get_switch_value(ndr, r);
+ if (ndr_flags & NDR_SCALARS) {
+ switch (level) {
+ case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: {
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->inherited_type));
+ break; }
+
+ default: {
+ break; }
+
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ switch (level) {
+ case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->inherited_type));
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace_object_inherited_type(struct ndr_print *ndr, const char *name, const union security_ace_object_inherited_type *r)
+{
+ int level;
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "security_ace_object_inherited_type");
+ switch (level) {
+ case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
+ ndr_print_GUID(ndr, "inherited_type", &r->inherited_type);
+ break;
+
+ default:
+ break;
+
+ }
+}
+
+static enum ndr_err_code ndr_push_security_ace_object(struct ndr_push *ndr, int ndr_flags, const struct security_ace_object *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_security_ace_object_flags(ndr, NDR_SCALARS, r->flags));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->type, r->flags & SEC_ACE_OBJECT_TYPE_PRESENT));
+ NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_SCALARS, &r->type));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->inherited_type, r->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT));
+ NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_BUFFERS, &r->type));
+ NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_ace_object(struct ndr_pull *ndr, int ndr_flags, struct security_ace_object *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_security_ace_object_flags(ndr, NDR_SCALARS, &r->flags));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->type, r->flags & SEC_ACE_OBJECT_TYPE_PRESENT));
+ NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_SCALARS, &r->type));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->inherited_type, r->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT));
+ NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_BUFFERS, &r->type));
+ NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace_object(struct ndr_print *ndr, const char *name, const struct security_ace_object *r)
+{
+ ndr_print_struct(ndr, name, "security_ace_object");
+ ndr->depth++;
+ ndr_print_security_ace_object_flags(ndr, "flags", r->flags);
+ ndr_print_set_switch_value(ndr, &r->type, r->flags & SEC_ACE_OBJECT_TYPE_PRESENT);
+ ndr_print_security_ace_object_type(ndr, "type", &r->type);
+ ndr_print_set_switch_value(ndr, &r->inherited_type, r->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT);
+ ndr_print_security_ace_object_inherited_type(ndr, "inherited_type", &r->inherited_type);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_security_ace_object_ctr(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_ctr *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
+ NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
+ break;
+
+ case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
+ NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
+ break;
+
+ case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
+ NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
+ break;
+
+ case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
+ NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
+ NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+ break;
+
+ case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
+ NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+ break;
+
+ case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
+ NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+ break;
+
+ case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
+ NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_ace_object_ctr(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_ctr *r)
+{
+ int level;
+ level = ndr_pull_get_switch_value(ndr, r);
+ if (ndr_flags & NDR_SCALARS) {
+ switch (level) {
+ case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: {
+ NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
+ break; }
+
+ case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: {
+ NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
+ break; }
+
+ case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: {
+ NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
+ break; }
+
+ case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: {
+ NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
+ break; }
+
+ default: {
+ break; }
+
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ switch (level) {
+ case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
+ NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+ break;
+
+ case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
+ NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+ break;
+
+ case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
+ NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+ break;
+
+ case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
+ NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
+ break;
+
+ default:
+ break;
+
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace_object_ctr(struct ndr_print *ndr, const char *name, const union security_ace_object_ctr *r)
+{
+ int level;
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "security_ace_object_ctr");
+ switch (level) {
+ case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
+ ndr_print_security_ace_object(ndr, "object", &r->object);
+ break;
+
+ case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
+ ndr_print_security_ace_object(ndr, "object", &r->object);
+ break;
+
+ case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
+ ndr_print_security_ace_object(ndr, "object", &r->object);
+ break;
+
+ case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
+ ndr_print_security_ace_object(ndr, "object", &r->object);
+ break;
+
+ default:
+ break;
+
+ }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_security_ace(struct ndr_push *ndr, int ndr_flags, const struct security_ace *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_security_ace_type(ndr, NDR_SCALARS, r->type));
+ NDR_CHECK(ndr_push_security_ace_flags(ndr, NDR_SCALARS, r->flags));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_ace(r, ndr->flags)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->access_mask));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->object, r->type));
+ NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object));
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->trustee));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object));
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_BUFFERS, &r->trustee));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, struct security_ace *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_security_ace_type(ndr, NDR_SCALARS, &r->type));
+ NDR_CHECK(ndr_pull_security_ace_flags(ndr, NDR_SCALARS, &r->flags));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->access_mask));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->object, r->type));
+ NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object));
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->trustee));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object));
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_BUFFERS, &r->trustee));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_ace(struct ndr_print *ndr, const char *name, const struct security_ace *r)
+{
+ ndr_print_struct(ndr, name, "security_ace");
+ ndr->depth++;
+ ndr_print_security_ace_type(ndr, "type", r->type);
+ ndr_print_security_ace_flags(ndr, "flags", r->flags);
+ ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_ace(r, ndr->flags):r->size);
+ ndr_print_uint32(ndr, "access_mask", r->access_mask);
+ ndr_print_set_switch_value(ndr, &r->object, r->type);
+ ndr_print_security_ace_object_ctr(ndr, "object", &r->object);
+ ndr_print_dom_sid(ndr, "trustee", &r->trustee);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_security_acl_revision(struct ndr_push *ndr, int ndr_flags, enum security_acl_revision r)
+{
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_acl_revision(struct ndr_pull *ndr, int ndr_flags, enum security_acl_revision *r)
+{
+ uint16_t v;
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_acl_revision(struct ndr_print *ndr, const char *name, enum security_acl_revision r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case SECURITY_ACL_REVISION_NT4: val = "SECURITY_ACL_REVISION_NT4"; break;
+ case SECURITY_ACL_REVISION_ADS: val = "SECURITY_ACL_REVISION_ADS"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_security_acl(struct ndr_push *ndr, int ndr_flags, const struct security_acl *r)
+{
+ uint32_t cntr_aces_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_security_acl_revision(ndr, NDR_SCALARS, r->revision));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_acl(r, ndr->flags)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_aces));
+ for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
+ NDR_CHECK(ndr_push_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0]));
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
+ NDR_CHECK(ndr_push_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0]));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_security_acl(struct ndr_pull *ndr, int ndr_flags, struct security_acl *r)
+{
+ uint32_t cntr_aces_0;
+ TALLOC_CTX *_mem_save_aces_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_security_acl_revision(ndr, NDR_SCALARS, &r->revision));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_aces));
+ if (r->num_aces < 0 || r->num_aces > 1000) {
+ return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+ }
+ NDR_PULL_ALLOC_N(ndr, r->aces, r->num_aces);
+ _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
+ for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
+ NDR_CHECK(ndr_pull_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
+ for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
+ NDR_CHECK(ndr_pull_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_acl(struct ndr_print *ndr, const char *name, const struct security_acl *r)
+{
+ uint32_t cntr_aces_0;
+ ndr_print_struct(ndr, name, "security_acl");
+ ndr->depth++;
+ ndr_print_security_acl_revision(ndr, "revision", r->revision);
+ ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_acl(r, ndr->flags):r->size);
+ ndr_print_uint32(ndr, "num_aces", r->num_aces);
+ ndr->print(ndr, "%s: ARRAY(%d)", "aces", r->num_aces);
+ ndr->depth++;
+ for (cntr_aces_0=0;cntr_aces_0<r->num_aces;cntr_aces_0++) {
+ char *idx_0=NULL;
+ asprintf(&idx_0, "[%d]", cntr_aces_0);
+ if (idx_0) {
+ ndr_print_security_ace(ndr, "aces", &r->aces[cntr_aces_0]);
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_security_descriptor_revision(struct ndr_push *ndr, int ndr_flags, enum security_descriptor_revision r)
+{
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_descriptor_revision(struct ndr_pull *ndr, int ndr_flags, enum security_descriptor_revision *r)
+{
+ uint8_t v;
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_descriptor_revision(struct ndr_print *ndr, const char *name, enum security_descriptor_revision r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case SECURITY_DESCRIPTOR_REVISION_1: val = "SECURITY_DESCRIPTOR_REVISION_1"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_security_descriptor_type(struct ndr_push *ndr, int ndr_flags, uint16_t r)
+{
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_security_descriptor_type(struct ndr_pull *ndr, int ndr_flags, uint16_t *r)
+{
+ uint16_t v;
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_descriptor_type(struct ndr_print *ndr, const char *name, uint16_t r)
+{
+ ndr_print_uint16(ndr, name, r);
+ ndr->depth++;
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_OWNER_DEFAULTED", SEC_DESC_OWNER_DEFAULTED, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_GROUP_DEFAULTED", SEC_DESC_GROUP_DEFAULTED, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PRESENT", SEC_DESC_DACL_PRESENT, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_DEFAULTED", SEC_DESC_DACL_DEFAULTED, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PRESENT", SEC_DESC_SACL_PRESENT, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_DEFAULTED", SEC_DESC_SACL_DEFAULTED, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_TRUSTED", SEC_DESC_DACL_TRUSTED, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SERVER_SECURITY", SEC_DESC_SERVER_SECURITY, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERIT_REQ", SEC_DESC_DACL_AUTO_INHERIT_REQ, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERIT_REQ", SEC_DESC_SACL_AUTO_INHERIT_REQ, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERITED", SEC_DESC_DACL_AUTO_INHERITED, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERITED", SEC_DESC_SACL_AUTO_INHERITED, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PROTECTED", SEC_DESC_DACL_PROTECTED, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PROTECTED", SEC_DESC_SACL_PROTECTED, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_RM_CONTROL_VALID", SEC_DESC_RM_CONTROL_VALID, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SELF_RELATIVE", SEC_DESC_SELF_RELATIVE, r);
+ ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r)
+{
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision));
+ NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type));
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid));
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid));
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl));
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->owner_sid) {
+ NDR_CHECK(ndr_push_relative_ptr2(ndr, r->owner_sid));
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->owner_sid));
+ }
+ if (r->group_sid) {
+ NDR_CHECK(ndr_push_relative_ptr2(ndr, r->group_sid));
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->group_sid));
+ }
+ if (r->sacl) {
+ NDR_CHECK(ndr_push_relative_ptr2(ndr, r->sacl));
+ NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
+ }
+ if (r->dacl) {
+ NDR_CHECK(ndr_push_relative_ptr2(ndr, r->dacl));
+ NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
+ }
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r)
+{
+ uint32_t _ptr_owner_sid;
+ TALLOC_CTX *_mem_save_owner_sid_0;
+ uint32_t _ptr_group_sid;
+ TALLOC_CTX *_mem_save_group_sid_0;
+ uint32_t _ptr_sacl;
+ TALLOC_CTX *_mem_save_sacl_0;
+ uint32_t _ptr_dacl;
+ TALLOC_CTX *_mem_save_dacl_0;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_security_descriptor_revision(ndr, NDR_SCALARS, &r->revision));
+ NDR_CHECK(ndr_pull_security_descriptor_type(ndr, NDR_SCALARS, &r->type));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_owner_sid));
+ if (_ptr_owner_sid) {
+ NDR_PULL_ALLOC(ndr, r->owner_sid);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->owner_sid, _ptr_owner_sid));
+ } else {
+ r->owner_sid = NULL;
+ }
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid));
+ if (_ptr_group_sid) {
+ NDR_PULL_ALLOC(ndr, r->group_sid);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->group_sid, _ptr_group_sid));
+ } else {
+ r->group_sid = NULL;
+ }
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sacl));
+ if (_ptr_sacl) {
+ NDR_PULL_ALLOC(ndr, r->sacl);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->sacl, _ptr_sacl));
+ } else {
+ r->sacl = NULL;
+ }
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dacl));
+ if (_ptr_dacl) {
+ NDR_PULL_ALLOC(ndr, r->dacl);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->dacl, _ptr_dacl));
+ } else {
+ r->dacl = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->owner_sid) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->owner_sid));
+ _mem_save_owner_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->owner_sid, 0);
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->owner_sid));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_owner_sid_0, 0);
+ ndr->offset = _relative_save_offset;
+ }
+ if (r->group_sid) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->group_sid));
+ _mem_save_group_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->group_sid, 0);
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->group_sid));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_sid_0, 0);
+ ndr->offset = _relative_save_offset;
+ }
+ if (r->sacl) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->sacl));
+ _mem_save_sacl_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->sacl, 0);
+ NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sacl_0, 0);
+ ndr->offset = _relative_save_offset;
+ }
+ if (r->dacl) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->dacl));
+ _mem_save_dacl_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->dacl, 0);
+ NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dacl_0, 0);
+ ndr->offset = _relative_save_offset;
+ }
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r)
+{
+ ndr_print_struct(ndr, name, "security_descriptor");
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
+ ndr->depth++;
+ ndr_print_security_descriptor_revision(ndr, "revision", r->revision);
+ ndr_print_security_descriptor_type(ndr, "type", r->type);
+ ndr_print_ptr(ndr, "owner_sid", r->owner_sid);
+ ndr->depth++;
+ if (r->owner_sid) {
+ ndr_print_dom_sid(ndr, "owner_sid", r->owner_sid);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "group_sid", r->group_sid);
+ ndr->depth++;
+ if (r->group_sid) {
+ ndr_print_dom_sid(ndr, "group_sid", r->group_sid);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "sacl", r->sacl);
+ ndr->depth++;
+ if (r->sacl) {
+ ndr_print_security_acl(ndr, "sacl", r->sacl);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "dacl", r->dacl);
+ ndr->depth++;
+ if (r->dacl) {
+ ndr_print_security_acl(ndr, "dacl", r->dacl);
+ }
+ ndr->depth--;
+ ndr->depth--;
+ ndr->flags = _flags_save_STRUCT;
+ }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_security_descriptor(r->sd, ndr->flags)));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->sd) {
+ {
+ struct ndr_push *_ndr_sd;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sd, 4, -1));
+ NDR_CHECK(ndr_push_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sd, 4, -1));
+ }
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r)
+{
+ uint32_t _ptr_sd;
+ TALLOC_CTX *_mem_save_sd_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sd_size));
+ if (r->sd_size < 0 || r->sd_size > 0x40000) {
+ return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+ }
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd));
+ if (_ptr_sd) {
+ NDR_PULL_ALLOC(ndr, r->sd);
+ } else {
+ r->sd = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->sd) {
+ _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0);
+ {
+ struct ndr_pull *_ndr_sd;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sd, 4, -1));
+ NDR_CHECK(ndr_pull_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sd, 4, -1));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, const struct sec_desc_buf *r)
+{
+ ndr_print_struct(ndr, name, "sec_desc_buf");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "sd_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_descriptor(r->sd, ndr->flags):r->sd_size);
+ ndr_print_ptr(ndr, "sd", r->sd);
+ ndr->depth++;
+ if (r->sd) {
+ ndr_print_security_descriptor(ndr, "sd", r->sd);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_security_token(struct ndr_push *ndr, int ndr_flags, const struct security_token *r)
+{
+ uint32_t cntr_sids_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->user_sid));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->group_sid));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sids));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sids));
+ for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->sids[cntr_sids_0]));
+ }
+ NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->privilege_mask));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->user_sid) {
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->user_sid));
+ }
+ if (r->group_sid) {
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->group_sid));
+ }
+ for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
+ if (r->sids[cntr_sids_0]) {
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->sids[cntr_sids_0]));
+ }
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_security_token(struct ndr_pull *ndr, int ndr_flags, struct security_token *r)
+{
+ uint32_t _ptr_user_sid;
+ TALLOC_CTX *_mem_save_user_sid_0;
+ uint32_t _ptr_group_sid;
+ TALLOC_CTX *_mem_save_group_sid_0;
+ uint32_t _ptr_sids;
+ uint32_t cntr_sids_0;
+ TALLOC_CTX *_mem_save_sids_0;
+ TALLOC_CTX *_mem_save_sids_1;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_user_sid));
+ if (_ptr_user_sid) {
+ NDR_PULL_ALLOC(ndr, r->user_sid);
+ } else {
+ r->user_sid = NULL;
+ }
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid));
+ if (_ptr_group_sid) {
+ NDR_PULL_ALLOC(ndr, r->group_sid);
+ } else {
+ r->group_sid = NULL;
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_sids));
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->sids));
+ NDR_PULL_ALLOC_N(ndr, r->sids, ndr_get_array_size(ndr, &r->sids));
+ _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
+ for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sids));
+ if (_ptr_sids) {
+ NDR_PULL_ALLOC(ndr, r->sids[cntr_sids_0]);
+ } else {
+ r->sids[cntr_sids_0] = NULL;
+ }
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0);
+ NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->privilege_mask));
+ if (r->sids) {
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->sids, r->num_sids));
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->user_sid) {
+ _mem_save_user_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->user_sid, 0);
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->user_sid));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_sid_0, 0);
+ }
+ if (r->group_sid) {
+ _mem_save_group_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->group_sid, 0);
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->group_sid));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_sid_0, 0);
+ }
+ _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
+ for (cntr_sids_0 = 0; cntr_sids_0 < r->num_sids; cntr_sids_0++) {
+ if (r->sids[cntr_sids_0]) {
+ _mem_save_sids_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->sids[cntr_sids_0], 0);
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->sids[cntr_sids_0]));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_1, 0);
+ }
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0);
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_token(struct ndr_print *ndr, const char *name, const struct security_token *r)
+{
+ uint32_t cntr_sids_0;
+ ndr_print_struct(ndr, name, "security_token");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "user_sid", r->user_sid);
+ ndr->depth++;
+ if (r->user_sid) {
+ ndr_print_dom_sid(ndr, "user_sid", r->user_sid);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "group_sid", r->group_sid);
+ ndr->depth++;
+ if (r->group_sid) {
+ ndr_print_dom_sid(ndr, "group_sid", r->group_sid);
+ }
+ ndr->depth--;
+ ndr_print_uint32(ndr, "num_sids", r->num_sids);
+ ndr->print(ndr, "%s: ARRAY(%d)", "sids", r->num_sids);
+ ndr->depth++;
+ for (cntr_sids_0=0;cntr_sids_0<r->num_sids;cntr_sids_0++) {
+ char *idx_0=NULL;
+ asprintf(&idx_0, "[%d]", cntr_sids_0);
+ if (idx_0) {
+ ndr_print_ptr(ndr, "sids", r->sids[cntr_sids_0]);
+ ndr->depth++;
+ if (r->sids[cntr_sids_0]) {
+ ndr_print_dom_sid(ndr, "sids", r->sids[cntr_sids_0]);
+ }
+ ndr->depth--;
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr_print_udlong(ndr, "privilege_mask", r->privilege_mask);
+ ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+ uint32_t v;
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+ ndr_print_uint32(ndr, name, r);
+ ndr->depth++;
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_OWNER", SECINFO_OWNER, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_GROUP", SECINFO_GROUP, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_DACL", SECINFO_DACL, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_SACL", SECINFO_SACL, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_SACL", SECINFO_UNPROTECTED_SACL, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_DACL", SECINFO_UNPROTECTED_DACL, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_SACL", SECINFO_PROTECTED_SACL, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_DACL", SECINFO_PROTECTED_DACL, r);
+ ndr->depth--;
+}
+
diff --git a/source3/librpc/gen_ndr/ndr_security.h b/source3/librpc/gen_ndr/ndr_security.h
index 292e9011c6..79bfd78f51 100644
--- a/source3/librpc/gen_ndr/ndr_security.h
+++ b/source3/librpc/gen_ndr/ndr_security.h
@@ -1,2 +1,41 @@
-/* empty header to deal with pidl */
+/* header auto-generated by pidl */
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/security.h"
+
+#ifndef _HEADER_NDR_security
+#define _HEADER_NDR_security
+
+#define NDR_SECURITY_CALL_COUNT (0)
+void ndr_print_security_ace_flags(struct ndr_print *ndr, const char *name, uint8_t r);
+void ndr_print_security_ace_type(struct ndr_print *ndr, const char *name, enum security_ace_type r);
+void ndr_print_security_ace_object_flags(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_security_ace_object_type(struct ndr_print *ndr, const char *name, const union security_ace_object_type *r);
+void ndr_print_security_ace_object_inherited_type(struct ndr_print *ndr, const char *name, const union security_ace_object_inherited_type *r);
+void ndr_print_security_ace_object(struct ndr_print *ndr, const char *name, const struct security_ace_object *r);
+void ndr_print_security_ace_object_ctr(struct ndr_print *ndr, const char *name, const union security_ace_object_ctr *r);
+enum ndr_err_code ndr_push_security_ace(struct ndr_push *ndr, int ndr_flags, const struct security_ace *r);
+enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, struct security_ace *r);
+void ndr_print_security_ace(struct ndr_print *ndr, const char *name, const struct security_ace *r);
+size_t ndr_size_security_ace(const struct security_ace *r, int flags);
+void ndr_print_security_acl_revision(struct ndr_print *ndr, const char *name, enum security_acl_revision r);
+enum ndr_err_code ndr_push_security_acl(struct ndr_push *ndr, int ndr_flags, const struct security_acl *r);
+enum ndr_err_code ndr_pull_security_acl(struct ndr_pull *ndr, int ndr_flags, struct security_acl *r);
+void ndr_print_security_acl(struct ndr_print *ndr, const char *name, const struct security_acl *r);
+size_t ndr_size_security_acl(const struct security_acl *r, int flags);
+void ndr_print_security_descriptor_revision(struct ndr_print *ndr, const char *name, enum security_descriptor_revision r);
+void ndr_print_security_descriptor_type(struct ndr_print *ndr, const char *name, uint16_t r);
+enum ndr_err_code ndr_push_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r);
+enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r);
+void ndr_print_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r);
+size_t ndr_size_security_descriptor(const struct security_descriptor *r, int flags);
+enum ndr_err_code ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r);
+enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r);
+void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, const struct sec_desc_buf *r);
+enum ndr_err_code ndr_push_security_token(struct ndr_push *ndr, int ndr_flags, const struct security_token *r);
+enum ndr_err_code ndr_pull_security_token(struct ndr_pull *ndr, int ndr_flags, struct security_token *r);
+void ndr_print_security_token(struct ndr_print *ndr, const char *name, const struct security_token *r);
+enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r);
+enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
+void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name, uint32_t r);
+#endif /* _HEADER_NDR_security */
diff --git a/source3/librpc/gen_ndr/security.h b/source3/librpc/gen_ndr/security.h
index 1c51af5b9c..b87259c9cb 100644
--- a/source3/librpc/gen_ndr/security.h
+++ b/source3/librpc/gen_ndr/security.h
@@ -1 +1,334 @@
-#include "ndr/security.h"
+/* header auto-generated by pidl */
+
+#include <stdint.h>
+
+#include "librpc/gen_ndr/misc.h"
+#define dom_sid2 dom_sid
+#define dom_sid28 dom_sid
+#ifndef _HEADER_security
+#define _HEADER_security
+
+#define SEC_MASK_GENERIC ( 0xF0000000 )
+#define SEC_MASK_FLAGS ( 0x0F000000 )
+#define SEC_MASK_STANDARD ( 0x00FF0000 )
+#define SEC_MASK_SPECIFIC ( 0x0000FFFF )
+#define SEC_GENERIC_ALL ( 0x10000000 )
+#define SEC_GENERIC_EXECUTE ( 0x20000000 )
+#define SEC_GENERIC_WRITE ( 0x40000000 )
+#define SEC_GENERIC_READ ( 0x80000000 )
+#define SEC_FLAG_SYSTEM_SECURITY ( 0x01000000 )
+#define SEC_FLAG_MAXIMUM_ALLOWED ( 0x02000000 )
+#define SEC_STD_DELETE ( 0x00010000 )
+#define SEC_STD_READ_CONTROL ( 0x00020000 )
+#define SEC_STD_WRITE_DAC ( 0x00040000 )
+#define SEC_STD_WRITE_OWNER ( 0x00080000 )
+#define SEC_STD_SYNCHRONIZE ( 0x00100000 )
+#define SEC_STD_REQUIRED ( 0x000F0000 )
+#define SEC_STD_ALL ( 0x001F0000 )
+#define SEC_FILE_READ_DATA ( 0x00000001 )
+#define SEC_FILE_WRITE_DATA ( 0x00000002 )
+#define SEC_FILE_APPEND_DATA ( 0x00000004 )
+#define SEC_FILE_READ_EA ( 0x00000008 )
+#define SEC_FILE_WRITE_EA ( 0x00000010 )
+#define SEC_FILE_EXECUTE ( 0x00000020 )
+#define SEC_FILE_READ_ATTRIBUTE ( 0x00000080 )
+#define SEC_FILE_WRITE_ATTRIBUTE ( 0x00000100 )
+#define SEC_FILE_ALL ( 0x000001ff )
+#define SEC_DIR_LIST ( 0x00000001 )
+#define SEC_DIR_ADD_FILE ( 0x00000002 )
+#define SEC_DIR_ADD_SUBDIR ( 0x00000004 )
+#define SEC_DIR_READ_EA ( 0x00000008 )
+#define SEC_DIR_WRITE_EA ( 0x00000010 )
+#define SEC_DIR_TRAVERSE ( 0x00000020 )
+#define SEC_DIR_DELETE_CHILD ( 0x00000040 )
+#define SEC_DIR_READ_ATTRIBUTE ( 0x00000080 )
+#define SEC_DIR_WRITE_ATTRIBUTE ( 0x00000100 )
+#define SEC_REG_QUERY_VALUE ( 0x00000001 )
+#define SEC_REG_SET_VALUE ( 0x00000002 )
+#define SEC_REG_CREATE_SUBKEY ( 0x00000004 )
+#define SEC_REG_ENUM_SUBKEYS ( 0x00000008 )
+#define SEC_REG_NOTIFY ( 0x00000010 )
+#define SEC_REG_CREATE_LINK ( 0x00000020 )
+#define SEC_ADS_CREATE_CHILD ( 0x00000001 )
+#define SEC_ADS_DELETE_CHILD ( 0x00000002 )
+#define SEC_ADS_LIST ( 0x00000004 )
+#define SEC_ADS_SELF_WRITE ( 0x00000008 )
+#define SEC_ADS_READ_PROP ( 0x00000010 )
+#define SEC_ADS_WRITE_PROP ( 0x00000020 )
+#define SEC_ADS_DELETE_TREE ( 0x00000040 )
+#define SEC_ADS_LIST_OBJECT ( 0x00000080 )
+#define SEC_ADS_CONTROL_ACCESS ( 0x00000100 )
+#define SEC_RIGHTS_FILE_READ ( SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_READ_EA )
+#define SEC_RIGHTS_FILE_WRITE ( SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_WRITE_DATA|SEC_FILE_WRITE_ATTRIBUTE|SEC_FILE_WRITE_EA|SEC_FILE_APPEND_DATA )
+#define SEC_RIGHTS_FILE_EXECUTE ( SEC_STD_SYNCHRONIZE|SEC_STD_READ_CONTROL|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_EXECUTE )
+#define SEC_RIGHTS_FILE_ALL ( SEC_STD_ALL|SEC_FILE_ALL )
+#define SEC_RIGHTS_DIR_READ ( SEC_RIGHTS_FILE_READ )
+#define SEC_RIGHTS_DIR_WRITE ( SEC_RIGHTS_FILE_WRITE )
+#define SEC_RIGHTS_DIR_EXECUTE ( SEC_RIGHTS_FILE_EXECUTE )
+#define SEC_RIGHTS_DIR_ALL ( SEC_RIGHTS_FILE_ALL )
+#define SID_NULL ( "S-1-0-0" )
+#define NAME_WORLD ( "WORLD" )
+#define SID_WORLD_DOMAIN ( "S-1-1" )
+#define SID_WORLD ( "S-1-1-0" )
+#define SID_CREATOR_OWNER_DOMAIN ( "S-1-3" )
+#define SID_CREATOR_OWNER ( "S-1-3-0" )
+#define SID_CREATOR_GROUP ( "S-1-3-1" )
+#define NAME_NT_AUTHORITY ( "NT AUTHORITY" )
+#define SID_NT_AUTHORITY ( "S-1-5" )
+#define SID_NT_DIALUP ( "S-1-5-1" )
+#define SID_NT_NETWORK ( "S-1-5-2" )
+#define SID_NT_BATCH ( "S-1-5-3" )
+#define SID_NT_INTERACTIVE ( "S-1-5-4" )
+#define SID_NT_SERVICE ( "S-1-5-6" )
+#define SID_NT_ANONYMOUS ( "S-1-5-7" )
+#define SID_NT_PROXY ( "S-1-5-8" )
+#define SID_NT_ENTERPRISE_DCS ( "S-1-5-9" )
+#define SID_NT_SELF ( "S-1-5-10" )
+#define SID_NT_AUTHENTICATED_USERS ( "S-1-5-11" )
+#define SID_NT_RESTRICTED ( "S-1-5-12" )
+#define SID_NT_TERMINAL_SERVER_USERS ( "S-1-5-13" )
+#define SID_NT_REMOTE_INTERACTIVE ( "S-1-5-14" )
+#define SID_NT_THIS_ORGANISATION ( "S-1-5-15" )
+#define SID_NT_SYSTEM ( "S-1-5-18" )
+#define SID_NT_LOCAL_SERVICE ( "S-1-5-19" )
+#define SID_NT_NETWORK_SERVICE ( "S-1-5-20" )
+#define NAME_BUILTIN ( "BUILTIN" )
+#define SID_BUILTIN ( "S-1-5-32" )
+#define SID_BUILTIN_ADMINISTRATORS ( "S-1-5-32-544" )
+#define SID_BUILTIN_USERS ( "S-1-5-32-545" )
+#define SID_BUILTIN_GUESTS ( "S-1-5-32-546" )
+#define SID_BUILTIN_POWER_USERS ( "S-1-5-32-547" )
+#define SID_BUILTIN_ACCOUNT_OPERATORS ( "S-1-5-32-548" )
+#define SID_BUILTIN_SERVER_OPERATORS ( "S-1-5-32-549" )
+#define SID_BUILTIN_PRINT_OPERATORS ( "S-1-5-32-550" )
+#define SID_BUILTIN_BACKUP_OPERATORS ( "S-1-5-32-551" )
+#define SID_BUILTIN_REPLICATOR ( "S-1-5-32-552" )
+#define SID_BUILTIN_RAS_SERVERS ( "S-1-5-32-553" )
+#define SID_BUILTIN_PREW2K ( "S-1-5-32-554" )
+#define DOMAIN_RID_LOGON ( 9 )
+#define DOMAIN_RID_ADMINISTRATOR ( 500 )
+#define DOMAIN_RID_GUEST ( 501 )
+#define DOMAIN_RID_ADMINS ( 512 )
+#define DOMAIN_RID_USERS ( 513 )
+#define DOMAIN_RID_DOMAIN_MEMBERS ( 515 )
+#define DOMAIN_RID_DCS ( 516 )
+#define DOMAIN_RID_CERT_ADMINS ( 517 )
+#define DOMAIN_RID_SCHEMA_ADMINS ( 518 )
+#define DOMAIN_RID_ENTERPRISE_ADMINS ( 519 )
+#define NT4_ACL_REVISION ( SECURITY_ACL_REVISION_NT4 )
+#define SD_REVISION ( SECURITY_DESCRIPTOR_REVISION_1 )
+enum sec_privilege
+#ifndef USE_UINT_ENUMS
+ {
+ SEC_PRIV_SECURITY=1,
+ SEC_PRIV_BACKUP=2,
+ SEC_PRIV_RESTORE=3,
+ SEC_PRIV_SYSTEMTIME=4,
+ SEC_PRIV_SHUTDOWN=5,
+ SEC_PRIV_REMOTE_SHUTDOWN=6,
+ SEC_PRIV_TAKE_OWNERSHIP=7,
+ SEC_PRIV_DEBUG=8,
+ SEC_PRIV_SYSTEM_ENVIRONMENT=9,
+ SEC_PRIV_SYSTEM_PROFILE=10,
+ SEC_PRIV_PROFILE_SINGLE_PROCESS=11,
+ SEC_PRIV_INCREASE_BASE_PRIORITY=12,
+ SEC_PRIV_LOAD_DRIVER=13,
+ SEC_PRIV_CREATE_PAGEFILE=14,
+ SEC_PRIV_INCREASE_QUOTA=15,
+ SEC_PRIV_CHANGE_NOTIFY=16,
+ SEC_PRIV_UNDOCK=17,
+ SEC_PRIV_MANAGE_VOLUME=18,
+ SEC_PRIV_IMPERSONATE=19,
+ SEC_PRIV_CREATE_GLOBAL=20,
+ SEC_PRIV_ENABLE_DELEGATION=21,
+ SEC_PRIV_INTERACTIVE_LOGON=22,
+ SEC_PRIV_NETWORK_LOGON=23,
+ SEC_PRIV_REMOTE_INTERACTIVE_LOGON=24
+}
+#else
+ { __donnot_use_enum_sec_privilege=0x7FFFFFFF}
+#define SEC_PRIV_SECURITY ( 1 )
+#define SEC_PRIV_BACKUP ( 2 )
+#define SEC_PRIV_RESTORE ( 3 )
+#define SEC_PRIV_SYSTEMTIME ( 4 )
+#define SEC_PRIV_SHUTDOWN ( 5 )
+#define SEC_PRIV_REMOTE_SHUTDOWN ( 6 )
+#define SEC_PRIV_TAKE_OWNERSHIP ( 7 )
+#define SEC_PRIV_DEBUG ( 8 )
+#define SEC_PRIV_SYSTEM_ENVIRONMENT ( 9 )
+#define SEC_PRIV_SYSTEM_PROFILE ( 10 )
+#define SEC_PRIV_PROFILE_SINGLE_PROCESS ( 11 )
+#define SEC_PRIV_INCREASE_BASE_PRIORITY ( 12 )
+#define SEC_PRIV_LOAD_DRIVER ( 13 )
+#define SEC_PRIV_CREATE_PAGEFILE ( 14 )
+#define SEC_PRIV_INCREASE_QUOTA ( 15 )
+#define SEC_PRIV_CHANGE_NOTIFY ( 16 )
+#define SEC_PRIV_UNDOCK ( 17 )
+#define SEC_PRIV_MANAGE_VOLUME ( 18 )
+#define SEC_PRIV_IMPERSONATE ( 19 )
+#define SEC_PRIV_CREATE_GLOBAL ( 20 )
+#define SEC_PRIV_ENABLE_DELEGATION ( 21 )
+#define SEC_PRIV_INTERACTIVE_LOGON ( 22 )
+#define SEC_PRIV_NETWORK_LOGON ( 23 )
+#define SEC_PRIV_REMOTE_INTERACTIVE_LOGON ( 24 )
+#endif
+;
+
+/* bitmap security_ace_flags */
+#define SEC_ACE_FLAG_OBJECT_INHERIT ( 0x01 )
+#define SEC_ACE_FLAG_CONTAINER_INHERIT ( 0x02 )
+#define SEC_ACE_FLAG_NO_PROPAGATE_INHERIT ( 0x04 )
+#define SEC_ACE_FLAG_INHERIT_ONLY ( 0x08 )
+#define SEC_ACE_FLAG_INHERITED_ACE ( 0x10 )
+#define SEC_ACE_FLAG_VALID_INHERIT ( 0x0f )
+#define SEC_ACE_FLAG_SUCCESSFUL_ACCESS ( 0x40 )
+#define SEC_ACE_FLAG_FAILED_ACCESS ( 0x80 )
+
+;
+
+enum security_ace_type
+#ifndef USE_UINT_ENUMS
+ {
+ SEC_ACE_TYPE_ACCESS_ALLOWED=0,
+ SEC_ACE_TYPE_ACCESS_DENIED=1,
+ SEC_ACE_TYPE_SYSTEM_AUDIT=2,
+ SEC_ACE_TYPE_SYSTEM_ALARM=3,
+ SEC_ACE_TYPE_ALLOWED_COMPOUND=4,
+ SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT=5,
+ SEC_ACE_TYPE_ACCESS_DENIED_OBJECT=6,
+ SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT=7,
+ SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT=8
+}
+#else
+ { __donnot_use_enum_security_ace_type=0x7FFFFFFF}
+#define SEC_ACE_TYPE_ACCESS_ALLOWED ( 0 )
+#define SEC_ACE_TYPE_ACCESS_DENIED ( 1 )
+#define SEC_ACE_TYPE_SYSTEM_AUDIT ( 2 )
+#define SEC_ACE_TYPE_SYSTEM_ALARM ( 3 )
+#define SEC_ACE_TYPE_ALLOWED_COMPOUND ( 4 )
+#define SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT ( 5 )
+#define SEC_ACE_TYPE_ACCESS_DENIED_OBJECT ( 6 )
+#define SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT ( 7 )
+#define SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT ( 8 )
+#endif
+;
+
+/* bitmap security_ace_object_flags */
+#define SEC_ACE_OBJECT_TYPE_PRESENT ( 0x00000001 )
+#define SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT ( 0x00000002 )
+
+;
+
+union security_ace_object_type {
+ struct GUID type;/* [case(SEC_ACE_OBJECT_TYPE_PRESENT)] */
+}/* [nodiscriminant] */;
+
+union security_ace_object_inherited_type {
+ struct GUID inherited_type;/* [case(SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] */
+}/* [nodiscriminant] */;
+
+struct security_ace_object {
+ uint32_t flags;
+ union security_ace_object_type type;/* [switch_is(flags&SEC_ACE_OBJECT_TYPE_PRESENT)] */
+ union security_ace_object_inherited_type inherited_type;/* [switch_is(flags&SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] */
+};
+
+union security_ace_object_ctr {
+ struct security_ace_object object;/* [case(SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT)] */
+}/* [nodiscriminant] */;
+
+struct security_ace {
+ enum security_ace_type type;
+ uint8_t flags;
+ uint16_t size;/* [value(ndr_size_security_ace(r,ndr->flags))] */
+ uint32_t access_mask;
+ union security_ace_object_ctr object;/* [switch_is(type)] */
+ struct dom_sid trustee;
+}/* [gensize,public,nosize] */;
+
+enum security_acl_revision
+#ifndef USE_UINT_ENUMS
+ {
+ SECURITY_ACL_REVISION_NT4=2,
+ SECURITY_ACL_REVISION_ADS=4
+}
+#else
+ { __donnot_use_enum_security_acl_revision=0x7FFFFFFF}
+#define SECURITY_ACL_REVISION_NT4 ( 2 )
+#define SECURITY_ACL_REVISION_ADS ( 4 )
+#endif
+;
+
+struct security_acl {
+ enum security_acl_revision revision;
+ uint16_t size;/* [value(ndr_size_security_acl(r,ndr->flags))] */
+ uint32_t num_aces;/* [range(0 1000)] */
+ struct security_ace *aces;
+}/* [gensize,public,nosize] */;
+
+enum security_descriptor_revision
+#ifndef USE_UINT_ENUMS
+ {
+ SECURITY_DESCRIPTOR_REVISION_1=1
+}
+#else
+ { __donnot_use_enum_security_descriptor_revision=0x7FFFFFFF}
+#define SECURITY_DESCRIPTOR_REVISION_1 ( 1 )
+#endif
+;
+
+/* bitmap security_descriptor_type */
+#define SEC_DESC_OWNER_DEFAULTED ( 0x0001 )
+#define SEC_DESC_GROUP_DEFAULTED ( 0x0002 )
+#define SEC_DESC_DACL_PRESENT ( 0x0004 )
+#define SEC_DESC_DACL_DEFAULTED ( 0x0008 )
+#define SEC_DESC_SACL_PRESENT ( 0x0010 )
+#define SEC_DESC_SACL_DEFAULTED ( 0x0020 )
+#define SEC_DESC_DACL_TRUSTED ( 0x0040 )
+#define SEC_DESC_SERVER_SECURITY ( 0x0080 )
+#define SEC_DESC_DACL_AUTO_INHERIT_REQ ( 0x0100 )
+#define SEC_DESC_SACL_AUTO_INHERIT_REQ ( 0x0200 )
+#define SEC_DESC_DACL_AUTO_INHERITED ( 0x0400 )
+#define SEC_DESC_SACL_AUTO_INHERITED ( 0x0800 )
+#define SEC_DESC_DACL_PROTECTED ( 0x1000 )
+#define SEC_DESC_SACL_PROTECTED ( 0x2000 )
+#define SEC_DESC_RM_CONTROL_VALID ( 0x4000 )
+#define SEC_DESC_SELF_RELATIVE ( 0x8000 )
+
+;
+
+struct security_descriptor {
+ enum security_descriptor_revision revision;
+ uint16_t type;
+ struct dom_sid *owner_sid;/* [relative] */
+ struct dom_sid *group_sid;/* [relative] */
+ struct security_acl *sacl;/* [relative] */
+ struct security_acl *dacl;/* [relative] */
+}/* [gensize,public,flag(LIBNDR_FLAG_LITTLE_ENDIAN),nosize] */;
+
+struct sec_desc_buf {
+ uint32_t sd_size;/* [value(ndr_size_security_descriptor(sd,ndr->flags)),range(0 0x40000)] */
+ struct security_descriptor *sd;/* [unique,subcontext(4)] */
+}/* [public] */;
+
+struct security_token {
+ struct dom_sid *user_sid;/* [unique] */
+ struct dom_sid *group_sid;/* [unique] */
+ uint32_t num_sids;
+ struct dom_sid **sids;/* [unique,size_is(num_sids)] */
+ uint64_t privilege_mask;
+}/* [public] */;
+
+/* bitmap security_secinfo */
+#define SECINFO_OWNER ( 0x00000001 )
+#define SECINFO_GROUP ( 0x00000002 )
+#define SECINFO_DACL ( 0x00000004 )
+#define SECINFO_SACL ( 0x00000008 )
+#define SECINFO_UNPROTECTED_SACL ( 0x10000000 )
+#define SECINFO_UNPROTECTED_DACL ( 0x20000000 )
+#define SECINFO_PROTECTED_SACL ( 0x40000000 )
+#define SECINFO_PROTECTED_DACL ( 0x80000000 )
+
+;
+
+#endif /* _HEADER_security */
diff --git a/source3/librpc/idl/security.idl b/source3/librpc/idl/security.idl
index 753fad85cf..c4c30e9b5a 100644
--- a/source3/librpc/idl/security.idl
+++ b/source3/librpc/idl/security.idl
@@ -230,16 +230,6 @@ interface security
SEC_PRIV_REMOTE_INTERACTIVE_LOGON = 24
} sec_privilege;
-
- /* a domain SID. Note that unlike Samba3 this contains a pointer,
- so you can't copy them using assignment */
- typedef [public,gensize,noprint,noejs,nosize] struct {
- uint8 sid_rev_num; /**< SID revision number */
- [range(0,15)] int8 num_auths; /**< Number of sub-authorities */
- uint8 id_auth[6]; /**< Identifier Authority */
- uint32 sub_auths[num_auths];
- } dom_sid;
-
typedef [bitmap8bit] bitmap {
SEC_ACE_FLAG_OBJECT_INHERIT = 0x01,
SEC_ACE_FLAG_CONTAINER_INHERIT = 0x02,
diff --git a/source3/librpc/ndr/libndr.h b/source3/librpc/ndr/libndr.h
index 9c8c401c10..a277a626c7 100644
--- a/source3/librpc/ndr/libndr.h
+++ b/source3/librpc/ndr/libndr.h
@@ -23,7 +23,7 @@
#define _PRINTF_ATTRIBUTE(a,b)
#include "librpc/gen_ndr/misc.h"
-#include "librpc/ndr/security.h"
+#include "librpc/gen_ndr/security.h"
/*
this provides definitions for the libcli/rpc/ MSRPC library
diff --git a/source3/librpc/ndr/ndr_sec_helper.c b/source3/librpc/ndr/ndr_sec_helper.c
index d1938b9588..f8bad6ca61 100644
--- a/source3/librpc/ndr/ndr_sec_helper.c
+++ b/source3/librpc/ndr/ndr_sec_helper.c
@@ -89,818 +89,3 @@ void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct d
{
ndr_print_dom_sid(ndr, name, sid);
}
-
-static enum ndr_err_code ndr_push_security_ace_flags(struct ndr_push *ndr, int ndr_flags, uint8_t r)
-{
- NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_ace_flags(struct ndr_pull *ndr, int ndr_flags, uint8_t *r)
-{
- uint8_t v;
- NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
- *r = v;
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace_flags(struct ndr_print *ndr, const char *name, uint8_t r)
-{
- ndr_print_uint8(ndr, name, r);
- ndr->depth++;
- ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_OBJECT_INHERIT", SEC_ACE_FLAG_OBJECT_INHERIT, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_CONTAINER_INHERIT", SEC_ACE_FLAG_CONTAINER_INHERIT, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_NO_PROPAGATE_INHERIT", SEC_ACE_FLAG_NO_PROPAGATE_INHERIT, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_INHERIT_ONLY", SEC_ACE_FLAG_INHERIT_ONLY, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_INHERITED_ACE", SEC_ACE_FLAG_INHERITED_ACE, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_VALID_INHERIT", SEC_ACE_FLAG_VALID_INHERIT, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_SUCCESSFUL_ACCESS", SEC_ACE_FLAG_SUCCESSFUL_ACCESS, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint8_t), "SEC_ACE_FLAG_FAILED_ACCESS", SEC_ACE_FLAG_FAILED_ACCESS, r);
- ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_security_ace_type(struct ndr_push *ndr, int ndr_flags, enum security_ace_type r)
-{
- NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_ace_type(struct ndr_pull *ndr, int ndr_flags, enum security_ace_type *r)
-{
- uint8_t v;
- NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
- *r = (enum security_ace_type)v;
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace_type(struct ndr_print *ndr, const char *name, enum security_ace_type r)
-{
- const char *val = NULL;
-
- switch (r) {
- case SEC_ACE_TYPE_ACCESS_ALLOWED: val = "SEC_ACE_TYPE_ACCESS_ALLOWED"; break;
- case SEC_ACE_TYPE_ACCESS_DENIED: val = "SEC_ACE_TYPE_ACCESS_DENIED"; break;
- case SEC_ACE_TYPE_SYSTEM_AUDIT: val = "SEC_ACE_TYPE_SYSTEM_AUDIT"; break;
- case SEC_ACE_TYPE_SYSTEM_ALARM: val = "SEC_ACE_TYPE_SYSTEM_ALARM"; break;
- case SEC_ACE_TYPE_ALLOWED_COMPOUND: val = "SEC_ACE_TYPE_ALLOWED_COMPOUND"; break;
- case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: val = "SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT"; break;
- case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: val = "SEC_ACE_TYPE_ACCESS_DENIED_OBJECT"; break;
- case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: val = "SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT"; break;
- case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: val = "SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT"; break;
- }
- ndr_print_enum(ndr, name, "ENUM", val, r);
-}
-
-static enum ndr_err_code ndr_push_security_ace_object_flags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
-{
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_ace_object_flags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
-{
- uint32_t v;
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
- *r = v;
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace_object_flags(struct ndr_print *ndr, const char *name, uint32_t r)
-{
- ndr_print_uint32(ndr, name, r);
- ndr->depth++;
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_ACE_OBJECT_TYPE_PRESENT", SEC_ACE_OBJECT_TYPE_PRESENT, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT", SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT, r);
- ndr->depth--;
-}
-
-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)
-{
- int level;
- level = ndr_push_get_switch_value(ndr, r);
- if (ndr_flags & NDR_SCALARS) {
- switch (level) {
- case SEC_ACE_OBJECT_TYPE_PRESENT:
- NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->type));
- break;
-
- default:
- break;
-
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- switch (level) {
- case SEC_ACE_OBJECT_TYPE_PRESENT:
- break;
-
- default:
- break;
-
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_ace_object_type(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_type *r)
-{
- int level;
- level = ndr_pull_get_switch_value(ndr, r);
- if (ndr_flags & NDR_SCALARS) {
- switch (level) {
- case SEC_ACE_OBJECT_TYPE_PRESENT: {
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->type));
- break; }
-
- default: {
- break; }
-
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- switch (level) {
- case SEC_ACE_OBJECT_TYPE_PRESENT:
- break;
-
- default:
- break;
-
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace_object_type(struct ndr_print *ndr, const char *name, const union security_ace_object_type *r)
-{
- int level;
- level = ndr_print_get_switch_value(ndr, r);
- ndr_print_union(ndr, name, level, "security_ace_object_type");
- switch (level) {
- case SEC_ACE_OBJECT_TYPE_PRESENT:
- ndr_print_GUID(ndr, "type", &r->type);
- break;
-
- default:
- break;
-
- }
-}
-
-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)
-{
- int level;
- level = ndr_push_get_switch_value(ndr, r);
- if (ndr_flags & NDR_SCALARS) {
- switch (level) {
- case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
- NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->inherited_type));
- break;
-
- default:
- break;
-
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- switch (level) {
- case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
- break;
-
- default:
- break;
-
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-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)
-{
- int level;
- level = ndr_pull_get_switch_value(ndr, r);
- if (ndr_flags & NDR_SCALARS) {
- switch (level) {
- case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT: {
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->inherited_type));
- break; }
-
- default: {
- break; }
-
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- switch (level) {
- case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
- break;
-
- default:
- break;
-
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace_object_inherited_type(struct ndr_print *ndr, const char *name, const union security_ace_object_inherited_type *r)
-{
- int level;
- level = ndr_print_get_switch_value(ndr, r);
- ndr_print_union(ndr, name, level, "security_ace_object_inherited_type");
- switch (level) {
- case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
- ndr_print_GUID(ndr, "inherited_type", &r->inherited_type);
- break;
-
- default:
- break;
-
- }
-}
-
-static enum ndr_err_code ndr_push_security_ace_object(struct ndr_push *ndr, int ndr_flags, const struct security_ace_object *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_security_ace_object_flags(ndr, NDR_SCALARS, r->flags));
- NDR_CHECK(ndr_push_set_switch_value(ndr, &r->type, r->flags&SEC_ACE_OBJECT_TYPE_PRESENT));
- NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_SCALARS, &r->type));
- NDR_CHECK(ndr_push_set_switch_value(ndr, &r->inherited_type, r->flags&SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT));
- NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type));
- }
- if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_push_security_ace_object_type(ndr, NDR_BUFFERS, &r->type));
- NDR_CHECK(ndr_push_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type));
- }
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_ace_object(struct ndr_pull *ndr, int ndr_flags, struct security_ace_object *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_security_ace_object_flags(ndr, NDR_SCALARS, &r->flags));
- NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->type, r->flags&SEC_ACE_OBJECT_TYPE_PRESENT));
- NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_SCALARS, &r->type));
- NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->inherited_type, r->flags&SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT));
- NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_SCALARS, &r->inherited_type));
- }
- if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_pull_security_ace_object_type(ndr, NDR_BUFFERS, &r->type));
- NDR_CHECK(ndr_pull_security_ace_object_inherited_type(ndr, NDR_BUFFERS, &r->inherited_type));
- }
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace_object(struct ndr_print *ndr, const char *name, const struct security_ace_object *r)
-{
- ndr_print_struct(ndr, name, "security_ace_object");
- ndr->depth++;
- ndr_print_security_ace_object_flags(ndr, "flags", r->flags);
- ndr_print_set_switch_value(ndr, &r->type, r->flags&SEC_ACE_OBJECT_TYPE_PRESENT);
- ndr_print_security_ace_object_type(ndr, "type", &r->type);
- ndr_print_set_switch_value(ndr, &r->inherited_type, r->flags&SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT);
- ndr_print_security_ace_object_inherited_type(ndr, "inherited_type", &r->inherited_type);
- ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_security_ace_object_ctr(struct ndr_push *ndr, int ndr_flags, const union security_ace_object_ctr *r)
-{
- int level;
- level = ndr_push_get_switch_value(ndr, r);
- if (ndr_flags & NDR_SCALARS) {
- switch (level) {
- case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
- NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
- break;
-
- case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
- NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
- break;
-
- case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
- NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
- break;
-
- case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
- NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_SCALARS, &r->object));
- break;
-
- default:
- break;
-
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- switch (level) {
- case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
- NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
- break;
-
- case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
- NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
- break;
-
- case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
- NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
- break;
-
- case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
- NDR_CHECK(ndr_push_security_ace_object(ndr, NDR_BUFFERS, &r->object));
- break;
-
- default:
- break;
-
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_ace_object_ctr(struct ndr_pull *ndr, int ndr_flags, union security_ace_object_ctr *r)
-{
- int level;
- level = ndr_pull_get_switch_value(ndr, r);
- if (ndr_flags & NDR_SCALARS) {
- switch (level) {
- case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT: {
- NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
- break; }
-
- case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: {
- NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
- break; }
-
- case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT: {
- NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
- break; }
-
- case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT: {
- NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_SCALARS, &r->object));
- break; }
-
- default: {
- break; }
-
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- switch (level) {
- case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
- NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
- break;
-
- case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
- NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
- break;
-
- case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
- NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
- break;
-
- case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
- NDR_CHECK(ndr_pull_security_ace_object(ndr, NDR_BUFFERS, &r->object));
- break;
-
- default:
- break;
-
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace_object_ctr(struct ndr_print *ndr, const char *name, const union security_ace_object_ctr *r)
-{
- int level;
- level = ndr_print_get_switch_value(ndr, r);
- ndr_print_union(ndr, name, level, "security_ace_object_ctr");
- switch (level) {
- case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
- ndr_print_security_ace_object(ndr, "object", &r->object);
- break;
-
- case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
- ndr_print_security_ace_object(ndr, "object", &r->object);
- break;
-
- case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
- ndr_print_security_ace_object(ndr, "object", &r->object);
- break;
-
- case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
- ndr_print_security_ace_object(ndr, "object", &r->object);
- break;
-
- default:
- break;
-
- }
-}
-
-enum ndr_err_code ndr_push_security_ace(struct ndr_push *ndr, int ndr_flags, const struct security_ace *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_security_ace_type(ndr, NDR_SCALARS, r->type));
- NDR_CHECK(ndr_push_security_ace_flags(ndr, NDR_SCALARS, r->flags));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_ace(r,ndr->flags)));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->access_mask));
- NDR_CHECK(ndr_push_set_switch_value(ndr, &r->object, r->type));
- NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object));
- NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->trustee));
- }
- if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object));
- }
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, struct security_ace *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_security_ace_type(ndr, NDR_SCALARS, &r->type));
- NDR_CHECK(ndr_pull_security_ace_flags(ndr, NDR_SCALARS, &r->flags));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->access_mask));
- NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->object, r->type));
- NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object));
- NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->trustee));
- }
- if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object));
- }
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_ace(struct ndr_print *ndr, const char *name, const struct security_ace *r)
-{
- ndr_print_struct(ndr, name, "security_ace");
- ndr->depth++;
- ndr_print_security_ace_type(ndr, "type", r->type);
- ndr_print_security_ace_flags(ndr, "flags", r->flags);
- ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_ace(r,ndr->flags):r->size);
- ndr_print_uint32(ndr, "access_mask", r->access_mask);
- ndr_print_set_switch_value(ndr, &r->object, r->type);
- ndr_print_security_ace_object_ctr(ndr, "object", &r->object);
- ndr_print_dom_sid(ndr, "trustee", &r->trustee);
- ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_security_acl_revision(struct ndr_push *ndr, int ndr_flags, enum security_acl_revision r)
-{
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_acl_revision(struct ndr_pull *ndr, int ndr_flags, enum security_acl_revision *r)
-{
- uint16_t v;
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
- *r = (enum security_acl_revision)v;
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_acl_revision(struct ndr_print *ndr, const char *name, enum security_acl_revision r)
-{
- const char *val = NULL;
-
- switch (r) {
- case SECURITY_ACL_REVISION_NT4: val = "SECURITY_ACL_REVISION_NT4"; break;
- case SECURITY_ACL_REVISION_ADS: val = "SECURITY_ACL_REVISION_ADS"; break;
- }
- ndr_print_enum(ndr, name, "ENUM", val, r);
-}
-
-enum ndr_err_code ndr_push_security_acl(struct ndr_push *ndr, int ndr_flags, const struct security_acl *r)
-{
- uint32_t cntr_aces_0;
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_security_acl_revision(ndr, NDR_SCALARS, r->revision));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_acl(r,ndr->flags)));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_aces));
- for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
- NDR_CHECK(ndr_push_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0]));
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
- NDR_CHECK(ndr_push_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0]));
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_security_acl(struct ndr_pull *ndr, int ndr_flags, struct security_acl *r)
-{
- uint32_t cntr_aces_0;
- TALLOC_CTX *_mem_save_aces_0;
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_security_acl_revision(ndr, NDR_SCALARS, &r->revision));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_aces));
- if (r->num_aces > 1000) { /* num_aces is unsigned */
- return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
- }
- NDR_PULL_ALLOC_N(ndr, r->aces, r->num_aces);
- _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
- for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
- NDR_CHECK(ndr_pull_security_ace(ndr, NDR_SCALARS, &r->aces[cntr_aces_0]));
- }
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
- }
- if (ndr_flags & NDR_BUFFERS) {
- _mem_save_aces_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->aces, 0);
- for (cntr_aces_0 = 0; cntr_aces_0 < r->num_aces; cntr_aces_0++) {
- NDR_CHECK(ndr_pull_security_ace(ndr, NDR_BUFFERS, &r->aces[cntr_aces_0]));
- }
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_aces_0, 0);
- }
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_acl(struct ndr_print *ndr, const char *name, const struct security_acl *r)
-{
- uint32_t cntr_aces_0;
- ndr_print_struct(ndr, name, "security_acl");
- ndr->depth++;
- ndr_print_security_acl_revision(ndr, "revision", r->revision);
- ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_acl(r,ndr->flags):r->size);
- ndr_print_uint32(ndr, "num_aces", r->num_aces);
- ndr->print(ndr, "%s: ARRAY(%d)", "aces", r->num_aces);
- ndr->depth++;
- for (cntr_aces_0=0;cntr_aces_0<r->num_aces;cntr_aces_0++) {
- char *idx_0=NULL;
- asprintf(&idx_0, "[%d]", cntr_aces_0);
- if (idx_0) {
- ndr_print_security_ace(ndr, "aces", &r->aces[cntr_aces_0]);
- free(idx_0);
- }
- }
- ndr->depth--;
- ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_security_descriptor_revision(struct ndr_push *ndr, int ndr_flags, enum security_descriptor_revision r)
-{
- NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_descriptor_revision(struct ndr_pull *ndr, int ndr_flags, enum security_descriptor_revision *r)
-{
- uint8_t v;
- NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
- *r = (enum security_descriptor_revision)v;
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_descriptor_revision(struct ndr_print *ndr, const char *name, enum security_descriptor_revision r)
-{
- const char *val = NULL;
-
- switch (r) {
- case SECURITY_DESCRIPTOR_REVISION_1: val = "SECURITY_DESCRIPTOR_REVISION_1"; break;
- }
- ndr_print_enum(ndr, name, "ENUM", val, r);
-}
-
-static enum ndr_err_code ndr_push_security_descriptor_type(struct ndr_push *ndr, int ndr_flags, uint16_t r)
-{
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_security_descriptor_type(struct ndr_pull *ndr, int ndr_flags, uint16_t *r)
-{
- uint16_t v;
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
- *r = v;
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_descriptor_type(struct ndr_print *ndr, const char *name, uint16_t r)
-{
- ndr_print_uint16(ndr, name, r);
- ndr->depth++;
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_OWNER_DEFAULTED", SEC_DESC_OWNER_DEFAULTED, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_GROUP_DEFAULTED", SEC_DESC_GROUP_DEFAULTED, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PRESENT", SEC_DESC_DACL_PRESENT, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_DEFAULTED", SEC_DESC_DACL_DEFAULTED, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PRESENT", SEC_DESC_SACL_PRESENT, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_DEFAULTED", SEC_DESC_SACL_DEFAULTED, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_TRUSTED", SEC_DESC_DACL_TRUSTED, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SERVER_SECURITY", SEC_DESC_SERVER_SECURITY, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERIT_REQ", SEC_DESC_DACL_AUTO_INHERIT_REQ, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERIT_REQ", SEC_DESC_SACL_AUTO_INHERIT_REQ, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_AUTO_INHERITED", SEC_DESC_DACL_AUTO_INHERITED, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_AUTO_INHERITED", SEC_DESC_SACL_AUTO_INHERITED, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_DACL_PROTECTED", SEC_DESC_DACL_PROTECTED, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SACL_PROTECTED", SEC_DESC_SACL_PROTECTED, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_RM_CONTROL_VALID", SEC_DESC_RM_CONTROL_VALID, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint16_t), "SEC_DESC_SELF_RELATIVE", SEC_DESC_SELF_RELATIVE, r);
- ndr->depth--;
-}
-
-enum ndr_err_code ndr_push_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r)
-{
- {
- uint32_t _flags_save_STRUCT = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision));
- NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type));
- NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid));
- NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid));
- NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl));
- NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl));
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->owner_sid) {
- NDR_CHECK(ndr_push_relative_ptr2(ndr, r->owner_sid));
- NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->owner_sid));
- }
- if (r->group_sid) {
- NDR_CHECK(ndr_push_relative_ptr2(ndr, r->group_sid));
- NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->group_sid));
- }
- if (r->sacl) {
- NDR_CHECK(ndr_push_relative_ptr2(ndr, r->sacl));
- NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
- }
- if (r->dacl) {
- NDR_CHECK(ndr_push_relative_ptr2(ndr, r->dacl));
- NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
- }
- }
- ndr->flags = _flags_save_STRUCT;
- }
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r)
-{
- uint32_t _ptr_owner_sid;
- TALLOC_CTX *_mem_save_owner_sid_0;
- uint32_t _ptr_group_sid;
- TALLOC_CTX *_mem_save_group_sid_0;
- uint32_t _ptr_sacl;
- TALLOC_CTX *_mem_save_sacl_0;
- uint32_t _ptr_dacl;
- TALLOC_CTX *_mem_save_dacl_0;
- {
- uint32_t _flags_save_STRUCT = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_security_descriptor_revision(ndr, NDR_SCALARS, &r->revision));
- NDR_CHECK(ndr_pull_security_descriptor_type(ndr, NDR_SCALARS, &r->type));
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_owner_sid));
- if (_ptr_owner_sid) {
- NDR_PULL_ALLOC(ndr, r->owner_sid);
- NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->owner_sid, _ptr_owner_sid));
- } else {
- r->owner_sid = NULL;
- }
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_sid));
- if (_ptr_group_sid) {
- NDR_PULL_ALLOC(ndr, r->group_sid);
- NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->group_sid, _ptr_group_sid));
- } else {
- r->group_sid = NULL;
- }
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sacl));
- if (_ptr_sacl) {
- NDR_PULL_ALLOC(ndr, r->sacl);
- NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->sacl, _ptr_sacl));
- } else {
- r->sacl = NULL;
- }
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dacl));
- if (_ptr_dacl) {
- NDR_PULL_ALLOC(ndr, r->dacl);
- NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->dacl, _ptr_dacl));
- } else {
- r->dacl = NULL;
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->owner_sid) {
- struct ndr_pull_save _relative_save;
- ndr_pull_save(ndr, &_relative_save);
- NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->owner_sid));
- _mem_save_owner_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->owner_sid, 0);
- NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->owner_sid));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_owner_sid_0, 0);
- ndr_pull_restore(ndr, &_relative_save);
- }
- if (r->group_sid) {
- struct ndr_pull_save _relative_save;
- ndr_pull_save(ndr, &_relative_save);
- NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->group_sid));
- _mem_save_group_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->group_sid, 0);
- NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, r->group_sid));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_sid_0, 0);
- ndr_pull_restore(ndr, &_relative_save);
- }
- if (r->sacl) {
- struct ndr_pull_save _relative_save;
- ndr_pull_save(ndr, &_relative_save);
- NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->sacl));
- _mem_save_sacl_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->sacl, 0);
- NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sacl_0, 0);
- ndr_pull_restore(ndr, &_relative_save);
- }
- if (r->dacl) {
- struct ndr_pull_save _relative_save;
- ndr_pull_save(ndr, &_relative_save);
- NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->dacl));
- _mem_save_dacl_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->dacl, 0);
- NDR_CHECK(ndr_pull_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dacl_0, 0);
- ndr_pull_restore(ndr, &_relative_save);
- }
- }
- ndr->flags = _flags_save_STRUCT;
- }
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r)
-{
- ndr_print_struct(ndr, name, "security_descriptor");
- {
- uint32_t _flags_save_STRUCT = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
- ndr->depth++;
- ndr_print_security_descriptor_revision(ndr, "revision", r->revision);
- ndr_print_security_descriptor_type(ndr, "type", r->type);
- ndr_print_ptr(ndr, "owner_sid", r->owner_sid);
- ndr->depth++;
- if (r->owner_sid) {
- ndr_print_dom_sid(ndr, "owner_sid", r->owner_sid);
- }
- ndr->depth--;
- ndr_print_ptr(ndr, "group_sid", r->group_sid);
- ndr->depth++;
- if (r->group_sid) {
- ndr_print_dom_sid(ndr, "group_sid", r->group_sid);
- }
- ndr->depth--;
- ndr_print_ptr(ndr, "sacl", r->sacl);
- ndr->depth++;
- if (r->sacl) {
- ndr_print_security_acl(ndr, "sacl", r->sacl);
- }
- ndr->depth--;
- ndr_print_ptr(ndr, "dacl", r->dacl);
- ndr->depth++;
- if (r->dacl) {
- ndr_print_security_acl(ndr, "dacl", r->dacl);
- }
- ndr->depth--;
- ndr->depth--;
- ndr->flags = _flags_save_STRUCT;
- }
-}
-
-enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r)
-{
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
-{
- uint32_t v;
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
- *r = v;
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name, uint32_t r)
-{
- ndr_print_uint32(ndr, name, r);
- ndr->depth++;
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_OWNER", SECINFO_OWNER, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_GROUP", SECINFO_GROUP, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_DACL", SECINFO_DACL, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_SACL", SECINFO_SACL, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_SACL", SECINFO_UNPROTECTED_SACL, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_UNPROTECTED_DACL", SECINFO_UNPROTECTED_DACL, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_SACL", SECINFO_PROTECTED_SACL, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SECINFO_PROTECTED_DACL", SECINFO_PROTECTED_DACL, r);
- ndr->depth--;
-}
-
diff --git a/source3/librpc/ndr/security.h b/source3/librpc/ndr/security.h
deleted file mode 100644
index 99f7daf2bd..0000000000
--- a/source3/librpc/ndr/security.h
+++ /dev/null
@@ -1,257 +0,0 @@
-/* header auto-generated by pidl */
-
-#ifndef _HEADER_security
-#define _HEADER_security
-
-#define SEC_MASK_GENERIC ( 0xF0000000 )
-#define SEC_MASK_FLAGS ( 0x0F000000 )
-#define SEC_MASK_STANDARD ( 0x00FF0000 )
-#define SEC_MASK_SPECIFIC ( 0x0000FFFF )
-#define SEC_GENERIC_ALL ( 0x10000000 )
-#define SEC_GENERIC_EXECUTE ( 0x20000000 )
-#define SEC_GENERIC_WRITE ( 0x40000000 )
-#define SEC_GENERIC_READ ( 0x80000000 )
-#define SEC_FLAG_SYSTEM_SECURITY ( 0x01000000 )
-#define SEC_FLAG_MAXIMUM_ALLOWED ( 0x02000000 )
-#define SEC_STD_DELETE ( 0x00010000 )
-#define SEC_STD_READ_CONTROL ( 0x00020000 )
-#define SEC_STD_WRITE_DAC ( 0x00040000 )
-#define SEC_STD_WRITE_OWNER ( 0x00080000 )
-#define SEC_STD_SYNCHRONIZE ( 0x00100000 )
-#define SEC_STD_REQUIRED ( 0x000F0000 )
-#define SEC_STD_ALL ( 0x001F0000 )
-#define SEC_FILE_READ_DATA ( 0x00000001 )
-#define SEC_FILE_WRITE_DATA ( 0x00000002 )
-#define SEC_FILE_APPEND_DATA ( 0x00000004 )
-#define SEC_FILE_READ_EA ( 0x00000008 )
-#define SEC_FILE_WRITE_EA ( 0x00000010 )
-#define SEC_FILE_EXECUTE ( 0x00000020 )
-#define SEC_FILE_READ_ATTRIBUTE ( 0x00000080 )
-#define SEC_FILE_WRITE_ATTRIBUTE ( 0x00000100 )
-#define SEC_FILE_ALL ( 0x000001ff )
-#define SEC_DIR_LIST ( 0x00000001 )
-#define SEC_DIR_ADD_FILE ( 0x00000002 )
-#define SEC_DIR_ADD_SUBDIR ( 0x00000004 )
-#define SEC_DIR_READ_EA ( 0x00000008 )
-#define SEC_DIR_WRITE_EA ( 0x00000010 )
-#define SEC_DIR_TRAVERSE ( 0x00000020 )
-#define SEC_DIR_DELETE_CHILD ( 0x00000040 )
-#define SEC_DIR_READ_ATTRIBUTE ( 0x00000080 )
-#define SEC_DIR_WRITE_ATTRIBUTE ( 0x00000100 )
-#define SEC_REG_QUERY_VALUE ( 0x00000001 )
-#define SEC_REG_SET_VALUE ( 0x00000002 )
-#define SEC_REG_CREATE_SUBKEY ( 0x00000004 )
-#define SEC_REG_ENUM_SUBKEYS ( 0x00000008 )
-#define SEC_REG_NOTIFY ( 0x00000010 )
-#define SEC_REG_CREATE_LINK ( 0x00000020 )
-#define SEC_ADS_CREATE_CHILD ( 0x00000001 )
-#define SEC_ADS_DELETE_CHILD ( 0x00000002 )
-#define SEC_ADS_LIST ( 0x00000004 )
-#define SEC_ADS_SELF_WRITE ( 0x00000008 )
-#define SEC_ADS_READ_PROP ( 0x00000010 )
-#define SEC_ADS_WRITE_PROP ( 0x00000020 )
-#define SEC_ADS_DELETE_TREE ( 0x00000040 )
-#define SEC_ADS_LIST_OBJECT ( 0x00000080 )
-#define SEC_ADS_CONTROL_ACCESS ( 0x00000100 )
-#define SEC_RIGHTS_FILE_READ ( SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_READ_EA )
-#define SEC_RIGHTS_FILE_WRITE ( SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_WRITE_DATA|SEC_FILE_WRITE_ATTRIBUTE|SEC_FILE_WRITE_EA|SEC_FILE_APPEND_DATA )
-#define SEC_RIGHTS_FILE_EXECUTE ( SEC_STD_SYNCHRONIZE|SEC_STD_READ_CONTROL|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_EXECUTE )
-#define SEC_RIGHTS_FILE_ALL ( SEC_STD_ALL|SEC_FILE_ALL )
-#define SEC_RIGHTS_DIR_READ ( SEC_RIGHTS_FILE_READ )
-#define SEC_RIGHTS_DIR_WRITE ( SEC_RIGHTS_FILE_WRITE )
-#define SEC_RIGHTS_DIR_EXECUTE ( SEC_RIGHTS_FILE_EXECUTE )
-#define SEC_RIGHTS_DIR_ALL ( SEC_RIGHTS_FILE_ALL )
-#define SID_NULL ( "S-1-0-0" )
-#define SID_WORLD_DOMAIN ( "S-1-1" )
-#define SID_WORLD ( "S-1-1-0" )
-#define SID_CREATOR_OWNER_DOMAIN ( "S-1-3" )
-#define SID_CREATOR_OWNER ( "S-1-3-0" )
-#define SID_CREATOR_GROUP ( "S-1-3-1" )
-#define SID_NT_AUTHORITY ( "S-1-5" )
-#define SID_NT_DIALUP ( "S-1-5-1" )
-#define SID_NT_NETWORK ( "S-1-5-2" )
-#define SID_NT_BATCH ( "S-1-5-3" )
-#define SID_NT_INTERACTIVE ( "S-1-5-4" )
-#define SID_NT_SERVICE ( "S-1-5-6" )
-#define SID_NT_ANONYMOUS ( "S-1-5-7" )
-#define SID_NT_PROXY ( "S-1-5-8" )
-#define SID_NT_ENTERPRISE_DCS ( "S-1-5-9" )
-#define SID_NT_SELF ( "S-1-5-10" )
-#define SID_NT_AUTHENTICATED_USERS ( "S-1-5-11" )
-#define SID_NT_RESTRICTED ( "S-1-5-12" )
-#define SID_NT_TERMINAL_SERVER_USERS ( "S-1-5-13" )
-#define SID_NT_REMOTE_INTERACTIVE ( "S-1-5-14" )
-#define SID_NT_THIS_ORGANISATION ( "S-1-5-15" )
-#define SID_NT_SYSTEM ( "S-1-5-18" )
-#define SID_NT_LOCAL_SERVICE ( "S-1-5-19" )
-#define SID_NT_NETWORK_SERVICE ( "S-1-5-20" )
-#define SID_BUILTIN ( "S-1-5-32" )
-#define SID_BUILTIN_ADMINISTRATORS ( "S-1-5-32-544" )
-#define SID_BUILTIN_USERS ( "S-1-5-32-545" )
-#define SID_BUILTIN_GUESTS ( "S-1-5-32-546" )
-#define SID_BUILTIN_POWER_USERS ( "S-1-5-32-547" )
-#define SID_BUILTIN_ACCOUNT_OPERATORS ( "S-1-5-32-548" )
-#define SID_BUILTIN_SERVER_OPERATORS ( "S-1-5-32-549" )
-#define SID_BUILTIN_PRINT_OPERATORS ( "S-1-5-32-550" )
-#define SID_BUILTIN_BACKUP_OPERATORS ( "S-1-5-32-551" )
-#define SID_BUILTIN_REPLICATOR ( "S-1-5-32-552" )
-#define SID_BUILTIN_RAS_SERVERS ( "S-1-5-32-553" )
-#define SID_BUILTIN_PREW2K ( "S-1-5-32-554" )
-#define DOMAIN_RID_LOGON ( 9 )
-#define DOMAIN_RID_ADMINISTRATOR ( 500 )
-#define DOMAIN_RID_GUEST ( 501 )
-#define DOMAIN_RID_ADMINS ( 512 )
-#define DOMAIN_RID_USERS ( 513 )
-#define DOMAIN_RID_DCS ( 516 )
-#define DOMAIN_RID_CERT_ADMINS ( 517 )
-#define DOMAIN_RID_SCHEMA_ADMINS ( 518 )
-#define DOMAIN_RID_ENTERPRISE_ADMINS ( 519 )
-#define NT4_ACL_REVISION ( SECURITY_ACL_REVISION_NT4 )
-#define SD_REVISION ( SECURITY_DESCRIPTOR_REVISION_1 )
-enum sec_privilege {
- SEC_PRIV_SECURITY=1,
- SEC_PRIV_BACKUP=2,
- SEC_PRIV_RESTORE=3,
- SEC_PRIV_SYSTEMTIME=4,
- SEC_PRIV_SHUTDOWN=5,
- SEC_PRIV_REMOTE_SHUTDOWN=6,
- SEC_PRIV_TAKE_OWNERSHIP=7,
- SEC_PRIV_DEBUG=8,
- SEC_PRIV_SYSTEM_ENVIRONMENT=9,
- SEC_PRIV_SYSTEM_PROFILE=10,
- SEC_PRIV_PROFILE_SINGLE_PROCESS=11,
- SEC_PRIV_INCREASE_BASE_PRIORITY=12,
- SEC_PRIV_LOAD_DRIVER=13,
- SEC_PRIV_CREATE_PAGEFILE=14,
- SEC_PRIV_INCREASE_QUOTA=15,
- SEC_PRIV_CHANGE_NOTIFY=16,
- SEC_PRIV_UNDOCK=17,
- SEC_PRIV_MANAGE_VOLUME=18,
- SEC_PRIV_IMPERSONATE=19,
- SEC_PRIV_CREATE_GLOBAL=20,
- SEC_PRIV_ENABLE_DELEGATION=21,
- SEC_PRIV_INTERACTIVE_LOGON=22,
- SEC_PRIV_NETWORK_LOGON=23,
- SEC_PRIV_REMOTE_INTERACTIVE_LOGON=24
-};
-
-/* bitmap security_ace_flags */
-#define SEC_ACE_FLAG_OBJECT_INHERIT ( 0x01 )
-#define SEC_ACE_FLAG_CONTAINER_INHERIT ( 0x02 )
-#define SEC_ACE_FLAG_NO_PROPAGATE_INHERIT ( 0x04 )
-#define SEC_ACE_FLAG_INHERIT_ONLY ( 0x08 )
-#define SEC_ACE_FLAG_INHERITED_ACE ( 0x10 )
-#define SEC_ACE_FLAG_VALID_INHERIT ( 0x0f )
-#define SEC_ACE_FLAG_SUCCESSFUL_ACCESS ( 0x40 )
-#define SEC_ACE_FLAG_FAILED_ACCESS ( 0x80 )
-
-enum security_ace_type {
- SEC_ACE_TYPE_ACCESS_ALLOWED=0,
- SEC_ACE_TYPE_ACCESS_DENIED=1,
- SEC_ACE_TYPE_SYSTEM_AUDIT=2,
- SEC_ACE_TYPE_SYSTEM_ALARM=3,
- SEC_ACE_TYPE_ALLOWED_COMPOUND=4,
- SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT=5,
- SEC_ACE_TYPE_ACCESS_DENIED_OBJECT=6,
- SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT=7,
- SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT=8
-};
-
-/* bitmap security_ace_object_flags */
-#define SEC_ACE_OBJECT_TYPE_PRESENT ( 0x00000001 )
-#define SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT ( 0x00000002 )
-
-union security_ace_object_type {
- struct GUID type;/* [case(SEC_ACE_OBJECT_TYPE_PRESENT)] */
-}/* [nodiscriminant] */;
-
-union security_ace_object_inherited_type {
- struct GUID inherited_type;/* [case(SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] */
-}/* [nodiscriminant] */;
-
-struct security_ace_object {
- uint32_t flags;
- union security_ace_object_type type;/* [switch_is(flags&SEC_ACE_OBJECT_TYPE_PRESENT)] */
- union security_ace_object_inherited_type inherited_type;/* [switch_is(flags&SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] */
-};
-
-union security_ace_object_ctr {
- struct security_ace_object object;/* [case(SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT)] */
-}/* [nodiscriminant] */;
-
-struct security_ace {
- enum security_ace_type type;
- uint8_t flags;
- uint16_t size;/* [value(ndr_size_security_ace(r,ndr->flags))] */
- uint32_t access_mask;
- union security_ace_object_ctr object;/* [switch_is(type)] */
- struct dom_sid trustee;
-}/* [gensize,public,nosize] */;
-
-enum security_acl_revision {
- SECURITY_ACL_REVISION_NT4=2,
- SECURITY_ACL_REVISION_ADS=4
-};
-
-struct security_acl {
- enum security_acl_revision revision;
- uint16_t size;/* [value(ndr_size_security_acl(r,ndr->flags))] */
- uint32_t num_aces;/* [range(0 1000)] */
- struct security_ace *aces;
-}/* [gensize,public,nosize] */;
-
-enum security_descriptor_revision {
- SECURITY_DESCRIPTOR_REVISION_1=1
-};
-
-/* bitmap security_descriptor_type */
-#define SEC_DESC_OWNER_DEFAULTED ( 0x0001 )
-#define SEC_DESC_GROUP_DEFAULTED ( 0x0002 )
-#define SEC_DESC_DACL_PRESENT ( 0x0004 )
-#define SEC_DESC_DACL_DEFAULTED ( 0x0008 )
-#define SEC_DESC_SACL_PRESENT ( 0x0010 )
-#define SEC_DESC_SACL_DEFAULTED ( 0x0020 )
-#define SEC_DESC_DACL_TRUSTED ( 0x0040 )
-#define SEC_DESC_SERVER_SECURITY ( 0x0080 )
-#define SEC_DESC_DACL_AUTO_INHERIT_REQ ( 0x0100 )
-#define SEC_DESC_SACL_AUTO_INHERIT_REQ ( 0x0200 )
-#define SEC_DESC_DACL_AUTO_INHERITED ( 0x0400 )
-#define SEC_DESC_SACL_AUTO_INHERITED ( 0x0800 )
-#define SEC_DESC_DACL_PROTECTED ( 0x1000 )
-#define SEC_DESC_SACL_PROTECTED ( 0x2000 )
-#define SEC_DESC_RM_CONTROL_VALID ( 0x4000 )
-#define SEC_DESC_SELF_RELATIVE ( 0x8000 )
-
-struct security_descriptor {
- enum security_descriptor_revision revision;
- uint16_t type;
- struct dom_sid *owner_sid;/* [relative] */
- struct dom_sid *group_sid;/* [relative] */
- struct security_acl *sacl;/* [relative] */
- struct security_acl *dacl;/* [relative] */
-}/* [gensize,public,flag(LIBNDR_FLAG_LITTLE_ENDIAN),nosize] */;
-
-struct sec_desc_buf {
- uint32_t sd_size;/* [value(ndr_size_security_descriptor(sd,ndr->flags)),range(0 0x40000)] */
- struct security_descriptor *sd;/* [unique,subcontext(4)] */
-}/* [public] */;
-
-struct security_token {
- struct dom_sid *user_sid;/* [unique] */
- struct dom_sid *group_sid;/* [unique] */
- uint32_t num_sids;
- struct dom_sid **sids;/* [unique,size_is(num_sids)] */
- uint64_t privilege_mask;
-}/* [public] */;
-
-/* bitmap security_secinfo */
-#define SECINFO_OWNER ( 0x00000001 )
-#define SECINFO_GROUP ( 0x00000002 )
-#define SECINFO_DACL ( 0x00000004 )
-#define SECINFO_SACL ( 0x00000008 )
-#define SECINFO_UNPROTECTED_SACL ( 0x10000000 )
-#define SECINFO_UNPROTECTED_DACL ( 0x20000000 )
-#define SECINFO_PROTECTED_SACL ( 0x40000000 )
-#define SECINFO_PROTECTED_DACL ( 0x80000000 )
-
-#endif /* _HEADER_security */
diff --git a/source3/librpc/ndr/sid.c b/source3/librpc/ndr/sid.c
index 89ab2b8ea5..b6ec045806 100644
--- a/source3/librpc/ndr/sid.c
+++ b/source3/librpc/ndr/sid.c
@@ -187,70 +187,3 @@ enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const
return NDR_ERR_SUCCESS;
}
-
-enum ndr_err_code ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_security_descriptor(r->sd,ndr->flags)));
- NDR_CHECK(ndr_push_unique_ptr(ndr, r->sd));
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->sd) {
- {
- struct ndr_push *_ndr_sd;
- NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sd, 4, -1));
- NDR_CHECK(ndr_push_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
- NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sd, 4, -1));
- }
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r)
-{
- uint32_t _ptr_sd;
- TALLOC_CTX *_mem_save_sd_0;
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sd_size));
- if (r->sd_size > 0x40000) { /* sd_size is unsigned */
- return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
- }
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sd));
- if (_ptr_sd) {
- NDR_PULL_ALLOC(ndr, r->sd);
- } else {
- r->sd = NULL;
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->sd) {
- _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->sd, 0);
- {
- struct ndr_pull *_ndr_sd;
- NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sd, 4, -1));
- NDR_CHECK(ndr_pull_security_descriptor(_ndr_sd, NDR_SCALARS|NDR_BUFFERS, r->sd));
- NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sd, 4, -1));
- }
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, 0);
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, const struct sec_desc_buf *r)
-{
- ndr_print_struct(ndr, name, "sec_desc_buf");
- ndr->depth++;
- ndr_print_uint32(ndr, "sd_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_descriptor(r->sd,ndr->flags):r->sd_size);
- ndr_print_ptr(ndr, "sd", r->sd);
- ndr->depth++;
- if (r->sd) {
- ndr_print_security_descriptor(ndr, "sd", r->sd);
- }
- ndr->depth--;
- ndr->depth--;
-}