idl: fix forest trust information idl
authorSimo Sorce <idra@samba.org>
Tue, 23 Mar 2010 22:45:20 +0000 (18:45 -0400)
committerSimo Sorce <idra@samba.org>
Tue, 23 Mar 2010 22:47:39 +0000 (18:47 -0400)
--validate now passes

librpc/gen_ndr/drsblobs.h
librpc/gen_ndr/ndr_drsblobs.c
librpc/gen_ndr/ndr_drsblobs.h
librpc/idl/drsblobs.idl
librpc/idl/idl_types.h

index 83a6978353ba4b5378481e90c6cbfda6f038f021..18ca55879b9029c7b67b5addbf8eddf93d9bf585 100644 (file)
@@ -460,8 +460,8 @@ struct ExtendedErrorInfoPtr {
 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)] */
+       const char * dns_name;/* [flag(LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NOTERM)] */
+       const char * netbios_name;/* [flag(LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NOTERM)] */
 }/* [flag(LIBNDR_FLAG_NOALIGN)] */;
 
 struct ForestTrustDataBinaryData {
@@ -470,7 +470,7 @@ struct ForestTrustDataBinaryData {
 }/* [flag(LIBNDR_FLAG_NOALIGN)] */;
 
 union ForestTrustData {
-       const char * name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_SIZE4),case(FOREST_TRUST_TOP_LEVEL_NAME)] */
+       const char * name;/* [flag(LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NOTERM),case(FOREST_TRUST_TOP_LEVEL_NAME)] */
        struct ForestTrustDataDomainInfo info;/* [case(FOREST_TRUST_DOMAIN_INFO)] */
        struct ForestTrustDataBinaryData data;/* [default] */
 }/* [nodiscriminant] */;
@@ -491,17 +491,21 @@ enum ForestTrustInfoRecordType
 ;
 
 struct ForestTrustInfoRecord {
-       uint32_t length;
        uint32_t flags;
        NTTIME timestamp;
        enum ForestTrustInfoRecordType type;
        union ForestTrustData data;/* [switch_is(type)] */
+}/* [gensize,public,flag(LIBNDR_FLAG_NOALIGN)] */;
+
+struct ForestTrustInfoRecordArmor {
+       uint32_t record_size;/* [value(ndr_size_ForestTrustInfoRecord(&record,ndr->iconv_convenience,ndr->flags))] */
+       struct ForestTrustInfoRecord record;
 }/* [flag(LIBNDR_FLAG_NOALIGN)] */;
 
 struct ForestTrustInfo {
        uint32_t version;
        uint32_t count;
-       struct ForestTrustInfoRecord *records;
+       struct ForestTrustInfoRecordArmor *records;
 }/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
 
 
index aa2eeb7da26d98b07dad68f38cc15f7e2871990d..1ff7aefc87fbee2b89e96fc5bfb90f3d713912bc 100644 (file)
@@ -4074,13 +4074,13 @@ static enum ndr_err_code ndr_push_ForestTrustDataDomainInfo(struct ndr_push *ndr
                        }
                        {
                                uint32_t _flags_save_string = ndr->flags;
-                               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_SIZE4);
+                               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NOTERM);
                                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_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NOTERM);
                                NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->netbios_name));
                                ndr->flags = _flags_save_string;
                        }
@@ -4109,13 +4109,13 @@ static enum ndr_err_code ndr_pull_ForestTrustDataDomainInfo(struct ndr_pull *ndr
                        }
                        {
                                uint32_t _flags_save_string = ndr->flags;
-                               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_SIZE4);
+                               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NOTERM);
                                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_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NOTERM);
                                NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->netbios_name));
                                ndr->flags = _flags_save_string;
                        }
@@ -4204,7 +4204,7 @@ static enum ndr_err_code ndr_push_ForestTrustData(struct ndr_push *ndr, int ndr_
                        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_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NOTERM);
                                        NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name));
                                        ndr->flags = _flags_save_string;
                                }
@@ -4213,7 +4213,7 @@ static enum ndr_err_code ndr_push_ForestTrustData(struct ndr_push *ndr, int ndr_
                        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_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NOTERM);
                                        NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name));
                                        ndr->flags = _flags_save_string;
                                }
@@ -4259,7 +4259,7 @@ static enum ndr_err_code ndr_pull_ForestTrustData(struct ndr_pull *ndr, int ndr_
                        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_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NOTERM);
                                        NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name));
                                        ndr->flags = _flags_save_string;
                                }
@@ -4268,7 +4268,7 @@ static enum ndr_err_code ndr_pull_ForestTrustData(struct ndr_pull *ndr, int ndr_
                        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_set_flags(&ndr->flags, LIBNDR_FLAG_STR_SIZE4|LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NOTERM);
                                        NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name));
                                        ndr->flags = _flags_save_string;
                                }
@@ -4354,14 +4354,13 @@ _PUBLIC_ void ndr_print_ForestTrustInfoRecordType(struct ndr_print *ndr, const c
        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)
+_PUBLIC_ 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));
@@ -4376,14 +4375,13 @@ static enum ndr_err_code ndr_push_ForestTrustInfoRecord(struct ndr_push *ndr, in
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_ForestTrustInfoRecord(struct ndr_pull *ndr, int ndr_flags, struct ForestTrustInfoRecord *r)
+_PUBLIC_ 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));
@@ -4405,7 +4403,6 @@ _PUBLIC_ void ndr_print_ForestTrustInfoRecord(struct ndr_print *ndr, const char
                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);
