diff options
author | Simo Sorce <idra@samba.org> | 2010-03-23 01:06:24 -0400 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2010-03-23 01:09:50 -0400 |
commit | 9f84d72ef16d3be926f6caffe3c86b4a61b9fc11 (patch) | |
tree | bbd454a10b2840cb953b9a1df3402ee98d233a64 /librpc | |
parent | d9e311ddce50a6decc55ea442f562d11f06e2f78 (diff) | |
download | samba-9f84d72ef16d3be926f6caffe3c86b4a61b9fc11.tar.gz samba-9f84d72ef16d3be926f6caffe3c86b4a61b9fc11.tar.xz samba-9f84d72ef16d3be926f6caffe3c86b4a61b9fc11.zip |
idl:drsblobs add code to interpret msDS-TrustForestTrustInfo
Diffstat (limited to 'librpc')
-rw-r--r-- | librpc/gen_ndr/drsblobs.h | 56 | ||||
-rw-r--r-- | librpc/gen_ndr/ndr_drsblobs.c | 484 | ||||
-rw-r--r-- | librpc/gen_ndr/ndr_drsblobs.h | 13 | ||||
-rw-r--r-- | librpc/idl/drsblobs.idl | 50 | ||||
-rw-r--r-- | librpc/idl/idl_types.h | 5 |
5 files changed, 605 insertions, 3 deletions
diff --git a/librpc/gen_ndr/drsblobs.h b/librpc/gen_ndr/drsblobs.h index 7fa201daf6d..83a6978353b 100644 --- a/librpc/gen_ndr/drsblobs.h +++ b/librpc/gen_ndr/drsblobs.h @@ -8,6 +8,7 @@ #include "librpc/gen_ndr/misc.h" #include "librpc/gen_ndr/samr.h" #include "librpc/gen_ndr/lsa.h" +#include "librpc/gen_ndr/security.h" #ifndef _HEADER_drsblobs #define _HEADER_drsblobs @@ -456,6 +457,53 @@ struct ExtendedErrorInfoPtr { struct ExtendedErrorInfo *info;/* [unique] */ }; +struct ForestTrustDataDomainInfo { + uint32_t sid_size;/* [value(ndr_size_dom_sid0(&sid,ndr->flags))] */ + struct dom_sid sid;/* [subcontext_size(sid_size),subcontext(0)] */ + const char * dns_name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_SIZE4)] */ + const char * netbios_name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_SIZE4)] */ +}/* [flag(LIBNDR_FLAG_NOALIGN)] */; + +struct ForestTrustDataBinaryData { + uint32_t size; + uint8_t *data; +}/* [flag(LIBNDR_FLAG_NOALIGN)] */; + +union ForestTrustData { + const char * name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_SIZE4),case(FOREST_TRUST_TOP_LEVEL_NAME)] */ + struct ForestTrustDataDomainInfo info;/* [case(FOREST_TRUST_DOMAIN_INFO)] */ + struct ForestTrustDataBinaryData data;/* [default] */ +}/* [nodiscriminant] */; + +enum ForestTrustInfoRecordType +#ifndef USE_UINT_ENUMS + { + FOREST_TRUST_TOP_LEVEL_NAME=(int)(0), + FOREST_TRUST_TOP_LEVEL_NAME_EX=(int)(1), + FOREST_TRUST_DOMAIN_INFO=(int)(2) +} +#else + { __donnot_use_enum_ForestTrustInfoRecordType=0x7FFFFFFF} +#define FOREST_TRUST_TOP_LEVEL_NAME ( 0 ) +#define FOREST_TRUST_TOP_LEVEL_NAME_EX ( 1 ) +#define FOREST_TRUST_DOMAIN_INFO ( 2 ) +#endif +; + +struct ForestTrustInfoRecord { + uint32_t length; + uint32_t flags; + NTTIME timestamp; + enum ForestTrustInfoRecordType type; + union ForestTrustData data;/* [switch_is(type)] */ +}/* [flag(LIBNDR_FLAG_NOALIGN)] */; + +struct ForestTrustInfo { + uint32_t version; + uint32_t count; + struct ForestTrustInfoRecord *records; +}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */; + struct decode_replPropertyMetaData { struct { @@ -568,4 +616,12 @@ struct decode_ExtendedErrorInfo { }; + +struct decode_ForestTrustInfo { + struct { + struct ForestTrustInfo blob; + } in; + +}; + #endif /* _HEADER_drsblobs */ diff --git a/librpc/gen_ndr/ndr_drsblobs.c b/librpc/gen_ndr/ndr_drsblobs.c index 807d15f267e..aa2eeb7da26 100644 --- a/librpc/gen_ndr/ndr_drsblobs.c +++ b/librpc/gen_ndr/ndr_drsblobs.c @@ -7,6 +7,7 @@ #include "librpc/gen_ndr/ndr_misc.h" #include "librpc/gen_ndr/ndr_samr.h" #include "librpc/gen_ndr/ndr_lsa.h" +#include "librpc/gen_ndr/ndr_security.h" static enum ndr_err_code ndr_push_replPropertyMetaData1(struct ndr_push *ndr, int ndr_flags, const struct replPropertyMetaData1 *r) { if (ndr_flags & NDR_SCALARS) { @@ -4057,6 +4058,438 @@ _PUBLIC_ void ndr_print_ExtendedErrorInfoPtr(struct ndr_print *ndr, const char * ndr->depth--; } +static enum ndr_err_code ndr_push_ForestTrustDataDomainInfo(struct ndr_push *ndr, int ndr_flags, const struct ForestTrustDataDomainInfo *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid0(&r->sid, ndr->flags))); + { + struct ndr_push *_ndr_sid; + NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags))); + NDR_CHECK(ndr_push_dom_sid(_ndr_sid, NDR_SCALARS, &r->sid)); + NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags))); + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_SIZE4); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->dns_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_SIZE4); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->netbios_name)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_push_trailer_align(ndr, 4)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_ForestTrustDataDomainInfo(struct ndr_pull *ndr, int ndr_flags, struct ForestTrustDataDomainInfo *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_size)); + { + struct ndr_pull *_ndr_sid; + NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sid, 0, r->sid_size)); + NDR_CHECK(ndr_pull_dom_sid(_ndr_sid, NDR_SCALARS, &r->sid)); + NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sid, 0, r->sid_size)); + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_SIZE4); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->dns_name)); + ndr->flags = _flags_save_string; + } + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_SIZE4); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->netbios_name)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_pull_trailer_align(ndr, 4)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_ForestTrustDataDomainInfo(struct ndr_print *ndr, const char *name, const struct ForestTrustDataDomainInfo *r) +{ + ndr_print_struct(ndr, name, "ForestTrustDataDomainInfo"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + ndr->depth++; + ndr_print_uint32(ndr, "sid_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_dom_sid0(&r->sid, ndr->flags):r->sid_size); + ndr_print_dom_sid(ndr, "sid", &r->sid); + ndr_print_string(ndr, "dns_name", r->dns_name); + ndr_print_string(ndr, "netbios_name", r->netbios_name); + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + +static enum ndr_err_code ndr_push_ForestTrustDataBinaryData(struct ndr_push *ndr, int ndr_flags, const struct ForestTrustDataBinaryData *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->size)); + NDR_CHECK(ndr_push_trailer_align(ndr, 4)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_ForestTrustDataBinaryData(struct ndr_pull *ndr, int ndr_flags, struct ForestTrustDataBinaryData *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size)); + NDR_PULL_ALLOC_N(ndr, r->data, r->size); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, r->size)); + NDR_CHECK(ndr_pull_trailer_align(ndr, 4)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_ForestTrustDataBinaryData(struct ndr_print *ndr, const char *name, const struct ForestTrustDataBinaryData *r) +{ + ndr_print_struct(ndr, name, "ForestTrustDataBinaryData"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + ndr->depth++; + ndr_print_uint32(ndr, "size", r->size); + ndr_print_array_uint8(ndr, "data", r->data, r->size); + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + +static enum ndr_err_code ndr_push_ForestTrustData(struct ndr_push *ndr, int ndr_flags, const union ForestTrustData *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + NDR_CHECK(ndr_push_union_align(ndr, 4)); + switch (level) { + case FOREST_TRUST_TOP_LEVEL_NAME: { + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_SIZE4); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name)); + ndr->flags = _flags_save_string; + } + break; } + + case FOREST_TRUST_TOP_LEVEL_NAME_EX: { + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_SIZE4); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name)); + ndr->flags = _flags_save_string; + } + break; } + + case FOREST_TRUST_DOMAIN_INFO: { + NDR_CHECK(ndr_push_ForestTrustDataDomainInfo(ndr, NDR_SCALARS, &r->info)); + break; } + + default: { + NDR_CHECK(ndr_push_ForestTrustDataBinaryData(ndr, NDR_SCALARS, &r->data)); + break; } + + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case FOREST_TRUST_TOP_LEVEL_NAME: + break; + + case FOREST_TRUST_TOP_LEVEL_NAME_EX: + break; + + case FOREST_TRUST_DOMAIN_INFO: + break; + + default: + break; + + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_ForestTrustData(struct ndr_pull *ndr, int ndr_flags, union ForestTrustData *r) +{ + int level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_union_align(ndr, 4)); + switch (level) { + case FOREST_TRUST_TOP_LEVEL_NAME: { + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_SIZE4); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name)); + ndr->flags = _flags_save_string; + } + break; } + + case FOREST_TRUST_TOP_LEVEL_NAME_EX: { + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_SIZE4); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name)); + ndr->flags = _flags_save_string; + } + break; } + + case FOREST_TRUST_DOMAIN_INFO: { + NDR_CHECK(ndr_pull_ForestTrustDataDomainInfo(ndr, NDR_SCALARS, &r->info)); + break; } + + default: { + NDR_CHECK(ndr_pull_ForestTrustDataBinaryData(ndr, NDR_SCALARS, &r->data)); + break; } + + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case FOREST_TRUST_TOP_LEVEL_NAME: + break; + + case FOREST_TRUST_TOP_LEVEL_NAME_EX: + break; + + case FOREST_TRUST_DOMAIN_INFO: + break; + + default: + break; + + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_ForestTrustData(struct ndr_print *ndr, const char *name, const union ForestTrustData *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "ForestTrustData"); + switch (level) { + case FOREST_TRUST_TOP_LEVEL_NAME: + ndr_print_string(ndr, "name", r->name); + break; + + case FOREST_TRUST_TOP_LEVEL_NAME_EX: + ndr_print_string(ndr, "name", r->name); + break; + + case FOREST_TRUST_DOMAIN_INFO: + ndr_print_ForestTrustDataDomainInfo(ndr, "info", &r->info); + break; + + default: + ndr_print_ForestTrustDataBinaryData(ndr, "data", &r->data); + break; + + } +} + +static enum ndr_err_code ndr_push_ForestTrustInfoRecordType(struct ndr_push *ndr, int ndr_flags, enum ForestTrustInfoRecordType r) +{ + NDR_CHECK(ndr_push_enum_uint8(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_ForestTrustInfoRecordType(struct ndr_pull *ndr, int ndr_flags, enum ForestTrustInfoRecordType *r) +{ + uint8_t v; + NDR_CHECK(ndr_pull_enum_uint8(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_ForestTrustInfoRecordType(struct ndr_print *ndr, const char *name, enum ForestTrustInfoRecordType r) +{ + const char *val = NULL; + + switch (r) { + case FOREST_TRUST_TOP_LEVEL_NAME: val = "FOREST_TRUST_TOP_LEVEL_NAME"; break; + case FOREST_TRUST_TOP_LEVEL_NAME_EX: val = "FOREST_TRUST_TOP_LEVEL_NAME_EX"; break; + case FOREST_TRUST_DOMAIN_INFO: val = "FOREST_TRUST_DOMAIN_INFO"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_ForestTrustInfoRecord(struct ndr_push *ndr, int ndr_flags, const struct ForestTrustInfoRecord *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->flags)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->timestamp)); + NDR_CHECK(ndr_push_ForestTrustInfoRecordType(ndr, NDR_SCALARS, r->type)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->data, r->type)); + NDR_CHECK(ndr_push_ForestTrustData(ndr, NDR_SCALARS, &r->data)); + NDR_CHECK(ndr_push_trailer_align(ndr, 4)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_ForestTrustInfoRecord(struct ndr_pull *ndr, int ndr_flags, struct ForestTrustInfoRecord *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->flags)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->timestamp)); + NDR_CHECK(ndr_pull_ForestTrustInfoRecordType(ndr, NDR_SCALARS, &r->type)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->data, r->type)); + NDR_CHECK(ndr_pull_ForestTrustData(ndr, NDR_SCALARS, &r->data)); + NDR_CHECK(ndr_pull_trailer_align(ndr, 4)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_ForestTrustInfoRecord(struct ndr_print *ndr, const char *name, const struct ForestTrustInfoRecord *r) +{ + ndr_print_struct(ndr, name, "ForestTrustInfoRecord"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + ndr->depth++; + ndr_print_uint32(ndr, "length", r->length); + ndr_print_uint32(ndr, "flags", r->flags); + ndr_print_NTTIME(ndr, "timestamp", r->timestamp); + ndr_print_ForestTrustInfoRecordType(ndr, "type", r->type); + ndr_print_set_switch_value(ndr, &r->data, r->type); + ndr_print_ForestTrustData(ndr, "data", &r->data); + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + +_PUBLIC_ enum ndr_err_code ndr_push_ForestTrustInfo(struct ndr_push *ndr, int ndr_flags, const struct ForestTrustInfo *r) +{ + uint32_t cntr_records_0; + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->version)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_records_0 = 0; cntr_records_0 < r->count; cntr_records_0++) { + NDR_CHECK(ndr_push_ForestTrustInfoRecord(ndr, NDR_SCALARS, &r->records[cntr_records_0])); + } + NDR_CHECK(ndr_push_trailer_align(ndr, 4)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_ForestTrustInfo(struct ndr_pull *ndr, int ndr_flags, struct ForestTrustInfo *r) +{ + uint32_t cntr_records_0; + TALLOC_CTX *_mem_save_records_0; + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->version)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + NDR_PULL_ALLOC_N(ndr, r->records, r->count); + _mem_save_records_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->records, 0); + for (cntr_records_0 = 0; cntr_records_0 < r->count; cntr_records_0++) { + NDR_CHECK(ndr_pull_ForestTrustInfoRecord(ndr, NDR_SCALARS, &r->records[cntr_records_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_records_0, 0); + NDR_CHECK(ndr_pull_trailer_align(ndr, 4)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_ForestTrustInfo(struct ndr_print *ndr, const char *name, const struct ForestTrustInfo *r) +{ + uint32_t cntr_records_0; + ndr_print_struct(ndr, name, "ForestTrustInfo"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN); + ndr->depth++; + ndr_print_uint32(ndr, "version", r->version); + ndr_print_uint32(ndr, "count", r->count); + ndr->print(ndr, "%s: ARRAY(%d)", "records", (int)r->count); + ndr->depth++; + for (cntr_records_0=0;cntr_records_0<r->count;cntr_records_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_records_0) != -1) { + ndr_print_ForestTrustInfoRecord(ndr, "records", &r->records[cntr_records_0]); + free(idx_0); + } + } + ndr->depth--; + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + static enum ndr_err_code ndr_push_decode_replPropertyMetaData(struct ndr_push *ndr, int flags, const struct decode_replPropertyMetaData *r) { if (flags & NDR_IN) { @@ -4641,6 +5074,47 @@ _PUBLIC_ void ndr_print_decode_ExtendedErrorInfo(struct ndr_print *ndr, const ch ndr->depth--; } +static enum ndr_err_code ndr_push_decode_ForestTrustInfo(struct ndr_push *ndr, int flags, const struct decode_ForestTrustInfo *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_ForestTrustInfo(ndr, NDR_SCALARS, &r->in.blob)); + } + if (flags & NDR_OUT) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_decode_ForestTrustInfo(struct ndr_pull *ndr, int flags, struct decode_ForestTrustInfo *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_ForestTrustInfo(ndr, NDR_SCALARS, &r->in.blob)); + } + if (flags & NDR_OUT) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_decode_ForestTrustInfo(struct ndr_print *ndr, const char *name, int flags, const struct decode_ForestTrustInfo *r) +{ + ndr_print_struct(ndr, name, "decode_ForestTrustInfo"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "decode_ForestTrustInfo"); + ndr->depth++; + ndr_print_ForestTrustInfo(ndr, "blob", &r->in.blob); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "decode_ForestTrustInfo"); + ndr->depth++; + ndr->depth--; + } + ndr->depth--; +} + static const struct ndr_interface_call drsblobs_calls[] = { { "decode_replPropertyMetaData", @@ -4754,6 +5228,14 @@ static const struct ndr_interface_call drsblobs_calls[] = { (ndr_print_function_t) ndr_print_decode_ExtendedErrorInfo, false, }, + { + "decode_ForestTrustInfo", + sizeof(struct decode_ForestTrustInfo), + (ndr_push_flags_fn_t) ndr_push_decode_ForestTrustInfo, + (ndr_pull_flags_fn_t) ndr_pull_decode_ForestTrustInfo, + (ndr_print_function_t) ndr_print_decode_ForestTrustInfo, + false, + }, { NULL, 0, NULL, NULL, NULL, false } }; @@ -4783,7 +5265,7 @@ const struct ndr_interface_table ndr_table_drsblobs = { NDR_DRSBLOBS_VERSION }, .helpstring = NDR_DRSBLOBS_HELPSTRING, - .num_calls = 14, + .num_calls = 15, .calls = drsblobs_calls, .endpoints = &drsblobs_endpoints, .authservices = &drsblobs_authservices diff --git a/librpc/gen_ndr/ndr_drsblobs.h b/librpc/gen_ndr/ndr_drsblobs.h index 866334853a8..226403d7eba 100644 --- a/librpc/gen_ndr/ndr_drsblobs.h +++ b/librpc/gen_ndr/ndr_drsblobs.h @@ -40,7 +40,9 @@ extern const struct ndr_interface_table ndr_table_drsblobs; #define NDR_DECODE_EXTENDEDERRORINFO (0x0d) -#define NDR_DRSBLOBS_CALL_COUNT (14) +#define NDR_DECODE_FORESTTRUSTINFO (0x0e) + +#define NDR_DRSBLOBS_CALL_COUNT (15) void ndr_print_replPropertyMetaData1(struct ndr_print *ndr, const char *name, const struct replPropertyMetaData1 *r); void ndr_print_replPropertyMetaDataCtr1(struct ndr_print *ndr, const char *name, const struct replPropertyMetaDataCtr1 *r); void ndr_print_replPropertyMetaDataCtr(struct ndr_print *ndr, const char *name, const union replPropertyMetaDataCtr *r); @@ -156,6 +158,14 @@ enum ndr_err_code ndr_push_ExtendedErrorInfo(struct ndr_push *ndr, int ndr_flags enum ndr_err_code ndr_pull_ExtendedErrorInfo(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorInfo *r); void ndr_print_ExtendedErrorInfo(struct ndr_print *ndr, const char *name, const struct ExtendedErrorInfo *r); void ndr_print_ExtendedErrorInfoPtr(struct ndr_print *ndr, const char *name, const struct ExtendedErrorInfoPtr *r); +void ndr_print_ForestTrustDataDomainInfo(struct ndr_print *ndr, const char *name, const struct ForestTrustDataDomainInfo *r); +void ndr_print_ForestTrustDataBinaryData(struct ndr_print *ndr, const char *name, const struct ForestTrustDataBinaryData *r); +void ndr_print_ForestTrustData(struct ndr_print *ndr, const char *name, const union ForestTrustData *r); +void ndr_print_ForestTrustInfoRecordType(struct ndr_print *ndr, const char *name, enum ForestTrustInfoRecordType r); +void ndr_print_ForestTrustInfoRecord(struct ndr_print *ndr, const char *name, const struct ForestTrustInfoRecord *r); +enum ndr_err_code ndr_push_ForestTrustInfo(struct ndr_push *ndr, int ndr_flags, const struct ForestTrustInfo *r); +enum ndr_err_code ndr_pull_ForestTrustInfo(struct ndr_pull *ndr, int ndr_flags, struct ForestTrustInfo *r); +void ndr_print_ForestTrustInfo(struct ndr_print *ndr, const char *name, const struct ForestTrustInfo *r); void ndr_print_decode_replPropertyMetaData(struct ndr_print *ndr, const char *name, int flags, const struct decode_replPropertyMetaData *r); void ndr_print_decode_replUpToDateVector(struct ndr_print *ndr, const char *name, int flags, const struct decode_replUpToDateVector *r); void ndr_print_decode_repsFromTo(struct ndr_print *ndr, const char *name, int flags, const struct decode_repsFromTo *r); @@ -170,4 +180,5 @@ void ndr_print_decode_PrimaryWDigest(struct ndr_print *ndr, const char *name, in void ndr_print_decode_trustAuthInOut(struct ndr_print *ndr, const char *name, int flags, const struct decode_trustAuthInOut *r); void ndr_print_decode_trustDomainPasswords(struct ndr_print *ndr, const char *name, int flags, const struct decode_trustDomainPasswords *r); void ndr_print_decode_ExtendedErrorInfo(struct ndr_print *ndr, const char *name, int flags, const struct decode_ExtendedErrorInfo *r); +void ndr_print_decode_ForestTrustInfo(struct ndr_print *ndr, const char *name, int flags, const struct decode_ForestTrustInfo *r); #endif /* _HEADER_NDR_drsblobs */ diff --git a/librpc/idl/drsblobs.idl b/librpc/idl/drsblobs.idl index fa510a9968b..7cfcc1c3c56 100644 --- a/librpc/idl/drsblobs.idl +++ b/librpc/idl/drsblobs.idl @@ -1,6 +1,6 @@ #include "idl_types.h" -import "drsuapi.idl", "misc.idl", "samr.idl", "lsa.idl"; +import "drsuapi.idl", "misc.idl", "samr.idl", "lsa.idl", "security.idl"; [ uuid("12345778-1234-abcd-0001-00000001"), @@ -571,4 +571,52 @@ interface drsblobs { void decode_ExtendedErrorInfo ( [in,subcontext(0xFFFFFC01)] ExtendedErrorInfoPtr ptr ); + + /* MS-ADTS 7.1.6.9.3 msDS-TrustForestTrustInfo Attribute */ + + typedef [flag(NDR_NOALIGN)] struct { + [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size; + [subcontext(0),subcontext_size(sid_size)] dom_sid sid; + utf8string2 dns_name; + utf8string2 netbios_name; + } ForestTrustDataDomainInfo; + + typedef [flag(NDR_NOALIGN)] struct { + uint32 size; + uint8 data[size]; + } ForestTrustDataBinaryData; + + typedef [nodiscriminant] union { + [case(FOREST_TRUST_TOP_LEVEL_NAME)] utf8string2 name; + [case(FOREST_TRUST_TOP_LEVEL_NAME_EX)] utf8string2 name; + [case(FOREST_TRUST_DOMAIN_INFO)] ForestTrustDataDomainInfo info; + [default] ForestTrustDataBinaryData data; + } ForestTrustData; + + /* same as lsa_ForestTrustRecordType */ + typedef [enum8bit] enum { + FOREST_TRUST_TOP_LEVEL_NAME = 0, + FOREST_TRUST_TOP_LEVEL_NAME_EX = 1, + FOREST_TRUST_DOMAIN_INFO = 2 + } ForestTrustInfoRecordType; + + /* meaning of flags depends on record type and values are + the same as in lsa.idl, see collision record types */ + typedef [flag(NDR_NOALIGN)] struct { + uint32 length; + uint32 flags; + NTTIME timestamp; + ForestTrustInfoRecordType type; + [switch_is(type)] ForestTrustData data; + } ForestTrustInfoRecord; + + typedef [public,flag(NDR_NOALIGN)] struct { + uint32 version; + uint32 count; + ForestTrustInfoRecord records[count]; + } ForestTrustInfo; + + void decode_ForestTrustInfo( + [in] ForestTrustInfo blob + ); } diff --git a/librpc/idl/idl_types.h b/librpc/idl/idl_types.h index 3c6c12cd846..e8b3da578ff 100644 --- a/librpc/idl/idl_types.h +++ b/librpc/idl/idl_types.h @@ -48,6 +48,11 @@ #define utf8string [flag(STR_UTF8|STR_NULLTERM)] string /* + an utf8 string prefixed with [size], 32 bits +*/ +#define utf8string2 [flag(STR_UTF8|STR_SIZE4)] string + +/* a null terminated UCS2 string */ #define nstring_array [flag(STR_NULLTERM)] string_array |