s4-trusts: fix trustDomainPasswords drsblobs IDL and server side support.
[metze/samba/wip.git] / librpc / idl / drsblobs.idl
index 087f0c982ddf52595da9deeb0eb57bb7c199f730..d16027055b388bc994337b2143c9e6cb09e2bc4f 100644 (file)
@@ -1,16 +1,16 @@
 #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"),
   version(0.0),
   pointer_default(unique),
+  helper("../librpc/ndr/ndr_drsblobs.h"),
   helpstring("Active Directory Replication LDAP Blobs")
 ]
 interface drsblobs {
-       typedef bitmap drsuapi_DsReplicaSyncOptions drsuapi_DsReplicaSyncOptions;
-       typedef bitmap drsuapi_DsReplicaNeighbourFlags drsuapi_DsReplicaNeighbourFlags;
+       typedef bitmap drsuapi_DrsOptions drsuapi_DrsOptions;
        typedef [v1_enum] enum drsuapi_DsAttributeId drsuapi_DsAttributeId;
        typedef [v1_enum] enum lsa_TrustAuthType lsa_TrustAuthType;
        /*
@@ -29,7 +29,7 @@ interface drsblobs {
 
        typedef struct {
                uint32 count;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                replPropertyMetaData1 array[count];
        } replPropertyMetaDataCtr1;
 
@@ -39,7 +39,7 @@ interface drsblobs {
        
        typedef [public] struct {
                uint32 version;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                [switch_is(version)] replPropertyMetaDataCtr ctr;
        } replPropertyMetaDataBlob;
 
@@ -54,13 +54,13 @@ interface drsblobs {
         */
        typedef struct {
                uint32 count;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                drsuapi_DsReplicaCursor cursors[count];
        } replUpToDateVectorCtr1;
 
        typedef struct {
                uint32 count;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                drsuapi_DsReplicaCursor2 cursors[count];
        } replUpToDateVectorCtr2;
 
@@ -71,7 +71,7 @@ interface drsblobs {
 
        typedef [public] struct {
                uint32 version;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                [switch_is(version)] replUpToDateVectorCtr ctr;
        } replUpToDateVectorBlob;
 
@@ -83,6 +83,7 @@ interface drsblobs {
         * repsFrom/repsTo
         * w2k  uses version 1
         * w2k3 uses version 1
+        * w2k8 uses version 2
         */
        typedef [public,gensize] struct {
                [value(strlen(dns_name)+1)] uint32 __dns_name_size;
@@ -98,22 +99,51 @@ interface drsblobs {
                WERROR result_last_attempt;
                [relative] repsFromTo1OtherInfo *other_info;
                [value(ndr_size_repsFromTo1OtherInfo(other_info, ndr->flags))] uint32 other_info_length;
-               drsuapi_DsReplicaNeighbourFlags replica_flags;
+               drsuapi_DrsOptions replica_flags;
                uint8 schedule[84];
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                drsuapi_DsReplicaHighWaterMark highwatermark;
                GUID source_dsa_obj_guid; /* the 'objectGuid' field of the CN=NTDS Settings object */
                GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
                GUID transport_guid;
        } repsFromTo1;
 
+       typedef [public,relative_base,gensize] struct {
+               [value(ndr_size_repsFromTo2OtherInfo(this,ndr->flags))]
+                       uint32 __ndr_size;
+               [relative] nstring *dns_name1;
+               uint32 unknown1;
+               [relative] nstring *dns_name2;
+               hyper unknown2;
+       } repsFromTo2OtherInfo;
+
+       typedef [public,gensize,flag(NDR_PAHEX)] struct {
+               /* this includes the 8 bytes of the repsFromToBlob header */
+               [value(ndr_size_repsFromTo2(this, ndr->flags)+8)] uint32 blobsize;
+               uint32 consecutive_sync_failures;
+               NTTIME_1sec last_success;
+               NTTIME_1sec last_attempt;
+               WERROR result_last_attempt;
+               [relative] repsFromTo2OtherInfo *other_info;
+               [value(ndr_size_repsFromTo2OtherInfo(other_info, ndr->flags))] uint32 other_info_length;
+               drsuapi_DrsOptions replica_flags;
+               uint8 schedule[84];
+               [value(0)] uint32 reserved;
+               drsuapi_DsReplicaHighWaterMark highwatermark;
+               GUID source_dsa_obj_guid; /* the 'objectGuid' field of the CN=NTDS Settings object */
+               GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
+               GUID transport_guid;
+               hyper unknown1;
+       } repsFromTo2;
+
        typedef [nodiscriminant] union {
                [case(1)] repsFromTo1 ctr1;
+               [case(2)] repsFromTo2 ctr2;
        } repsFromTo;
 
        typedef [public] struct {
                uint32 version;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                [switch_is(version)] repsFromTo ctr;
        } repsFromToBlob;
 
@@ -137,7 +167,7 @@ interface drsblobs {
 
        typedef [public] struct {
                uint32 version;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                [switch_is(version)] partialAttributeSetCtr ctr;
        } partialAttributeSetBlob;
 
@@ -145,6 +175,44 @@ interface drsblobs {
                [in] partialAttributeSetBlob blob
                );
 
+
+       /*
+        * schemaInfo attribute
+        *
+        * Used as an attribute on Schema.
+        * Also during replication as part of
+        * prefixMap to identify what revision
+        * of Schema source DC has
+        */
+       typedef [public,flag(NDR_NOALIGN)] struct {
+               [value(0xFF)] uint8 marker;
+               [flag(NDR_BIG_ENDIAN)] uint32 revision;
+               GUID   invocation_id;
+       } schemaInfoBlob;
+
+
+       /*
+        * MS w2k3 and w2k8 prefixMap format
+        * There is no version number. Format is:
+        *   uint32 - number of entries in the map
+        *   uint32 - total bytes that structure occupies
+        *   ENTRIES:
+        *     uint16 - prefix ID (OID's last sub-id encoded. see prefixMap)
+        *     uint16 - number of bytes in prefix N
+        *     uint8[N] - BER encoded prefix
+        */
+       typedef [noprint,flag(NDR_NOALIGN)] struct {
+               uint16 entryID;
+               uint16 length;
+               uint8 binary_oid[length];
+       } drsuapi_MSPrefixMap_Entry;
+
+       typedef [public,gensize] struct {
+               uint32 num_entries;
+               [value(ndr_size_drsuapi_MSPrefixMap_Ctr(r, ndr->flags))] uint32 __ndr_size;
+               drsuapi_MSPrefixMap_Entry entries[num_entries];
+       } drsuapi_MSPrefixMap_Ctr;
+
        /*
         * prefixMap
         * w2k  unknown
@@ -165,7 +233,7 @@ interface drsblobs {
 
        typedef [public] struct {
                prefixMapVersion version;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                [switch_is(version)] prefixMapCtr ctr;
        } prefixMapBlob;
 
@@ -173,6 +241,7 @@ interface drsblobs {
                [in] prefixMapBlob blob
                );
 
+
        /*
         * the cookie for the LDAP dirsync control
         */
@@ -265,13 +334,13 @@ interface drsblobs {
                [in] package_PackagesBlob blob
                );
 
-       typedef struct {
+       typedef [nopython] struct {
                [value(2*strlen_m(string))] uint16 length;
                [value(2*strlen_m(string))] uint16 size;
                [relative,subcontext(0),subcontext_size(size),flag(STR_NOTERM|NDR_REMAINING)] string *string;
        } package_PrimaryKerberosString;
 
-       typedef struct {
+       typedef [nopython] struct {
                [value(0)] uint16 reserved1;
                [value(0)] uint16 reserved2;
                [value(0)] uint32 reserved3;
@@ -280,7 +349,7 @@ interface drsblobs {
                [relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value;
        } package_PrimaryKerberosKey3;
 
-       typedef struct {
+       typedef [nopython] struct {
                uint16 num_keys;
                uint16 num_old_keys;
                package_PrimaryKerberosString salt;
@@ -293,7 +362,7 @@ interface drsblobs {
                [value(0)] uint32 padding5;
        } package_PrimaryKerberosCtr3;
 
-       typedef struct {
+       typedef [nopython] struct {
                [value(0)] uint16 reserved1;
                [value(0)] uint16 reserved2;
                [value(0)] uint32 reserved3;
@@ -303,7 +372,7 @@ interface drsblobs {
                [relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value;
        } package_PrimaryKerberosKey4;
 
-       typedef struct {
+       typedef [nopython] struct {
                uint16 num_keys;
                [value(0)] uint16 num_service_keys;
                uint16 num_old_keys;
@@ -316,18 +385,18 @@ interface drsblobs {
                package_PrimaryKerberosKey4 older_keys[num_older_keys];
        } package_PrimaryKerberosCtr4;
 
-       typedef [nodiscriminant] union {
+       typedef [nodiscriminant,nopython] union {
                [case(3)] package_PrimaryKerberosCtr3 ctr3;
                [case(4)] package_PrimaryKerberosCtr4 ctr4;
        } package_PrimaryKerberosCtr;
 
-       typedef [public] struct {
+       typedef [public,nopython] struct {
                uint16 version;
                [value(0)] uint16 flags;
                [switch_is(version)] package_PrimaryKerberosCtr ctr;
        } package_PrimaryKerberosBlob;
 
-       void decode_PrimaryKerberos(
+       [nopython] void decode_PrimaryKerberos(
                [in] package_PrimaryKerberosBlob blob
                );
 
@@ -399,42 +468,40 @@ interface drsblobs {
        typedef [public] struct {
                NTTIME LastUpdateTime;
                lsa_TrustAuthType AuthType;
-               
                [switch_is(AuthType)] AuthInfo AuthInfo;
                [flag(NDR_ALIGN4)] DATA_BLOB _pad;
        } AuthenticationInformation;
 
-       typedef [nopull,nopush,noprint] struct {
-               /* sizeis here is bogus, but this is here just for the structure */
-               [size_is(1)] AuthenticationInformation array[];
+       /* count is not on the wire */
+       typedef [public,nopull,nopush,gensize] struct {
+               uint32 count;
+               AuthenticationInformation array[count];
        } AuthenticationInformationArray;
 
-       /* This is nopull,nopush because we pass count down to the
-        * manual parser of AuthenticationInformationArray */
-       typedef [public,nopull,nopush,noprint,gensize] struct {
+       /* we cannot use [relative] pointers here because Windows expects the
+        * previous_offset to match the total size of the struct in case
+        * the previous array is empty, see MS-LSAD 2.2.7.16 - gd */
+       typedef [public,gensize,nopush] struct {
                uint32 count;
-               [relative] AuthenticationInformationArray *current;
-               [relative] AuthenticationInformationArray *previous;
+               [value((count > 0) ? 12 : 0)] uint32 current_offset;
+               [value((count > 0) ? 12 + ndr_size_AuthenticationInformationArray(&current, ndr->flags) : 0)] uint32 previous_offset;
+               [subcontext(0),subcontext_size((previous_offset)-(current_offset))] AuthenticationInformationArray current;
+               [subcontext(0)] [flag(NDR_REMAINING)] AuthenticationInformationArray previous;
        } trustAuthInOutBlob;
 
-       void decode_trustAuthInOut(
+       [nopython] void decode_trustAuthInOut(
                [in] trustAuthInOutBlob blob
                );
 
-       typedef [public,gensize] struct {
-               uint32 count;
-               [relative] AuthenticationInformation *current[count];
-       } trustCurrentPasswords;
-
        typedef [public,nopull] struct {
                uint8 confounder[512];
-               [subcontext(0),subcontext_size(outgoing_size)] trustCurrentPasswords outgoing;
-               [subcontext(0),subcontext_size(incoming_size)] trustCurrentPasswords incoming;
-               [value(ndr_size_trustCurrentPasswords(&outgoing, ndr->flags))] uint32 outgoing_size;
-               [value(ndr_size_trustCurrentPasswords(&incoming, ndr->flags))] uint32 incoming_size;
+               [subcontext(0),subcontext_size(outgoing_size)] trustAuthInOutBlob outgoing;
+               [subcontext(0),subcontext_size(incoming_size)] trustAuthInOutBlob incoming;
+               [value(ndr_size_trustAuthInOutBlob(&outgoing, ndr->flags))] uint32 outgoing_size;
+               [value(ndr_size_trustAuthInOutBlob(&incoming, ndr->flags))] uint32 incoming_size;
        } trustDomainPasswords;
 
-       void decode_trustDomainPasswords(
+       [nopython] void decode_trustDomainPasswords(
                [in] trustDomainPasswords blob
                );
 
@@ -515,7 +582,64 @@ interface drsblobs {
                [unique] ExtendedErrorInfo *info;
        } ExtendedErrorInfoPtr;
 
-       void decode_ExtendedErrorInfo (
+       [nopython] void decode_ExtendedErrorInfo (
                [in,subcontext(0xFFFFFC01)] ExtendedErrorInfoPtr ptr
                );
+
+       /* MS-ADTS 7.1.6.9.3 msDS-TrustForestTrustInfo Attribute */
+
+       typedef struct {
+               [value(strlen_m(string))] uint32 size;
+               [charset(UTF8)] uint8 string[size];
+       } ForestTrustString;
+
+       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;
+               ForestTrustString dns_name;
+               ForestTrustString netbios_name;
+       } ForestTrustDataDomainInfo;
+
+       typedef [flag(NDR_NOALIGN)] struct {
+               uint32 size;
+               uint8 data[size];
+       } ForestTrustDataBinaryData;
+
+       typedef [nodiscriminant] union {
+               [case(FOREST_TRUST_TOP_LEVEL_NAME)] ForestTrustString name;
+               [case(FOREST_TRUST_TOP_LEVEL_NAME_EX)] ForestTrustString 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 [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->flags))] uint32 record_size;
+               ForestTrustInfoRecord record;
+       } ForestTrustInfoRecordArmor;
+
+       typedef [public,flag(NDR_NOALIGN)] struct {
+               uint32 version;
+               uint32 count;
+               ForestTrustInfoRecordArmor records[count];
+       } ForestTrustInfo;
+
+       [nopython] void decode_ForestTrustInfo(
+               [in] ForestTrustInfo blob
+               );
 }