summaryrefslogtreecommitdiff
path: root/source4/librpc/idl/drsblobs.idl
blob: 3389308b2cc8515684be1f4befc842fe960e8f46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
#include "idl_types.h"

import "drsuapi.idl";

[
  uuid("12345778-1234-abcd-0001-00000001"),
  version(0.0),
  pointer_default(unique),
  helpstring("Active Directory Replication LDAP Blobs")
]
interface drsblobs {
	declare bitmap drsuapi_DsReplicaSyncOptions;
	declare bitmap drsuapi_DsReplicaNeighbourFlags;
	declare [v1_enum] enum drsuapi_DsAttributeId;

	/*
	 * replPropertyMetaData
	 * w2k  uses version 1
	 * w2k3 uses version 1
	 */
	typedef struct {
		drsuapi_DsAttributeId attid;
		uint32 version;
		NTTIME_1sec orginating_time;
		GUID orginating_invocation_id;
		hyper orginating_usn;
		hyper local_usn;
	} replPropertyMetaData1;

	typedef struct {
		uint32 count;
		uint32 reserved;
		replPropertyMetaData1 array[count];
	} replPropertyMetaDataCtr1;

	typedef [nodiscriminant] union {
		[case(1)] replPropertyMetaDataCtr1 ctr1;
	} replPropertyMetaDataCtr;
	
	typedef [public] struct {
		uint32 version;
		uint32 reserved;
		[switch_is(version)] replPropertyMetaDataCtr ctr;
	} replPropertyMetaDataBlob;

	void decode_replPropertyMetaData(
		[in] replPropertyMetaDataBlob blob
		);

	/*
	 * replUpToDateVector
	 * w2k  uses version 1
	 * w2k3 uses version 2
	 */
	typedef struct {
		uint32 count;
		uint32 reserved;
		drsuapi_DsReplicaCursor cursors[count];
	} replUpToDateVectorCtr1;

	typedef struct {
		uint32 count;
		uint32 reserved;
		drsuapi_DsReplicaCursor2 cursors[count];
	} replUpToDateVectorCtr2;

	typedef [nodiscriminant] union {
		[case(1)] replUpToDateVectorCtr1 ctr1;
		[case(2)] replUpToDateVectorCtr2 ctr2;
	} replUpToDateVectorCtr;

	typedef [public] struct {
		uint32 version;
		uint32 reserved;
		[switch_is(version)] replUpToDateVectorCtr ctr;
	} replUpToDateVectorBlob;

	void decode_replUpToDateVector(
		[in] replUpToDateVectorBlob blob
		);

	/*
	 * repsFrom/repsTo
	 * w2k  uses version 1
	 * w2k3 uses version 1
	 */
	typedef [public,gensize] struct {
		asclstr dns_name;
	} repsFromTo1OtherInfo;