@@ -4416,6 +4413,62 @@ _PUBLIC_ void ndr_print_ForestTrustInfoRecord(struct ndr_print *ndr, const char
        }
 }
 
+_PUBLIC_ size_t ndr_size_ForestTrustInfoRecord(const struct ForestTrustInfoRecord *r, struct smb_iconv_convenience *ic, int flags)
+{
+       flags |= LIBNDR_FLAG_NOALIGN;
+       return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_ForestTrustInfoRecord, ic);
+}
+
+static enum ndr_err_code ndr_push_ForestTrustInfoRecordArmor(struct ndr_push *ndr, int ndr_flags, const struct ForestTrustInfoRecordArmor *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_ForestTrustInfoRecord(&r->record, ndr->iconv_convenience, ndr->flags)));
+                       NDR_CHECK(ndr_push_ForestTrustInfoRecord(ndr, NDR_SCALARS, &r->record));
+                       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_ForestTrustInfoRecordArmor(struct ndr_pull *ndr, int ndr_flags, struct ForestTrustInfoRecordArmor *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->record_size));
+                       NDR_CHECK(ndr_pull_ForestTrustInfoRecord(ndr, NDR_SCALARS, &r->record));
+                       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_ForestTrustInfoRecordArmor(struct ndr_print *ndr, const char *name, const struct ForestTrustInfoRecordArmor *r)
+{
+       ndr_print_struct(ndr, name, "ForestTrustInfoRecordArmor");
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+               ndr->depth++;
+               ndr_print_uint32(ndr, "record_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_ForestTrustInfoRecord(&r->record, ndr->iconv_convenience, ndr->flags):r->record_size);
+               ndr_print_ForestTrustInfoRecord(ndr, "record", &r->record);
+               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;
@@ -4427,7 +4480,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_ForestTrustInfo(struct ndr_push *ndr, int nd
                        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_ForestTrustInfoRecordArmor(ndr, NDR_SCALARS, &r->records[cntr_records_0]));
                        }
                        NDR_CHECK(ndr_push_trailer_align(ndr, 4));
                }
@@ -4453,7 +4506,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_ForestTrustInfo(struct ndr_pull *ndr, int nd
                        _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_CHECK(ndr_pull_ForestTrustInfoRecordArmor(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));
@@ -4480,7 +4533,7 @@ _PUBLIC_ void ndr_print_ForestTrustInfo(struct ndr_print *ndr, const char *name,
                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]);
+                               ndr_print_ForestTrustInfoRecordArmor(ndr, "records", &r->records[cntr_records_0]);
                                free(idx_0);
                        }
                }
index 226403d7ebadfae93b212067e4516462c0e0eb73..7831fad3618794afbaae47106c5c8756369677e1 100644 (file)
@@ -162,7 +162,11 @@ void ndr_print_ForestTrustDataDomainInfo(struct ndr_print *ndr, const char *name
 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);
+enum ndr_err_code ndr_push_ForestTrustInfoRecord(struct ndr_push *ndr, int ndr_flags, const struct ForestTrustInfoRecord *r);
+enum ndr_err_code ndr_pull_ForestTrustInfoRecord(struct ndr_pull *ndr, int ndr_flags, struct ForestTrustInfoRecord *r);
 void ndr_print_ForestTrustInfoRecord(struct ndr_print *ndr, const char *name, const struct ForestTrustInfoRecord *r);
+size_t ndr_size_ForestTrustInfoRecord(const struct ForestTrustInfoRecord *r, struct smb_iconv_convenience *ic, int flags);
+void ndr_print_ForestTrustInfoRecordArmor(struct ndr_print *ndr, const char *name, const struct ForestTrustInfoRecordArmor *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);
index 7cfcc1c3c566d5a06cd5637016e564e9359020ed..0df5bc15e2e01e5fcb3aea4d0a0c3d165da6ff47 100644 (file)
@@ -602,18 +602,22 @@ interface drsblobs {
 
         /* 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;
+        typedef [public,gensize,flag(NDR_NOALIGN)] struct {
                 uint32 flags;
                 NTTIME timestamp;
                 ForestTrustInfoRecordType type;
                 [switch_is(type)] ForestTrustData data;
         } ForestTrustInfoRecord;
 
+        typedef [flag(NDR_NOALIGN)] struct {
+                [value(ndr_size_ForestTrustInfoRecord(&record, ndr->iconv_convenience, ndr->flags))] uint32 record_size;
+                ForestTrustInfoRecord record;
+        } ForestTrustInfoRecordArmor;
+
         typedef [public,flag(NDR_NOALIGN)] struct {
                 uint32 version;
                 uint32 count;
-                ForestTrustInfoRecord records[count];
+                ForestTrustInfoRecordArmor records[count];
         } ForestTrustInfo;
 
        void decode_ForestTrustInfo(
index e8b3da578ffcc7b55d2825b40fa177b4a1cb0e5e..d763a8b22a3fd63b6462e07ef5c0e97351c6d5c8 100644 (file)
 #define utf8string     [flag(STR_UTF8|STR_NULLTERM)] string
 
 /*
-  an utf8 string prefixed with [size], 32 bits
+  an utf8 string prefixed with [length], 32 bits
+  not null terminated
 */
-#define utf8string2    [flag(STR_UTF8|STR_SIZE4)] string
+#define utf8string2    [flag(STR_SIZE4|STR_UTF8|STR_NOTERM)] string
 
 /*
   a null terminated UCS2 string