diff options
Diffstat (limited to 'source4/librpc/ndr')
-rw-r--r-- | source4/librpc/ndr/ndr_lsa.c | 88 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_lsa.h | 22 |
2 files changed, 104 insertions, 6 deletions
diff --git a/source4/librpc/ndr/ndr_lsa.c b/source4/librpc/ndr/ndr_lsa.c index 37850fbf19..59d3fc9b7b 100644 --- a/source4/librpc/ndr/ndr_lsa.c +++ b/source4/librpc/ndr/ndr_lsa.c @@ -726,7 +726,6 @@ NTSTATUS ndr_push_lsa_LookupNames(struct ndr_push *ndr, struct lsa_LookupNames * NTSTATUS ndr_pull_lsa_LookupNames(struct ndr_pull *ndr, struct lsa_LookupNames *r) { uint32 _ptr_domains; - NDR_ALLOC(ndr, r->out.domains); NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_domains)); if (_ptr_domains) { NDR_ALLOC(ndr, r->out.domains); @@ -818,7 +817,6 @@ NTSTATUS ndr_push_lsa_LookupSids(struct ndr_push *ndr, struct lsa_LookupSids *r) NTSTATUS ndr_pull_lsa_LookupSids(struct ndr_pull *ndr, struct lsa_LookupSids *r) { uint32 _ptr_domains; - NDR_ALLOC(ndr, r->out.domains); NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_domains)); if (_ptr_domains) { NDR_ALLOC(ndr, r->out.domains); @@ -865,14 +863,96 @@ NTSTATUS ndr_pull_lsa_OpenAccount(struct ndr_pull *ndr, struct lsa_OpenAccount * return NT_STATUS_OK; } -NTSTATUS ndr_push_ENUMPRIVSACCOUNT(struct ndr_push *ndr, struct ENUMPRIVSACCOUNT *r) +static NTSTATUS ndr_push_lsa_LUID(struct ndr_push *ndr, int ndr_flags, struct lsa_LUID *r) { + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_push_uint32(ndr, r->low)); + NDR_CHECK(ndr_push_uint32(ndr, r->high)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; +done: + return NT_STATUS_OK; +} +static NTSTATUS ndr_pull_lsa_LUID(struct ndr_pull *ndr, int ndr_flags, struct lsa_LUID *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_uint32(ndr, &r->low)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->high)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; +done: return NT_STATUS_OK; } -NTSTATUS ndr_pull_ENUMPRIVSACCOUNT(struct ndr_pull *ndr, struct ENUMPRIVSACCOUNT *r) +static NTSTATUS ndr_push_lsa_LUIDAttribute(struct ndr_push *ndr, int ndr_flags, struct lsa_LUIDAttribute *r) { + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_push_lsa_LUID(ndr, NDR_SCALARS, &r->luid)); + NDR_CHECK(ndr_push_uint32(ndr, r->attribute)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_CHECK(ndr_push_lsa_LUID(ndr, ndr_flags, &r->luid)); +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_lsa_LUIDAttribute(struct ndr_pull *ndr, int ndr_flags, struct lsa_LUIDAttribute *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_lsa_LUID(ndr, NDR_SCALARS, &r->luid)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->attribute)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_CHECK(ndr_pull_lsa_LUID(ndr, ndr_flags, &r->luid)); +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_push_lsa_PrivilegeSet(struct ndr_push *ndr, int ndr_flags, struct lsa_PrivilegeSet *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_push_uint32(ndr, r->count)); + NDR_CHECK(ndr_push_lsa_LUIDAttribute(ndr, NDR_SCALARS, r->set)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_CHECK(ndr_push_array(ndr, ndr_flags, r->set, sizeof(r->set[0]), r->count, (ndr_push_flags_fn_t)ndr_push_lsa_LUIDAttribute)); +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_lsa_PrivilegeSet(struct ndr_pull *ndr, int ndr_flags, struct lsa_PrivilegeSet *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_uint32(ndr, &r->count)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_ALLOC_N_SIZE(ndr, r->set, r->count, sizeof(r->set[0])); + NDR_CHECK(ndr_pull_array(ndr, ndr_flags, (void **)r->set, sizeof(r->set[0]), r->count, (ndr_pull_flags_fn_t)ndr_pull_lsa_LUIDAttribute)); +done: + return NT_STATUS_OK; +} + +NTSTATUS ndr_push_lsa_EnumPrivsAccount(struct ndr_push *ndr, struct lsa_EnumPrivsAccount *r) +{ + NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle)); + + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_lsa_EnumPrivsAccount(struct ndr_pull *ndr, struct lsa_EnumPrivsAccount *r) +{ + uint32 _ptr_privs; + NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_privs)); + if (_ptr_privs) { + NDR_ALLOC(ndr, r->out.privs); + } else { + r->out.privs = NULL; + } + if (r->out.privs) { + NDR_CHECK(ndr_pull_lsa_PrivilegeSet(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.privs)); + } + NDR_CHECK(ndr_pull_uint32(ndr, &r->out.unknown)); NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result)); return NT_STATUS_OK; diff --git a/source4/librpc/ndr/ndr_lsa.h b/source4/librpc/ndr/ndr_lsa.h index 473cf370c6..f8c4ab5f6a 100644 --- a/source4/librpc/ndr/ndr_lsa.h +++ b/source4/librpc/ndr/ndr_lsa.h @@ -306,11 +306,29 @@ struct lsa_OpenAccount { }; -struct ENUMPRIVSACCOUNT { +struct lsa_LUID { + uint32 low; + uint32 high; +}; + +struct lsa_LUIDAttribute { + struct lsa_LUID luid; + uint32 attribute; +}; + +struct lsa_PrivilegeSet { + uint32 count; + struct lsa_LUIDAttribute *set; +}; + +struct lsa_EnumPrivsAccount { struct { + struct policy_handle *handle; } in; struct { + struct lsa_PrivilegeSet *privs; + uint32 unknown; NTSTATUS result; } out; @@ -618,7 +636,7 @@ struct QUERYINFO2 { #define DCERPC_LSA_LOOKUPSIDS 15 #define DCERPC_CREATESECRET 16 #define DCERPC_LSA_OPENACCOUNT 17 -#define DCERPC_ENUMPRIVSACCOUNT 18 +#define DCERPC_LSA_ENUMPRIVSACCOUNT 18 #define DCERPC_ADDPRIVS 19 #define DCERPC_REMOVEPRIVS 20 #define DCERPC_GETQUOTAS 21 |