	typedef [public,gensize,flag(NDR_PAHEX)] struct {
		/* this includes the 8 bytes of the repsFromToBlob header */
		[value(ndr_size_repsFromTo1(r, ndr->flags)+8)] uint32 blobsize;
		uint32 consecutive_sync_failures;
		NTTIME_1sec last_success;
		NTTIME_1sec last_attempt;
		WERROR result_last_attempt;
		[relative] repsFromTo1OtherInfo *other_info;
		[value(ndr_size_repsFromTo1OtherInfo(other_info, ndr->flags))] uint32 other_info_length;
		drsuapi_DsReplicaNeighbourFlags replica_flags;
		uint8 schedule[84];
		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 [nodiscriminant] union {
		[case(1)] repsFromTo1 ctr1;
	} repsFromTo;

	typedef [public] struct {
		uint32 version;
		uint32 reserved;
		[switch_is(version)] repsFromTo ctr;
	} repsFromToBlob;

	void decode_repsFromTo(
		[in] repsFromToBlob blob
		);

	/*
	 * partialAttributeSet
	 * w2k  uses version 1
	 * w2k3 uses version 1
	 */
	typedef struct {
		uint32 count;
		drsuapi_DsAttributeId array[count];
	} partialAttributeSetCtr1;

	typedef [nodiscriminant] union {
		[case(1)] partialAttributeSetCtr1 ctr1;
	} partialAttributeSetCtr;

	typedef [public] struct {
		uint32 version;
		uint32 reserved;
		[switch_is(version)] partialAttributeSetCtr ctr;
	} partialAttributeSetBlob;

	void decode_partialAttributeSet(
		[in] partialAttributeSetBlob blob
		);

	/*
	 * prefixMap
	 * w2k  unknown
	 * w2k3 unknown
	 * samba4 uses 0x44544442 'DSDB'
	 *
	 * as we windows don't return the prefixMap attribute when you ask for
	 * we don't know the format, but the attribute is not replicated
	 * so that we can choose our own format...
	 */
	typedef [v1_enum] enum {
		PREFIX_MAP_VERSION_DSDB = 0x44544442
	} prefixMapVersion;

	typedef [nodiscriminant] union {
		[case(PREFIX_MAP_VERSION_DSDB)] drsuapi_DsReplicaOIDMapping_Ctr dsdb;
	} prefixMapCtr;

	typedef [public] struct {
		prefixMapVersion version;
		uint32 reserved;
		[switch_is(version)] prefixMapCtr ctr;
	} prefixMapBlob;

	void decode_prefixMap(
		[in] prefixMapBlob blob
		);

	/*
	 * the cookie for the LDAP dirsync control
	 */
	typedef [nodiscriminant,gensize] union {
		[case(0)];
		[default] replUpToDateVectorBlob uptodateness_vector;
	} ldapControlDirSyncExtra;

	typedef struct {
		[value(3)] uint32 u1;
		NTTIME time;
		uint32 u2;
		uint32 u3;
		[value(ndr_size_ldapControlDirSyncExtra(&extra, extra.uptodateness_vector.version, 0))] 
			uint32 extra_length;
		drsuapi_DsReplicaHighWaterMark highwatermark;
		GUID guid1;
		[switch_is(extra_length)] ldapControlDirSyncExtra extra;
	} ldapControlDirSyncBlob;

	typedef [public,relative_base] struct {
		[charset(DOS),value("MSDS")] uint8 msds[4];
		[subcontext(0)] ldapControlDirSyncBlob blob;
	} ldapControlDirSyncCookie;

	void decode_ldapControlDirSync(
		[in] ldapControlDirSyncCookie cookie
		);

	typedef struct {
		uint16 name_len;
		uint16 data_len;
		uint16 unknown1; /* 2 for name = 'Packages', 1 for name = 'Primary:*' */
		[charset(UTF16)] uint8 name[name_len];
		/* 
		 * the data field contains data as HEX strings
		 *
		 * 'Packages':
		 *    it seems to contains HEX strings
		 *    of GUID's concatenated together.
		 *    w2k only has 'Primary:Kerberos'
		 *    and there's a 32 byte hex string.
		 *    w2k3 also has 'Primary:WDigest'
		 *    and there's a 64 byte hex string.
		 *    ...but this 'Primary:CLEARTEXT'
		 *    also there's a 104 byte hex string
		 *    (instead of 3 * (16*2) = 96 ).
		 *
		 * 'Primary:Kerberos':
		 *    ...
		 *
		 * 'Primary:WDigest':
		 *    ...
		 *
		 * 'Primary:CLEARTEXT':
		 *    data contains the cleartext password
		 *    as UTF16 string encoded as HEX string
		 */
		[charset(DOS)] uint8 data[data_len];
	} supplementalCredentialsPackage;

	/* this are 0x30 (48) whitespaces (0x20) followed by 'P' (0x50) */
	const string SUPPLEMENTAL_CREDENTIALS_PREFIX = "                                                P";

	typedef struct {
		[value(SUPPLEMENTAL_CREDENTIALS_PREFIX),charset(UTF16)] uint16 prefix[0x31];
		uint16 num_packages;
		supplementalCredentialsPackage packages[num_packages];
	} supplementalCredentialsSubBlob;

	typedef [public] struct {
		[value(0)] uint32 unknown1;
		uint32 __ndr_size;
		[value(0)] uint32 unknown2;
		[subcontext(0),subcontext_size(__ndr_size)] supplementalCredentialsSubBlob sub;
		[value(0)] uint8 unknown3;
	} supplementalCredentialsBlob;

	void decode_supplementalCredentials(
		[in] supplementalCredentialsBlob blob
		);

	typedef struct {
		[value((string?string->length:0))] uint16 length;
		[value((string?string->length:0))] uint16 size;
		[relative,subcontext(0),subcontext_size(size),flag(NDR_REMAINING)] DATA_BLOB *string;
	} package_PrimaryKerberosString;

	typedef struct {
		uint32 keytype;
		[value((value?value->length:0))] uint32 value_len;
		[relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value;
		uint32 unknown1;
		uint32 unknown2;
	} package_PrimaryKerberosKey;

	typedef [public] struct {
		[value(3)] uint32 version;
		uint16 num_keys1;
		uint16 num_keys2;
		package_PrimaryKerberosString salt;
		uint32 unknown1;
		uint32 unknown2;
		package_PrimaryKerberosKey keys1[num_keys1];
		package_PrimaryKerberosKey keys2[num_keys2];
		udlong unknown3[4];
	} package_PrimaryKerberosBlob;

	void decode_PrimaryKerberos(
		[in] package_PrimaryKerberosBlob blob
		);

	typedef struct {
		NTTIME time1;
		uint32 unknown1;
		/* 
		 * the secret value is encoded as UTF16 if it's a string
		 * but krb5 trusts have random bytes here, so converting to UTF16
		 * mayfail...
		 *
		 * TODO: We should try handle the case of a random buffer in all places
		 *       we deal with cleartext passwords from windows
		 *
		 * so we don't use this:
		 *
		 * uint32 value_len;
		 * [charset(UTF16)] uint8 value[value_len];
		 */
		DATA_BLOB value;
		[flag(NDR_ALIGN4)] DATA_BLOB _pad;
	} trustAuthInOutSecret1;

	typedef struct {
		[relative] trustAuthInOutSecret1 *value1;
		[relative] trustAuthInOutSecret1 *value2;
	} trustAuthInOutCtr1;

	typedef struct {
		NTTIME time1;
		uint32 unknown1;
		DATA_BLOB value;
		NTTIME time2;
		uint32 unknown2;
		uint32 unknown3;
		uint32 unknown4;
		[flag(NDR_ALIGN4)] DATA_BLOB _pad;
	} trustAuthInOutSecret2V1;

	typedef struct {
		NTTIME time1;
		uint32 unknown1;
		DATA_BLOB value;
		NTTIME time2;
		uint32 unknown2;
		uint32 unknown3;
		[flag(NDR_ALIGN4)] DATA_BLOB _pad;
	} trustAuthInOutSecret2V2;

	typedef struct {
		[relative] trustAuthInOutSecret2V1 *value1;
		[relative] trustAuthInOutSecret2V2 *value2;
	} trustAuthInOutCtr2;

	typedef [nodiscriminant] union {
		[case(1)] trustAuthInOutCtr1 ctr1;
		[case(2)] trustAuthInOutCtr2 ctr2;
	} trustAuthInOutCtr;

	typedef [public] struct {
		uint32 version;
		[switch_is(version)] trustAuthInOutCtr ctr;
	} trustAuthInOutBlob;

	void decode_trustAuthInOut(
		[in] trustAuthInOutBlob blob
		);

	typedef [public] struct {
		uint32 marker;
		DATA_BLOB data;
	} DsCompressedChunk;

	typedef [public] struct {
		DsCompressedChunk chunks[5];
	} DsCompressedBlob;

	void decode_DsCompressed(
		[in] DsCompressedBlob blob
		);
}