diff options
Diffstat (limited to 'source4/librpc/ndr')
-rw-r--r-- | source4/librpc/ndr/ndr_samr.c | 93 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_samr.h | 27 |
2 files changed, 112 insertions, 8 deletions
diff --git a/source4/librpc/ndr/ndr_samr.c b/source4/librpc/ndr/ndr_samr.c index 8a972b426f..10f30afa2c 100644 --- a/source4/librpc/ndr/ndr_samr.c +++ b/source4/librpc/ndr/ndr_samr.c @@ -70,14 +70,19 @@ NTSTATUS ndr_push_samr_EnumDomains(struct ndr_push *ndr, struct samr_EnumDomains return NT_STATUS_OK; } -NTSTATUS ndr_push_samr_OPEN_DOMAIN(struct ndr_push *ndr, struct samr_OPEN_DOMAIN *r) +NTSTATUS ndr_push_samr_OpenDomain(struct ndr_push *ndr, struct samr_OpenDomain *r) { + NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle)); + NDR_CHECK(ndr_push_uint32(ndr, r->in.access_mask)); + NDR_CHECK(ndr_push_dom_sid2(ndr, r->in.sid)); return NT_STATUS_OK; } -NTSTATUS ndr_push_samr_QUERY_DOMAIN_INFO(struct ndr_push *ndr, struct samr_QUERY_DOMAIN_INFO *r) +NTSTATUS ndr_push_samr_QueryDomainInfo(struct ndr_push *ndr, struct samr_QueryDomainInfo *r) { + NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle)); + NDR_CHECK(ndr_push_uint16(ndr, r->in.level)); return NT_STATUS_OK; } @@ -578,15 +583,70 @@ NTSTATUS ndr_pull_samr_EnumDomains(struct ndr_pull *ndr, struct samr_EnumDomains return NT_STATUS_OK; } -NTSTATUS ndr_pull_samr_OPEN_DOMAIN(struct ndr_pull *ndr, struct samr_OPEN_DOMAIN *r) +NTSTATUS ndr_pull_samr_OpenDomain(struct ndr_pull *ndr, struct samr_OpenDomain *r) { + NDR_CHECK(ndr_pull_policy_handle(ndr, r->out.domain_handle)); NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result)); return NT_STATUS_OK; } -NTSTATUS ndr_pull_samr_QUERY_DOMAIN_INFO(struct ndr_pull *ndr, struct samr_QUERY_DOMAIN_INFO *r) +static NTSTATUS ndr_pull_samr_DomInfo1(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo1 *r) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_uint16(ndr, &r->min_length_password)); + NDR_CHECK(ndr_pull_uint16(ndr, &r->password_history)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->flag)); + NDR_CHECK(ndr_pull_NTTIME(ndr, &r->expire)); + NDR_CHECK(ndr_pull_NTTIME(ndr, &r->min_passwordage)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_samr_DomainInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union samr_DomainInfo *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_uint16(ndr, level)); + switch (*level) { + case 1: { + NDR_CHECK(ndr_pull_samr_DomInfo1(ndr, NDR_SCALARS, &r->info1)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level); + } +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + switch (*level) { + case 1: + NDR_CHECK(ndr_pull_samr_DomInfo1(ndr, NDR_BUFFERS, &r->info1)); + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level); + } +done: + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_samr_QueryDomainInfo(struct ndr_pull *ndr, struct samr_QueryDomainInfo *r) +{ + uint32 _ptr_info; + NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_info)); + if (_ptr_info) { + NDR_ALLOC(ndr, r->out.info); + } else { + r->out.info = NULL; + } + if (r->out.info) { + { uint16 _level; + NDR_CHECK(ndr_pull_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, &_level, r->out.info)); + if (((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) && (_level != r->in.level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info"); + } + } NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result)); return NT_STATUS_OK; @@ -1044,3 +1104,28 @@ void ndr_print_samr_SamArray(struct ndr_print *ndr, const char *name, struct sam ndr->depth--; } +void ndr_print_samr_DomInfo1(struct ndr_print *ndr, const char *name, struct samr_DomInfo1 *r) +{ + ndr_print_struct(ndr, name, "samr_DomInfo1"); + ndr->depth++; + ndr_print_uint16(ndr, "min_length_password", r->min_length_password); + ndr_print_uint16(ndr, "password_history", r->password_history); + ndr_print_uint32(ndr, "flag", r->flag); + ndr_print_NTTIME(ndr, "expire", r->expire); + ndr_print_NTTIME(ndr, "min_passwordage", r->min_passwordage); + ndr->depth--; +} + +void ndr_print_samr_DomainInfo(struct ndr_print *ndr, const char *name, uint16 level, union samr_DomainInfo *r) +{ + ndr_print_union(ndr, name, level, "samr_DomainInfo"); + switch (level) { + case 1: + ndr_print_samr_DomInfo1(ndr, "info1", &r->info1); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + diff --git a/source4/librpc/ndr/ndr_samr.h b/source4/librpc/ndr/ndr_samr.h index f24dde1ec5..9bf4682563 100644 --- a/source4/librpc/ndr/ndr_samr.h +++ b/source4/librpc/ndr/ndr_samr.h @@ -98,21 +98,40 @@ struct samr_EnumDomains { }; -struct samr_OPEN_DOMAIN { +struct samr_OpenDomain { struct { + struct policy_handle *handle; + uint32 access_mask; + struct dom_sid2 *sid; } in; struct { + struct policy_handle *domain_handle; NTSTATUS result; } out; }; -struct samr_QUERY_DOMAIN_INFO { +struct samr_DomInfo1 { + uint16 min_length_password; + uint16 password_history; + uint32 flag; + NTTIME expire; + NTTIME min_passwordage; +}; + +union samr_DomainInfo { +/* [case(1)] */ struct samr_DomInfo1 info1; +}; + +struct samr_QueryDomainInfo { struct { + struct policy_handle *handle; + uint16 level; } in; struct { + union samr_DomainInfo *info; NTSTATUS result; } out; @@ -719,8 +738,8 @@ struct samr_VALIDATE_PASSWORD { #define DCERPC_SAMR_SHUTDOWN 4 #define DCERPC_SAMR_LOOKUPDOMAIN 5 #define DCERPC_SAMR_ENUMDOMAINS 6 -#define DCERPC_SAMR_OPEN_DOMAIN 7 -#define DCERPC_SAMR_QUERY_DOMAIN_INFO 8 +#define DCERPC_SAMR_OPENDOMAIN 7 +#define DCERPC_SAMR_QUERYDOMAININFO 8 #define DCERPC_SAMR_SET_DOMAIN_INFO 9 #define DCERPC_SAMR_CREATE_DOM_GROUP 10 #define DCERPC_SAMR_ENUM_DOM_GROUPS 11 |