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