drsblobs.idl: fix unknowns in package_PrimaryKerberos idl
[kai/samba.git] / source4 / librpc / idl / drsblobs.idl
1 #include "idl_types.h"
2
3 import "drsuapi.idl", "misc.idl";
4
5 [
6   uuid("12345778-1234-abcd-0001-00000001"),
7   version(0.0),
8   pointer_default(unique),
9   helpstring("Active Directory Replication LDAP Blobs")
10 ]
11 interface drsblobs {
12         typedef bitmap drsuapi_DsReplicaSyncOptions drsuapi_DsReplicaSyncOptions;
13         typedef bitmap drsuapi_DsReplicaNeighbourFlags drsuapi_DsReplicaNeighbourFlags;
14         typedef [v1_enum] enum drsuapi_DsAttributeId drsuapi_DsAttributeId;
15
16         /*
17          * replPropertyMetaData
18          * w2k  uses version 1
19          * w2k3 uses version 1
20          */
21         typedef struct {
22                 drsuapi_DsAttributeId attid;
23                 uint32 version;
24                 NTTIME_1sec originating_change_time;
25                 GUID originating_invocation_id;
26                 hyper originating_usn;
27                 hyper local_usn;
28         } replPropertyMetaData1;
29
30         typedef struct {
31                 uint32 count;
32                 uint32 reserved;
33                 replPropertyMetaData1 array[count];
34         } replPropertyMetaDataCtr1;
35
36         typedef [nodiscriminant] union {
37                 [case(1)] replPropertyMetaDataCtr1 ctr1;
38         } replPropertyMetaDataCtr;
39         
40         typedef [public] struct {
41                 uint32 version;
42                 uint32 reserved;
43                 [switch_is(version)] replPropertyMetaDataCtr ctr;
44         } replPropertyMetaDataBlob;
45
46         void decode_replPropertyMetaData(
47                 [in] replPropertyMetaDataBlob blob
48                 );
49
50         /*
51          * replUpToDateVector
52          * w2k  uses version 1
53          * w2k3 uses version 2
54          */
55         typedef struct {
56                 uint32 count;
57                 uint32 reserved;
58                 drsuapi_DsReplicaCursor cursors[count];
59         } replUpToDateVectorCtr1;
60
61         typedef struct {
62                 uint32 count;
63                 uint32 reserved;
64                 drsuapi_DsReplicaCursor2 cursors[count];
65         } replUpToDateVectorCtr2;
66
67         typedef [nodiscriminant] union {
68                 [case(1)] replUpToDateVectorCtr1 ctr1;
69                 [case(2)] replUpToDateVectorCtr2 ctr2;
70         } replUpToDateVectorCtr;
71
72         typedef [public] struct {
73                 uint32 version;
74                 uint32 reserved;
75                 [switch_is(version)] replUpToDateVectorCtr ctr;
76         } replUpToDateVectorBlob;
77
78         void decode_replUpToDateVector(
79                 [in] replUpToDateVectorBlob blob
80                 );
81
82         /*
83          * repsFrom/repsTo
84          * w2k  uses version 1
85          * w2k3 uses version 1
86          */
87         typedef [public,gensize] struct {
88                 [value(strlen(dns_name)+1)] uint32 __dns_name_size;
89                 [charset(DOS)] uint8 dns_name[__dns_name_size];
90         } repsFromTo1OtherInfo;
91
92         typedef [public,gensize,flag(NDR_PAHEX)] struct {
93                 /* this includes the 8 bytes of the repsFromToBlob header */
94                 [value(ndr_size_repsFromTo1(this, ndr->flags)+8)] uint32 blobsize;
95                 uint32 consecutive_sync_failures;
96                 NTTIME_1sec last_success;
97                 NTTIME_1sec last_attempt;
98                 WERROR result_last_attempt;
99                 [relative] repsFromTo1OtherInfo *other_info;
100                 [value(ndr_size_repsFromTo1OtherInfo(other_info, ndr->flags))] uint32 other_info_length;
101                 drsuapi_DsReplicaNeighbourFlags replica_flags;
102                 uint8 schedule[84];
103                 uint32 reserved;
104                 drsuapi_DsReplicaHighWaterMark highwatermark;
105                 GUID source_dsa_obj_guid; /* the 'objectGuid' field of the CN=NTDS Settings object */
106                 GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
107                 GUID transport_guid;
108         } repsFromTo1;
109
110         typedef [nodiscriminant] union {
111                 [case(1)] repsFromTo1 ctr1;
112         } repsFromTo;
113
114         typedef [public] struct {
115                 uint32 version;
116                 uint32 reserved;
117                 [switch_is(version)] repsFromTo ctr;
118         } repsFromToBlob;
119
120         void decode_repsFromTo(
121                 [in] repsFromToBlob blob
122                 );
123
124         /*
125          * partialAttributeSet
126          * w2k  uses version 1
127          * w2k3 uses version 1
128          */
129         typedef struct {
130                 uint32 count;
131                 drsuapi_DsAttributeId array[count];
132         } partialAttributeSetCtr1;
133
134         typedef [nodiscriminant] union {
135                 [case(1)] partialAttributeSetCtr1 ctr1;
136         } partialAttributeSetCtr;
137
138         typedef [public] struct {
139                 uint32 version;
140                 uint32 reserved;
141                 [switch_is(version)] partialAttributeSetCtr ctr;
142         } partialAttributeSetBlob;
143
144         void decode_partialAttributeSet(
145                 [in] partialAttributeSetBlob blob
146                 );
147
148         /*
149          * prefixMap
150          * w2k  unknown
151          * w2k3 unknown
152          * samba4 uses 0x44534442 'DSDB'
153          *
154          * as we windows don't return the prefixMap attribute when you ask for
155          * we don't know the format, but the attribute is not replicated
156          * so that we can choose our own format...
157          */
158         typedef [v1_enum] enum {
159                 PREFIX_MAP_VERSION_DSDB = 0x44534442
160         } prefixMapVersion;
161
162         typedef [nodiscriminant] union {
163                 [case(PREFIX_MAP_VERSION_DSDB)] drsuapi_DsReplicaOIDMapping_Ctr dsdb;
164         } prefixMapCtr;
165
166         typedef [public] struct {
167                 prefixMapVersion version;
168                 uint32 reserved;
169                 [switch_is(version)] prefixMapCtr ctr;
170         } prefixMapBlob;
171
172         void decode_prefixMap(
173                 [in] prefixMapBlob blob
174                 );
175
176         /*
177          * the cookie for the LDAP dirsync control
178          */
179         typedef [nodiscriminant,gensize] union {
180                 [case(0)];
181                 [default] replUpToDateVectorBlob uptodateness_vector;
182         } ldapControlDirSyncExtra;
183
184         typedef struct {
185                 [value(3)] uint32 u1;
186                 NTTIME time;
187                 uint32 u2;
188                 uint32 u3;
189                 [value(ndr_size_ldapControlDirSyncExtra(&extra, extra.uptodateness_vector.version, 0))] 
190                         uint32 extra_length;
191                 drsuapi_DsReplicaHighWaterMark highwatermark;
192                 GUID guid1;
193                 [switch_is(extra_length)] ldapControlDirSyncExtra extra;
194         } ldapControlDirSyncBlob;
195
196         typedef [public,relative_base] struct {
197                 [charset(DOS),value("MSDS")] uint8 msds[4];
198                 [subcontext(0)] ldapControlDirSyncBlob blob;
199         } ldapControlDirSyncCookie;
200
201         void decode_ldapControlDirSync(
202                 [in] ldapControlDirSyncCookie cookie
203                 );
204
205         typedef struct {
206                 [value(2*strlen_m(name))] uint16 name_len;
207                 [value(strlen(data))] uint16 data_len;
208                 uint16 reserved; /* 2 for 'Packages', 1 for 'Primary:*', but should be ignored */
209                 [charset(UTF16)] uint8 name[name_len];
210                 /* 
211                  * the data field contains data as HEX strings
212                  *
213                  * 'Packages':
214                  *   data contains the list of packages
215                  *   as non termiated UTF16 strings with
216                  *   a UTF16 NULL byte as separator
217                  *
218                  * 'Primary:Kerberos':
219                  *    ...
220                  *
221                  * 'Primary:WDigest':
222                  *    ...
223                  *
224                  * 'Primary:CLEARTEXT':
225                  *    data contains the cleartext password
226                  *    as UTF16 string encoded as HEX string
227                  */
228                 [charset(DOS)] uint8 data[data_len];
229         } supplementalCredentialsPackage;
230
231         /* this are 0x30 (48) whitespaces (0x20) */
232         const string SUPPLEMENTAL_CREDENTIALS_PREFIX = "                                                ";
233
234         typedef [flag(NDR_PAHEX)] enum {
235                 SUPPLEMENTAL_CREDENTIALS_SIGNATURE = 0x0050
236         } supplementalCredentialsSignature;
237
238         typedef [gensize] struct {
239                 [value(SUPPLEMENTAL_CREDENTIALS_PREFIX),charset(UTF16)] uint16 prefix[0x30];
240                 [value(SUPPLEMENTAL_CREDENTIALS_SIGNATURE)] supplementalCredentialsSignature signature;
241                 uint16 num_packages;
242                 supplementalCredentialsPackage packages[num_packages];
243         } supplementalCredentialsSubBlob;
244
245         typedef [public] struct {
246                 [value(0)] uint32 unknown1;
247                 [value(ndr_size_supplementalCredentialsSubBlob(&sub, ndr->flags))] uint32 __ndr_size;
248                 [value(0)] uint32 unknown2;
249                 [subcontext(0),subcontext_size(__ndr_size)] supplementalCredentialsSubBlob sub;
250                 [value(0)] uint8 unknown3;
251         } supplementalCredentialsBlob;
252
253         void decode_supplementalCredentials(
254                 [in] supplementalCredentialsBlob blob
255                 );
256
257         typedef [public] struct {
258                 [flag(STR_NOTERM|NDR_REMAINING)] string_array names;
259         } package_PackagesBlob;
260
261         void decode_Packages(
262                 [in] package_PackagesBlob blob
263                 );
264
265         typedef struct {
266                 [value(2*strlen_m(string))] uint16 length;
267                 [value(2*strlen_m(string))] uint16 size;
268                 [relative,subcontext(0),subcontext_size(size),flag(STR_NOTERM|NDR_REMAINING)] string *string;
269         } package_PrimaryKerberosString;
270
271         typedef struct {
272                 [value(0)] uint16 reserved1;
273                 [value(0)] uint16 reserved2;
274                 [value(0)] uint32 reserved3;
275                 uint32 keytype;
276                 [value((value?value->length:0))] uint32 value_len;
277                 [relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value;
278         } package_PrimaryKerberosKey;
279
280         typedef struct {
281                 uint16 num_keys;
282                 uint16 num_old_keys;
283                 package_PrimaryKerberosString salt;
284                 package_PrimaryKerberosKey keys[num_keys];
285                 package_PrimaryKerberosKey old_keys[num_old_keys];
286                 [value(0)] uint32 padding1;
287                 [value(0)] uint32 padding2;
288                 [value(0)] uint32 padding3;
289                 [value(0)] uint32 padding4;
290                 [value(0)] uint32 padding5;
291         } package_PrimaryKerberosCtr3;
292
293         typedef [nodiscriminant] union {
294                 [case(3)] package_PrimaryKerberosCtr3 ctr3;
295         } package_PrimaryKerberosCtr;
296
297         typedef [public] struct {
298                 [value(3)] uint32 version;
299                 [switch_is(version)] package_PrimaryKerberosCtr ctr;
300         } package_PrimaryKerberosBlob;
301
302         void decode_PrimaryKerberos(
303                 [in] package_PrimaryKerberosBlob blob
304                 );
305
306         typedef [public] struct {
307                 [flag(STR_NOTERM|NDR_REMAINING)] string cleartext;
308         } package_PrimaryCLEARTEXTBlob;
309
310         void decode_PrimaryCLEARTEXT(
311                 [in] package_PrimaryCLEARTEXTBlob blob
312                 );
313
314         typedef [flag(NDR_PAHEX)] struct {
315                 uint8 hash[16];
316         } package_PrimaryWDigestHash;
317
318         typedef [public] struct {
319                 [value(0x31)] uint16 unknown1;
320                 [value(0x01)] uint8  unknown2;
321                 uint8  num_hashes;
322                 [value(0)] uint32 unknown3;
323                 [value(0)] udlong uuknown4;
324                 package_PrimaryWDigestHash hashes[num_hashes];
325         } package_PrimaryWDigestBlob;
326
327         void decode_PrimaryWDigest(
328                 [in] package_PrimaryWDigestBlob blob
329                 );
330
331         typedef struct {
332                 NTTIME time1;
333                 uint32 unknown1;
334                 /* 
335                  * the secret value is encoded as UTF16 if it's a string
336                  * but krb5 trusts have random bytes here, so converting to UTF16
337                  * mayfail...
338                  *
339                  * TODO: We should try handle the case of a random buffer in all places
340                  *       we deal with cleartext passwords from windows
341                  *
342                  * so we don't use this:
343                  *
344                  * uint32 value_len;
345                  * [charset(UTF16)] uint8 value[value_len];
346                  */
347                 DATA_BLOB value;
348                 [flag(NDR_ALIGN4)] DATA_BLOB _pad;
349         } trustAuthInOutSecret1;
350
351         typedef struct {
352                 [relative] trustAuthInOutSecret1 *value1;
353                 [relative] trustAuthInOutSecret1 *value2;
354         } trustAuthInOutCtr1;
355
356         typedef struct {
357                 NTTIME time1;
358                 uint32 unknown1;
359                 DATA_BLOB value;
360                 NTTIME time2;
361                 uint32 unknown2;
362                 uint32 unknown3;
363                 uint32 unknown4;
364                 [flag(NDR_ALIGN4)] DATA_BLOB _pad;
365         } trustAuthInOutSecret2V1;
366
367         typedef struct {
368                 NTTIME time1;
369                 uint32 unknown1;
370                 DATA_BLOB value;
371                 NTTIME time2;
372                 uint32 unknown2;
373                 uint32 unknown3;
374                 [flag(NDR_ALIGN4)] DATA_BLOB _pad;
375         } trustAuthInOutSecret2V2;
376
377         typedef struct {
378                 [relative] trustAuthInOutSecret2V1 *value1;
379                 [relative] trustAuthInOutSecret2V2 *value2;
380         } trustAuthInOutCtr2;
381
382         typedef [nodiscriminant] union {
383                 [case(1)] trustAuthInOutCtr1 ctr1;
384                 [case(2)] trustAuthInOutCtr2 ctr2;
385         } trustAuthInOutCtr;
386
387         typedef [public] struct {
388                 uint32 version;
389                 [switch_is(version)] trustAuthInOutCtr ctr;
390         } trustAuthInOutBlob;
391
392         void decode_trustAuthInOut(
393                 [in] trustAuthInOutBlob blob
394                 );
395
396         typedef [public] struct {
397                 uint32 marker;
398                 DATA_BLOB data;
399         } DsCompressedChunk;
400
401         typedef [public] struct {
402                 DsCompressedChunk chunks[5];
403         } DsCompressedBlob;
404
405         void decode_DsCompressed(
406                 [in] DsCompressedBlob blob
407                 );
408 }