| 1 | #include "idl_types.h" | 
|---|
| 2 |  | 
|---|
| 3 | import "drsuapi.idl", "misc.idl", "samr.idl", "lsa.idl", "security.idl"; | 
|---|
| 4 |  | 
|---|
| 5 | [ | 
|---|
| 6 | uuid("12345778-1234-abcd-0001-00000001"), | 
|---|
| 7 | version(0.0), | 
|---|
| 8 | pointer_default(unique), | 
|---|
| 9 | helper("../librpc/ndr/ndr_drsblobs.h"), | 
|---|
| 10 | helpstring("Active Directory Replication LDAP Blobs") | 
|---|
| 11 | ] | 
|---|
| 12 | interface drsblobs { | 
|---|
| 13 | typedef bitmap drsuapi_DrsOptions drsuapi_DrsOptions; | 
|---|
| 14 | typedef [v1_enum] enum drsuapi_DsAttributeId drsuapi_DsAttributeId; | 
|---|
| 15 | typedef [v1_enum] enum lsa_TrustAuthType lsa_TrustAuthType; | 
|---|
| 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 | [value(0)] 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 | [value(0)] 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 | [value(0)] uint32 reserved; | 
|---|
| 58 | drsuapi_DsReplicaCursor cursors[count]; | 
|---|
| 59 | } replUpToDateVectorCtr1; | 
|---|
| 60 |  | 
|---|
| 61 | typedef struct { | 
|---|
| 62 | uint32 count; | 
|---|
| 63 | [value(0)] 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 | [value(0)] 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 | * w2k8 uses version 2 | 
|---|
| 87 | */ | 
|---|
| 88 | typedef [public,gensize] struct { | 
|---|
| 89 | [value(strlen(dns_name)+1)] uint32 __dns_name_size; | 
|---|
| 90 | [charset(DOS)] uint8 dns_name[__dns_name_size]; | 
|---|
| 91 | } repsFromTo1OtherInfo; | 
|---|
| 92 |  | 
|---|
| 93 | typedef [public,gensize,flag(NDR_PAHEX)] struct { | 
|---|
| 94 | /* this includes the 8 bytes of the repsFromToBlob header */ | 
|---|
| 95 | [value(ndr_size_repsFromTo1(this, ndr->flags)+8)] uint32 blobsize; | 
|---|
| 96 | uint32 consecutive_sync_failures; | 
|---|
| 97 | NTTIME_1sec last_success; | 
|---|
| 98 | NTTIME_1sec last_attempt; | 
|---|
| 99 | WERROR result_last_attempt; | 
|---|
| 100 | [relative] repsFromTo1OtherInfo *other_info; | 
|---|
| 101 | [value(ndr_size_repsFromTo1OtherInfo(other_info, ndr->flags))] uint32 other_info_length; | 
|---|
| 102 | drsuapi_DrsOptions replica_flags; | 
|---|
| 103 | uint8 schedule[84]; | 
|---|
| 104 | [value(0)] uint32 reserved; | 
|---|
| 105 | drsuapi_DsReplicaHighWaterMark highwatermark; | 
|---|
| 106 | GUID source_dsa_obj_guid; /* the 'objectGuid' field of the CN=NTDS Settings object */ | 
|---|
| 107 | GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ | 
|---|
| 108 | GUID transport_guid; | 
|---|
| 109 | } repsFromTo1; | 
|---|
| 110 |  | 
|---|
| 111 | typedef [public,relative_base,gensize] struct { | 
|---|
| 112 | [value(ndr_size_repsFromTo2OtherInfo(this,ndr->flags))] | 
|---|
| 113 | uint32 __ndr_size; | 
|---|
| 114 | [relative] nstring *dns_name1; | 
|---|
| 115 | uint32 unknown1; | 
|---|
| 116 | [relative] nstring *dns_name2; | 
|---|
| 117 | hyper unknown2; | 
|---|
| 118 | } repsFromTo2OtherInfo; | 
|---|
| 119 |  | 
|---|
| 120 | typedef [public,gensize,flag(NDR_PAHEX)] struct { | 
|---|
| 121 | /* this includes the 8 bytes of the repsFromToBlob header */ | 
|---|
| 122 | [value(ndr_size_repsFromTo2(this, ndr->flags)+8)] uint32 blobsize; | 
|---|
| 123 | uint32 consecutive_sync_failures; | 
|---|
| 124 | NTTIME_1sec last_success; | 
|---|
| 125 | NTTIME_1sec last_attempt; | 
|---|
| 126 | WERROR result_last_attempt; | 
|---|
| 127 | [relative] repsFromTo2OtherInfo *other_info; | 
|---|
| 128 | [value(ndr_size_repsFromTo2OtherInfo(other_info, ndr->flags))] uint32 other_info_length; | 
|---|
| 129 | drsuapi_DrsOptions replica_flags; | 
|---|
| 130 | uint8 schedule[84]; | 
|---|
| 131 | [value(0)] uint32 reserved; | 
|---|
| 132 | drsuapi_DsReplicaHighWaterMark highwatermark; | 
|---|
| 133 | GUID source_dsa_obj_guid; /* the 'objectGuid' field of the CN=NTDS Settings object */ | 
|---|
| 134 | GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ | 
|---|
| 135 | GUID transport_guid; | 
|---|
| 136 | hyper unknown1; | 
|---|
| 137 | } repsFromTo2; | 
|---|
| 138 |  | 
|---|
| 139 | typedef [nodiscriminant] union { | 
|---|
| 140 | [case(1)] repsFromTo1 ctr1; | 
|---|
| 141 | [case(2)] repsFromTo2 ctr2; | 
|---|
| 142 | } repsFromTo; | 
|---|
| 143 |  | 
|---|
| 144 | typedef [public] struct { | 
|---|
| 145 | uint32 version; | 
|---|
| 146 | [value(0)] uint32 reserved; | 
|---|
| 147 | [switch_is(version)] repsFromTo ctr; | 
|---|
| 148 | } repsFromToBlob; | 
|---|
| 149 |  | 
|---|
| 150 | void decode_repsFromTo( | 
|---|
| 151 | [in] repsFromToBlob blob | 
|---|
| 152 | ); | 
|---|
| 153 |  | 
|---|
| 154 | /* | 
|---|
| 155 | * partialAttributeSet | 
|---|
| 156 | * w2k  uses version 1 | 
|---|
| 157 | * w2k3 uses version 1 | 
|---|
| 158 | */ | 
|---|
| 159 | typedef struct { | 
|---|
| 160 | uint32 count; | 
|---|
| 161 | drsuapi_DsAttributeId array[count]; | 
|---|
| 162 | } partialAttributeSetCtr1; | 
|---|
| 163 |  | 
|---|
| 164 | typedef [nodiscriminant] union { | 
|---|
| 165 | [case(1)] partialAttributeSetCtr1 ctr1; | 
|---|
| 166 | } partialAttributeSetCtr; | 
|---|
| 167 |  | 
|---|
| 168 | typedef [public] struct { | 
|---|
| 169 | uint32 version; | 
|---|
| 170 | [value(0)] uint32 reserved; | 
|---|
| 171 | [switch_is(version)] partialAttributeSetCtr ctr; | 
|---|
| 172 | } partialAttributeSetBlob; | 
|---|
| 173 |  | 
|---|
| 174 | void decode_partialAttributeSet( | 
|---|
| 175 | [in] partialAttributeSetBlob blob | 
|---|
| 176 | ); | 
|---|
| 177 |  | 
|---|
| 178 |  | 
|---|
| 179 | /* | 
|---|
| 180 | * schemaInfo attribute | 
|---|
| 181 | * | 
|---|
| 182 | * Used as an attribute on Schema. | 
|---|
| 183 | * Also during replication as part of | 
|---|
| 184 | * prefixMap to identify what revision | 
|---|
| 185 | * of Schema source DC has | 
|---|
| 186 | */ | 
|---|
| 187 | typedef [public,flag(NDR_NOALIGN)] struct { | 
|---|
| 188 | [value(0xFF)] uint8 marker; | 
|---|
| 189 | [flag(NDR_BIG_ENDIAN)] uint32 revision; | 
|---|
| 190 | GUID   invocation_id; | 
|---|
| 191 | } schemaInfoBlob; | 
|---|
| 192 |  | 
|---|
| 193 |  | 
|---|
| 194 | /* | 
|---|
| 195 | * MS w2k3 and w2k8 prefixMap format | 
|---|
| 196 | * There is no version number. Format is: | 
|---|
| 197 | *   uint32 - number of entries in the map | 
|---|
| 198 | *   uint32 - total bytes that structure occupies | 
|---|
| 199 | *   ENTRIES: | 
|---|
| 200 | *     uint16 - prefix ID (OID's last sub-id encoded. see prefixMap) | 
|---|
| 201 | *     uint16 - number of bytes in prefix N | 
|---|
| 202 | *     uint8[N] - BER encoded prefix | 
|---|
| 203 | */ | 
|---|
| 204 | typedef [noprint,flag(NDR_NOALIGN)] struct { | 
|---|
| 205 | uint16 entryID; | 
|---|
| 206 | uint16 length; | 
|---|
| 207 | uint8 binary_oid[length]; | 
|---|
| 208 | } drsuapi_MSPrefixMap_Entry; | 
|---|
| 209 |  | 
|---|
| 210 | typedef [public,gensize] struct { | 
|---|
| 211 | uint32 num_entries; | 
|---|
| 212 | [value(ndr_size_drsuapi_MSPrefixMap_Ctr(r, ndr->flags))] uint32 __ndr_size; | 
|---|
| 213 | drsuapi_MSPrefixMap_Entry entries[num_entries]; | 
|---|
| 214 | } drsuapi_MSPrefixMap_Ctr; | 
|---|
| 215 |  | 
|---|
| 216 | /* | 
|---|
| 217 | * prefixMap | 
|---|
| 218 | * w2k  unknown | 
|---|
| 219 | * w2k3 unknown | 
|---|
| 220 | * samba4 uses 0x44534442 'DSDB' | 
|---|
| 221 | * | 
|---|
| 222 | * as we windows don't return the prefixMap attribute when you ask for | 
|---|
| 223 | * we don't know the format, but the attribute is not replicated | 
|---|
| 224 | * so that we can choose our own format... | 
|---|
| 225 | */ | 
|---|
| 226 | typedef [v1_enum] enum { | 
|---|
| 227 | PREFIX_MAP_VERSION_DSDB = 0x44534442 | 
|---|
| 228 | } prefixMapVersion; | 
|---|
| 229 |  | 
|---|
| 230 | typedef [nodiscriminant] union { | 
|---|
| 231 | [case(PREFIX_MAP_VERSION_DSDB)] drsuapi_DsReplicaOIDMapping_Ctr dsdb; | 
|---|
| 232 | } prefixMapCtr; | 
|---|
| 233 |  | 
|---|
| 234 | typedef [public] struct { | 
|---|
| 235 | prefixMapVersion version; | 
|---|
| 236 | [value(0)] uint32 reserved; | 
|---|
| 237 | [switch_is(version)] prefixMapCtr ctr; | 
|---|
| 238 | } prefixMapBlob; | 
|---|
| 239 |  | 
|---|
| 240 | void decode_prefixMap( | 
|---|
| 241 | [in] prefixMapBlob blob | 
|---|
| 242 | ); | 
|---|
| 243 |  | 
|---|
| 244 |  | 
|---|
| 245 | /* | 
|---|
| 246 | * the cookie for the LDAP dirsync control | 
|---|
| 247 | */ | 
|---|
| 248 | typedef [nodiscriminant,gensize] union { | 
|---|
| 249 | [case(0)]; | 
|---|
| 250 | [default] replUpToDateVectorBlob uptodateness_vector; | 
|---|
| 251 | } ldapControlDirSyncExtra; | 
|---|
| 252 |  | 
|---|
| 253 | typedef struct { | 
|---|
| 254 | [value(3)] uint32 u1; | 
|---|
| 255 | NTTIME time; | 
|---|
| 256 | uint32 u2; | 
|---|
| 257 | uint32 u3; | 
|---|
| 258 | [value(ndr_size_ldapControlDirSyncExtra(&extra, extra.uptodateness_vector.version, 0))] | 
|---|
| 259 | uint32 extra_length; | 
|---|
| 260 | drsuapi_DsReplicaHighWaterMark highwatermark; | 
|---|
| 261 | GUID guid1; | 
|---|
| 262 | [switch_is(extra_length)] ldapControlDirSyncExtra extra; | 
|---|
| 263 | } ldapControlDirSyncBlob; | 
|---|
| 264 |  | 
|---|
| 265 | typedef [public,relative_base] struct { | 
|---|
| 266 | [charset(DOS),value("MSDS")] uint8 msds[4]; | 
|---|
| 267 | [subcontext(0)] ldapControlDirSyncBlob blob; | 
|---|
| 268 | } ldapControlDirSyncCookie; | 
|---|
| 269 |  | 
|---|
| 270 | void decode_ldapControlDirSync( | 
|---|
| 271 | [in] ldapControlDirSyncCookie cookie | 
|---|
| 272 | ); | 
|---|
| 273 |  | 
|---|
| 274 | typedef struct { | 
|---|
| 275 | [value(2*strlen_m(name))] uint16 name_len; | 
|---|
| 276 | [value(strlen(data))] uint16 data_len; | 
|---|
| 277 | uint16 reserved; /* 2 for 'Packages', 1 for 'Primary:*', but should be ignored */ | 
|---|
| 278 | [charset(UTF16)] uint8 name[name_len]; | 
|---|
| 279 | /* | 
|---|
| 280 | * the data field contains data as HEX strings | 
|---|
| 281 | * | 
|---|
| 282 | * 'Packages': | 
|---|
| 283 | *   data contains the list of packages | 
|---|
| 284 | *   as non termiated UTF16 strings with | 
|---|
| 285 | *   a UTF16 NULL byte as separator | 
|---|
| 286 | * | 
|---|
| 287 | * 'Primary:Kerberos-Newer-Keys': | 
|---|
| 288 | *    ... | 
|---|
| 289 | * | 
|---|
| 290 | * 'Primary:Kerberos': | 
|---|
| 291 | *    ... | 
|---|
| 292 | * | 
|---|
| 293 | * 'Primary:WDigest': | 
|---|
| 294 | *    ... | 
|---|
| 295 | * | 
|---|
| 296 | * 'Primary:CLEARTEXT': | 
|---|
| 297 | *    data contains the cleartext password | 
|---|
| 298 | *    as UTF16 string encoded as HEX string | 
|---|
| 299 | */ | 
|---|
| 300 | [charset(DOS)] uint8 data[data_len]; | 
|---|
| 301 | } supplementalCredentialsPackage; | 
|---|
| 302 |  | 
|---|
| 303 | /* this are 0x30 (48) whitespaces (0x20) */ | 
|---|
| 304 | const string SUPPLEMENTAL_CREDENTIALS_PREFIX = "                                                "; | 
|---|
| 305 |  | 
|---|
| 306 | typedef [flag(NDR_PAHEX)] enum { | 
|---|
| 307 | SUPPLEMENTAL_CREDENTIALS_SIGNATURE = 0x0050 | 
|---|
| 308 | } supplementalCredentialsSignature; | 
|---|
| 309 |  | 
|---|
| 310 | typedef [gensize] struct { | 
|---|
| 311 | [value(SUPPLEMENTAL_CREDENTIALS_PREFIX),charset(UTF16)] uint16 prefix[0x30]; | 
|---|
| 312 | [value(SUPPLEMENTAL_CREDENTIALS_SIGNATURE)] supplementalCredentialsSignature signature; | 
|---|
| 313 | uint16 num_packages; | 
|---|
| 314 | supplementalCredentialsPackage packages[num_packages]; | 
|---|
| 315 | } supplementalCredentialsSubBlob; | 
|---|
| 316 |  | 
|---|
| 317 | typedef [public] struct { | 
|---|
| 318 | [value(0)] uint32 unknown1; | 
|---|
| 319 | [value(ndr_size_supplementalCredentialsSubBlob(&sub, ndr->flags))] uint32 __ndr_size; | 
|---|
| 320 | [value(0)] uint32 unknown2; | 
|---|
| 321 | [subcontext(0),subcontext_size(__ndr_size)] supplementalCredentialsSubBlob sub; | 
|---|
| 322 | [value(0)] uint8 unknown3; | 
|---|
| 323 | } supplementalCredentialsBlob; | 
|---|
| 324 |  | 
|---|
| 325 | void decode_supplementalCredentials( | 
|---|
| 326 | [in] supplementalCredentialsBlob blob | 
|---|
| 327 | ); | 
|---|
| 328 |  | 
|---|
| 329 | typedef [public] struct { | 
|---|
| 330 | [flag(STR_NOTERM|NDR_REMAINING)] string_array names; | 
|---|
| 331 | } package_PackagesBlob; | 
|---|
| 332 |  | 
|---|
| 333 | void decode_Packages( | 
|---|
| 334 | [in] package_PackagesBlob blob | 
|---|
| 335 | ); | 
|---|
| 336 |  | 
|---|
| 337 | typedef struct { | 
|---|
| 338 | [value(2*strlen_m(string))] uint16 length; | 
|---|
| 339 | [value(2*strlen_m(string))] uint16 size; | 
|---|
| 340 | [relative,subcontext(0),subcontext_size(size),flag(STR_NOTERM|NDR_REMAINING)] string *string; | 
|---|
| 341 | } package_PrimaryKerberosString; | 
|---|
| 342 |  | 
|---|
| 343 | typedef struct { | 
|---|
| 344 | [value(0)] uint16 reserved1; | 
|---|
| 345 | [value(0)] uint16 reserved2; | 
|---|
| 346 | [value(0)] uint32 reserved3; | 
|---|
| 347 | uint32 keytype; | 
|---|
| 348 | [value((value?value->length:0))] uint32 value_len; | 
|---|
| 349 | [relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value; | 
|---|
| 350 | } package_PrimaryKerberosKey3; | 
|---|
| 351 |  | 
|---|
| 352 | typedef struct { | 
|---|
| 353 | uint16 num_keys; | 
|---|
| 354 | uint16 num_old_keys; | 
|---|
| 355 | package_PrimaryKerberosString salt; | 
|---|
| 356 | package_PrimaryKerberosKey3 keys[num_keys]; | 
|---|
| 357 | package_PrimaryKerberosKey3 old_keys[num_old_keys]; | 
|---|
| 358 | [value(0)] uint32 padding1; | 
|---|
| 359 | [value(0)] uint32 padding2; | 
|---|
| 360 | [value(0)] uint32 padding3; | 
|---|
| 361 | [value(0)] uint32 padding4; | 
|---|
| 362 | [value(0)] uint32 padding5; | 
|---|
| 363 | } package_PrimaryKerberosCtr3; | 
|---|
| 364 |  | 
|---|
| 365 | typedef struct { | 
|---|
| 366 | [value(0)] uint16 reserved1; | 
|---|
| 367 | [value(0)] uint16 reserved2; | 
|---|
| 368 | [value(0)] uint32 reserved3; | 
|---|
| 369 | uint32 iteration_count; | 
|---|
| 370 | uint32 keytype; | 
|---|
| 371 | [value((value?value->length:0))] uint32 value_len; | 
|---|
| 372 | [relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value; | 
|---|
| 373 | } package_PrimaryKerberosKey4; | 
|---|
| 374 |  | 
|---|
| 375 | typedef struct { | 
|---|
| 376 | uint16 num_keys; | 
|---|
| 377 | [value(0)] uint16 num_service_keys; | 
|---|
| 378 | uint16 num_old_keys; | 
|---|
| 379 | uint16 num_older_keys; | 
|---|
| 380 | package_PrimaryKerberosString salt; | 
|---|
| 381 | uint32 default_iteration_count; | 
|---|
| 382 | package_PrimaryKerberosKey4 keys[num_keys]; | 
|---|
| 383 | package_PrimaryKerberosKey4 service_keys[num_service_keys]; | 
|---|
| 384 | package_PrimaryKerberosKey4 old_keys[num_old_keys]; | 
|---|
| 385 | package_PrimaryKerberosKey4 older_keys[num_older_keys]; | 
|---|
| 386 | } package_PrimaryKerberosCtr4; | 
|---|
| 387 |  | 
|---|
| 388 | typedef [nodiscriminant] union { | 
|---|
| 389 | [case(3)] package_PrimaryKerberosCtr3 ctr3; | 
|---|
| 390 | [case(4)] package_PrimaryKerberosCtr4 ctr4; | 
|---|
| 391 | } package_PrimaryKerberosCtr; | 
|---|
| 392 |  | 
|---|
| 393 | typedef [public] struct { | 
|---|
| 394 | uint16 version; | 
|---|
| 395 | [value(0)] uint16 flags; | 
|---|
| 396 | [switch_is(version)] package_PrimaryKerberosCtr ctr; | 
|---|
| 397 | } package_PrimaryKerberosBlob; | 
|---|
| 398 |  | 
|---|
| 399 | void decode_PrimaryKerberos( | 
|---|
| 400 | [in] package_PrimaryKerberosBlob blob | 
|---|
| 401 | ); | 
|---|
| 402 |  | 
|---|
| 403 | typedef [public] struct { | 
|---|
| 404 | [flag(NDR_REMAINING)] DATA_BLOB cleartext; | 
|---|
| 405 | } package_PrimaryCLEARTEXTBlob; | 
|---|
| 406 |  | 
|---|
| 407 | void decode_PrimaryCLEARTEXT( | 
|---|
| 408 | [in] package_PrimaryCLEARTEXTBlob blob | 
|---|
| 409 | ); | 
|---|
| 410 |  | 
|---|
| 411 | typedef [flag(NDR_PAHEX)] struct { | 
|---|
| 412 | uint8 hash[16]; | 
|---|
| 413 | } package_PrimaryWDigestHash; | 
|---|
| 414 |  | 
|---|
| 415 | typedef [public] struct { | 
|---|
| 416 | [value(0x31)] uint16 unknown1; | 
|---|
| 417 | [value(0x01)] uint8  unknown2; | 
|---|
| 418 | uint8  num_hashes; | 
|---|
| 419 | [value(0)] uint32 unknown3; | 
|---|
| 420 | [value(0)] udlong uuknown4; | 
|---|
| 421 | package_PrimaryWDigestHash hashes[num_hashes]; | 
|---|
| 422 | } package_PrimaryWDigestBlob; | 
|---|
| 423 |  | 
|---|
| 424 | void decode_PrimaryWDigest( | 
|---|
| 425 | [in] package_PrimaryWDigestBlob blob | 
|---|
| 426 | ); | 
|---|
| 427 |  | 
|---|
| 428 | typedef struct { | 
|---|
| 429 | [value(0)] uint32 size; | 
|---|
| 430 | } AuthInfoNone; | 
|---|
| 431 |  | 
|---|
| 432 | typedef struct { | 
|---|
| 433 | [value(16)] uint32 size; | 
|---|
| 434 | samr_Password password; | 
|---|
| 435 | } AuthInfoNT4Owf; | 
|---|
| 436 |  | 
|---|
| 437 | /* | 
|---|
| 438 | * the secret value is encoded as UTF16 if it's a string | 
|---|
| 439 | * but depending the AuthType, it might also be krb5 trusts have random bytes here, so converting to UTF16 | 
|---|
| 440 | * mayfail... | 
|---|
| 441 | * | 
|---|
| 442 | * TODO: We should try handle the case of a random buffer in all places | 
|---|
| 443 | *       we deal with cleartext passwords from windows | 
|---|
| 444 | * | 
|---|
| 445 | * so we don't use this: | 
|---|
| 446 | * | 
|---|
| 447 | * uint32 value_len; | 
|---|
| 448 | * [charset(UTF16)] uint8 value[value_len]; | 
|---|
| 449 | */ | 
|---|
| 450 |  | 
|---|
| 451 | typedef struct { | 
|---|
| 452 | uint32 size; | 
|---|
| 453 | uint8 password[size]; | 
|---|
| 454 | } AuthInfoClear; | 
|---|
| 455 |  | 
|---|
| 456 | typedef struct { | 
|---|
| 457 | [value(4)] uint32 size; | 
|---|
| 458 | uint32 version; | 
|---|
| 459 | } AuthInfoVersion; | 
|---|
| 460 |  | 
|---|
| 461 | typedef [nodiscriminant] union { | 
|---|
| 462 | [case(TRUST_AUTH_TYPE_NONE)] AuthInfoNone none; | 
|---|
| 463 | [case(TRUST_AUTH_TYPE_NT4OWF)] AuthInfoNT4Owf nt4owf; | 
|---|
| 464 | [case(TRUST_AUTH_TYPE_CLEAR)] AuthInfoClear clear; | 
|---|
| 465 | [case(TRUST_AUTH_TYPE_VERSION)] AuthInfoVersion version; | 
|---|
| 466 | } AuthInfo; | 
|---|
| 467 |  | 
|---|
| 468 | typedef [public] struct { | 
|---|
| 469 | NTTIME LastUpdateTime; | 
|---|
| 470 | lsa_TrustAuthType AuthType; | 
|---|
| 471 | [switch_is(AuthType)] AuthInfo AuthInfo; | 
|---|
| 472 | [flag(NDR_ALIGN4)] DATA_BLOB _pad; | 
|---|
| 473 | } AuthenticationInformation; | 
|---|
| 474 |  | 
|---|
| 475 | /* count is not on the wire */ | 
|---|
| 476 | typedef [public,nopull,nopush,gensize] struct { | 
|---|
| 477 | uint32 count; | 
|---|
| 478 | AuthenticationInformation array[count]; | 
|---|
| 479 | } AuthenticationInformationArray; | 
|---|
| 480 |  | 
|---|
| 481 | /* we cannot use [relative] pointers here because Windows expects the | 
|---|
| 482 | * previous_offset to match the total size of the struct in case | 
|---|
| 483 | * the previous array is empty, see MS-LSAD 2.2.7.16 - gd */ | 
|---|
| 484 | typedef [public,gensize,nopush] struct { | 
|---|
| 485 | uint32 count; | 
|---|
| 486 | [value((count > 0) ? 12 : 0)] uint32 current_offset; | 
|---|
| 487 | [value((count > 0) ? 12 + ndr_size_AuthenticationInformationArray(¤t, ndr->flags) : 0)] uint32 previous_offset; | 
|---|
| 488 | [subcontext(0),subcontext_size((previous_offset)-(current_offset))] AuthenticationInformationArray current; | 
|---|
| 489 | [subcontext(0)] [flag(NDR_REMAINING)] AuthenticationInformationArray previous; | 
|---|
| 490 | } trustAuthInOutBlob; | 
|---|
| 491 |  | 
|---|
| 492 | [nopython] void decode_trustAuthInOut( | 
|---|
| 493 | [in] trustAuthInOutBlob blob | 
|---|
| 494 | ); | 
|---|
| 495 |  | 
|---|
| 496 | typedef [public,nopull] struct { | 
|---|
| 497 | uint8 confounder[512]; | 
|---|
| 498 | [subcontext(0),subcontext_size(outgoing_size)] trustAuthInOutBlob outgoing; | 
|---|
| 499 | [subcontext(0),subcontext_size(incoming_size)] trustAuthInOutBlob incoming; | 
|---|
| 500 | [value(ndr_size_trustAuthInOutBlob(&outgoing, ndr->flags))] uint32 outgoing_size; | 
|---|
| 501 | [value(ndr_size_trustAuthInOutBlob(&incoming, ndr->flags))] uint32 incoming_size; | 
|---|
| 502 | } trustDomainPasswords; | 
|---|
| 503 |  | 
|---|
| 504 | [nopython] void decode_trustDomainPasswords( | 
|---|
| 505 | [in] trustDomainPasswords blob | 
|---|
| 506 | ); | 
|---|
| 507 |  | 
|---|
| 508 | typedef [public] struct { | 
|---|
| 509 | uint32 marker; | 
|---|
| 510 | DATA_BLOB data; | 
|---|
| 511 | } DsCompressedChunk; | 
|---|
| 512 |  | 
|---|
| 513 | typedef struct { | 
|---|
| 514 | uint16 __size; | 
|---|
| 515 | [size_is(__size),charset(DOS)] uint8 *string; | 
|---|
| 516 | } ExtendedErrorAString; | 
|---|
| 517 |  | 
|---|
| 518 | typedef struct { | 
|---|
| 519 | uint16 __size; | 
|---|
| 520 | [size_is(__size),charset(UTF16)] uint16 *string; | 
|---|
| 521 | } ExtendedErrorUString; | 
|---|
| 522 |  | 
|---|
| 523 | typedef struct { | 
|---|
| 524 | uint16 length; | 
|---|
| 525 | [size_is(length)] uint8 *data; | 
|---|
| 526 | } ExtendedErrorBlob; | 
|---|
| 527 |  | 
|---|
| 528 | typedef enum { | 
|---|
| 529 | EXTENDED_ERROR_COMPUTER_NAME_PRESENT    = 1, | 
|---|
| 530 | EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT= 2 | 
|---|
| 531 | } ExtendedErrorComputerNamePresent; | 
|---|
| 532 |  | 
|---|
| 533 | typedef [switch_type(ExtendedErrorComputerNamePresent)] union { | 
|---|
| 534 | [case(EXTENDED_ERROR_COMPUTER_NAME_PRESENT)] ExtendedErrorUString name; | 
|---|
| 535 | [case(EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT)]; | 
|---|
| 536 | } ExtendedErrorComputerNameU; | 
|---|
| 537 |  | 
|---|
| 538 | typedef struct { | 
|---|
| 539 | ExtendedErrorComputerNamePresent present; | 
|---|
| 540 | [switch_is(present)] ExtendedErrorComputerNameU n; | 
|---|
| 541 | } ExtendedErrorComputerName; | 
|---|
| 542 |  | 
|---|
| 543 | typedef enum { | 
|---|
| 544 | EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING          = 1, | 
|---|
| 545 | EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING        = 2, | 
|---|
| 546 | EXTENDED_ERROR_PARAM_TYPE_UINT32                = 3, | 
|---|
| 547 | EXTENDED_ERROR_PARAM_TYPE_UINT16                = 4, | 
|---|
| 548 | EXTENDED_ERROR_PARAM_TYPE_UINT64                = 5, | 
|---|
| 549 | EXTENDED_ERROR_PARAM_TYPE_NONE                  = 6, | 
|---|
| 550 | EXTENDED_ERROR_PARAM_TYPE_BLOB                  = 7 | 
|---|
| 551 | } ExtendedErrorParamType; | 
|---|
| 552 |  | 
|---|
| 553 | typedef [switch_type(ExtendedErrorParamType)] union { | 
|---|
| 554 | [case(EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING)] ExtendedErrorAString a_string; | 
|---|
| 555 | [case(EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING)] ExtendedErrorUString u_string; | 
|---|
| 556 | [case(EXTENDED_ERROR_PARAM_TYPE_UINT32)] uint32 uint32; | 
|---|
| 557 | [case(EXTENDED_ERROR_PARAM_TYPE_UINT16)] uint16 uint16; | 
|---|
| 558 | [case(EXTENDED_ERROR_PARAM_TYPE_UINT64)] hyper uint64; | 
|---|
| 559 | [case(EXTENDED_ERROR_PARAM_TYPE_NONE)]; | 
|---|
| 560 | [case(EXTENDED_ERROR_PARAM_TYPE_BLOB)] ExtendedErrorBlob blob; | 
|---|
| 561 | } ExtendedErrorParamU; | 
|---|
| 562 |  | 
|---|
| 563 | typedef struct { | 
|---|
| 564 | ExtendedErrorParamType type; | 
|---|
| 565 | [switch_is(type)] ExtendedErrorParamU p; | 
|---|
| 566 | } ExtendedErrorParam; | 
|---|
| 567 |  | 
|---|
| 568 | typedef [public] struct { | 
|---|
| 569 | ExtendedErrorInfo *next; | 
|---|
| 570 | ExtendedErrorComputerName computer_name; | 
|---|
| 571 | hyper pid; | 
|---|
| 572 | NTTIME time; | 
|---|
| 573 | uint32 generating_component; | 
|---|
| 574 | WERROR status; | 
|---|
| 575 | uint16 detection_location; | 
|---|
| 576 | uint16 flags; | 
|---|
| 577 | uint16 num_params; | 
|---|
| 578 | [size_is(num_params)] ExtendedErrorParam params[]; | 
|---|
| 579 | } ExtendedErrorInfo; | 
|---|
| 580 |  | 
|---|
| 581 | typedef struct { | 
|---|
| 582 | [unique] ExtendedErrorInfo *info; | 
|---|
| 583 | } ExtendedErrorInfoPtr; | 
|---|
| 584 |  | 
|---|
| 585 | [nopython] void decode_ExtendedErrorInfo ( | 
|---|
| 586 | [in,subcontext(0xFFFFFC01)] ExtendedErrorInfoPtr ptr | 
|---|
| 587 | ); | 
|---|
| 588 |  | 
|---|
| 589 | /* MS-ADTS 7.1.6.9.3 msDS-TrustForestTrustInfo Attribute */ | 
|---|
| 590 |  | 
|---|
| 591 | typedef struct { | 
|---|
| 592 | [value(strlen_m(string))] uint32 size; | 
|---|
| 593 | [charset(UTF8)] uint8 string[size]; | 
|---|
| 594 | } ForestTrustString; | 
|---|
| 595 |  | 
|---|
| 596 | typedef [flag(NDR_NOALIGN)] struct { | 
|---|
| 597 | [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size; | 
|---|
| 598 | [subcontext(0),subcontext_size(sid_size)] dom_sid sid; | 
|---|
| 599 | ForestTrustString dns_name; | 
|---|
| 600 | ForestTrustString netbios_name; | 
|---|
| 601 | } ForestTrustDataDomainInfo; | 
|---|
| 602 |  | 
|---|
| 603 | typedef [flag(NDR_NOALIGN)] struct { | 
|---|
| 604 | uint32 size; | 
|---|
| 605 | uint8 data[size]; | 
|---|
| 606 | } ForestTrustDataBinaryData; | 
|---|
| 607 |  | 
|---|
| 608 | typedef [nodiscriminant] union { | 
|---|
| 609 | [case(FOREST_TRUST_TOP_LEVEL_NAME)] ForestTrustString name; | 
|---|
| 610 | [case(FOREST_TRUST_TOP_LEVEL_NAME_EX)] ForestTrustString name; | 
|---|
| 611 | [case(FOREST_TRUST_DOMAIN_INFO)] ForestTrustDataDomainInfo info; | 
|---|
| 612 | [default] ForestTrustDataBinaryData data; | 
|---|
| 613 | } ForestTrustData; | 
|---|
| 614 |  | 
|---|
| 615 | /* same as lsa_ForestTrustRecordType */ | 
|---|
| 616 | typedef [enum8bit] enum { | 
|---|
| 617 | FOREST_TRUST_TOP_LEVEL_NAME = 0, | 
|---|
| 618 | FOREST_TRUST_TOP_LEVEL_NAME_EX = 1, | 
|---|
| 619 | FOREST_TRUST_DOMAIN_INFO = 2 | 
|---|
| 620 | } ForestTrustInfoRecordType; | 
|---|
| 621 |  | 
|---|
| 622 | /* meaning of flags depends on record type and values are | 
|---|
| 623 | the same as in lsa.idl, see collision record types */ | 
|---|
| 624 | typedef [public,gensize,flag(NDR_NOALIGN)] struct { | 
|---|
| 625 | uint32 flags; | 
|---|
| 626 | NTTIME timestamp; | 
|---|
| 627 | ForestTrustInfoRecordType type; | 
|---|
| 628 | [switch_is(type)] ForestTrustData data; | 
|---|
| 629 | } ForestTrustInfoRecord; | 
|---|
| 630 |  | 
|---|
| 631 | typedef [flag(NDR_NOALIGN)] struct { | 
|---|
| 632 | [value(ndr_size_ForestTrustInfoRecord(&record, ndr->flags))] uint32 record_size; | 
|---|
| 633 | ForestTrustInfoRecord record; | 
|---|
| 634 | } ForestTrustInfoRecordArmor; | 
|---|
| 635 |  | 
|---|
| 636 | typedef [public,flag(NDR_NOALIGN)] struct { | 
|---|
| 637 | uint32 version; | 
|---|
| 638 | uint32 count; | 
|---|
| 639 | ForestTrustInfoRecordArmor records[count]; | 
|---|
| 640 | } ForestTrustInfo; | 
|---|
| 641 |  | 
|---|
| 642 | [nopython] void decode_ForestTrustInfo( | 
|---|
| 643 | [in] ForestTrustInfo blob | 
|---|
| 644 | ); | 
|---|
| 645 | } | 
|---|