From aa720a15319392fee5c532959192d0df5bf4c718 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 19 Dec 2006 13:38:42 +0000 Subject: [PATCH] r20251: I found out that the oid-prefix to uint32-id-prefix mapping is transferred in replication replies, but I don't know the exact encoding. for example the oids are transferred as: 2.5.4 => uint8_t v[] = { 0x55, 0x04 }; 2.5.5 => uint8_t v[] = { 0x55, 0x05 }; 2.5.6 => uint8_t v[] = { 0x55, 0x06 }; 2.5.18 => uint8_t v[] = { 0x55, 0x12 }; 2.5.20 => uint8_t v[] = { 0x55, 0x14 }; 2.5.21 => uint8_t v[] = { 0x55, 0x15 }; 1.2.840.113556.1.2 => uint8_t v[] = { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x14, 0x01, 0x02 }; 1.2.840.113556.1.3 => uint8_t v[] = { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x14, 0x01, 0x03 }; 1.2.840.113556.1.4 => uint8_t v[] = { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x14, 0x01, 0x04 }; 1.2.840.113556.1.5 => uint8_t v[] = { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x14, 0x01, 0x05 }; 1.2.840.113556.1.5.7000 => uint8_t v[] = { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x14, 0x01, 0x05, 0xb6, 0x58 }; 1.2.840.113549.1.9 => uint8_t v[] = { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09 }; 2.16.840.1.113730.3 => uint8_t v[] = { 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x03 }; 2.16.840.1.113730.3.1 => uint8_t v[] = { 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x03, 0x01 }; 2.16.840.1.113730.3.2 => uint8_t v[] = { 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x03, 0x02 }; 0.9.2342.19200300.100.1 => uint8_t v[] = { 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01 }; 0.9.2342.19200300.100.4 => uint8_t v[] = { 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x04 }; 1.3.6.1.4.1.250.1 => uint8_t v[] = { 0x2b, 0x06, 0x01, 0x04, 0x01, 0x81, 0x7a, 0x01 }; 1.3.6.1.4.1.1466.101.119=> uint8_t v[] = { 0x2b, 0x06, 0x01, 0x04, 0x01, 0x8b, 0x3a, 0x65, 0x77 }; if someone knows how the encoding works, please tell me:-) I assume some ASN.1 encoding... metze --- source/libnet/libnet_become_dc.c | 4 +- source/librpc/idl/drsuapi.idl | 117 ++++++++++++++++--------------- source/torture/rpc/drsuapi.c | 4 +- source/torture/rpc/dssync.c | 4 +- 4 files changed, 66 insertions(+), 63 deletions(-) diff --git a/source/libnet/libnet_become_dc.c b/source/libnet/libnet_become_dc.c index d79cce8d03c..742c92787dd 100644 --- a/source/libnet/libnet_become_dc.c +++ b/source/libnet/libnet_become_dc.c @@ -1589,8 +1589,8 @@ static void becomeDC_drsuapi_pull_partition_send(struct libnet_BecomeDC_state *s r->in.req.req8.h1 = 0; r->in.req.req8.unique_ptr1 = 0; r->in.req.req8.unique_ptr2 = 0; - r->in.req.req8.ctr12.count = 0; - r->in.req.req8.ctr12.array = NULL; + r->in.req.req8.mapping_ctr.num_mappings = 0; + r->in.req.req8.mapping_ctr.mappings = NULL; } else { r->in.level = 5; r->in.req.req5.destination_dsa_guid = partition->destination_dsa_guid; diff --git a/source/librpc/idl/drsuapi.idl b/source/librpc/idl/drsuapi.idl index 4c37036e62b..cc2787523c0 100644 --- a/source/librpc/idl/drsuapi.idl +++ b/source/librpc/idl/drsuapi.idl @@ -241,61 +241,9 @@ interface drsuapi hyper h1; } drsuapi_DsGetNCChangesRequest5; - typedef [flag(NDR_PAHEX)] struct { - [range(0,10000)] uint32 length; - [size_is(length)] uint8 *byte_array; - } drsuapi_DsGetNCChangesRequest_Ctr14; - - typedef struct { - uint32 unknown1; - drsuapi_DsGetNCChangesRequest_Ctr14 data; - } drsuapi_DsGetNCChangesRequest_Ctr13; - - typedef struct { - [range(0,0x100000)] uint32 count; - [size_is(count)] drsuapi_DsGetNCChangesRequest_Ctr13 *array; - } drsuapi_DsGetNCChangesRequest_Ctr12; - - typedef struct { - GUID destination_dsa_guid; - GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ - [ref] drsuapi_DsReplicaObjectIdentifier *naming_context; - drsuapi_DsReplicaHighWaterMark highwatermark; - drsuapi_DsReplicaCoursorCtrEx *uptodateness_vector; - drsuapi_DsReplicaNeighbourFlags replica_flags; - uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */ - uint32 max_ndr_size; /* w2k3 seems to ignore this */ - uint32 unknown4; - hyper h1; - uint32 unique_ptr1; - uint32 unique_ptr2; - drsuapi_DsGetNCChangesRequest_Ctr12 ctr12; - } drsuapi_DsGetNCChangesRequest8; - - typedef [switch_type(int32)] union { - [case(5)] drsuapi_DsGetNCChangesRequest5 req5; - [case(8)] drsuapi_DsGetNCChangesRequest8 req8; - } drsuapi_DsGetNCChangesRequest; - - typedef [public] struct { - GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ - hyper highest_usn; /* updated after a full replication cycle */ - NTTIME last_sync_success; - } drsuapi_DsReplicaCoursor2; - - typedef struct { - uint32 u1; - uint32 u2; - [range(0,0x100000)] uint32 count; - uint32 u3; - [size_is(count)] drsuapi_DsReplicaCoursor2 coursors[]; - } drsuapi_DsReplicaCoursor2CtrEx; - /* - * In DRSUAPI the objectClasses and attributes - * are identified by uint32 values, but in the schema - * they are identified by the governsID (objectClasses) - * and attributeID (attributes) + * In DRSUAPI all attributes with syntax 2.5.5.2 + * are identified by uint32 values * * the following table shows the mapping used between the two representations * e.g. - objectClass 'nTDSDSA' has governsID: 1.2.840.113556.1.5.7000.47 @@ -306,6 +254,9 @@ interface drsuapi * - the mapping table gives a UINT32-prefix: 0x00170000 * - and the UINT32-ID is 0x0017002F = 0x00170000 | 0x2F * + * This prefix mapping table is replied in the drsuapi_DsReplicaOIDMapping_Ctr + * array. The following are the default mappings of w2k3 + * * OID-prefix => UINT32-Id prefix * * 2.5.4.* => 0x00000000 (standard attributes RFC2256 core.schema) @@ -334,7 +285,10 @@ interface drsuapi * struct drsuapi_DsObjectIdentifier3 * * 2.5.5.2 => OID-string - * => mayContain, mustContain... also have this syntax but have string values + * => all values are represented as uint32 values in drsuapi + * => governsID, attributeID and attributeSyntax returned as OID-Strings in LDAP + * => mayContain, mustContain and all other attributes with 2.5.5.2 syntax + * are returned as attribute names * * 2.5.5.4 => String(Teletex) case-insensitive string with teletex charset * @@ -371,6 +325,20 @@ interface drsuapi * * 2.5.5.17 => dom_sid */ + typedef [flag(NDR_PAHEX)] struct { + [range(0,10000)] uint32 length; + [size_is(length)] uint8 *data; + } drsuapi_DsReplicaOID; + + typedef struct { + uint32 id_prefix; + drsuapi_DsReplicaOID oid; + } drsuapi_DsReplicaOIDMapping; + + typedef struct { + [range(0,0x100000)] uint32 num_mappings; + [size_is(num_mappings)] drsuapi_DsReplicaOIDMapping *mappings; + } drsuapi_DsReplicaOIDMapping_Ctr; typedef [flag(NDR_PAHEX),v1_enum] enum { DRSUAPI_OBJECTCLASS_top = 0x00010000, @@ -430,6 +398,41 @@ interface drsuapi DRSUAPI_ATTRIBUTE_msDS_hasMasterNCs = 0x0009072c } drsuapi_DsAttributeId; + typedef struct { + GUID destination_dsa_guid; + GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ + [ref] drsuapi_DsReplicaObjectIdentifier *naming_context; + drsuapi_DsReplicaHighWaterMark highwatermark; + drsuapi_DsReplicaCoursorCtrEx *uptodateness_vector; + drsuapi_DsReplicaNeighbourFlags replica_flags; + uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */ + uint32 max_ndr_size; /* w2k3 seems to ignore this */ + uint32 unknown4; + hyper h1; + uint32 unique_ptr1; + uint32 unique_ptr2; + drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr; + } drsuapi_DsGetNCChangesRequest8; + + typedef [switch_type(int32)] union { + [case(5)] drsuapi_DsGetNCChangesRequest5 req5; + [case(8)] drsuapi_DsGetNCChangesRequest8 req8; + } drsuapi_DsGetNCChangesRequest; + + typedef [public] struct { + GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */ + hyper highest_usn; /* updated after a full replication cycle */ + NTTIME last_sync_success; + } drsuapi_DsReplicaCoursor2; + + typedef struct { + uint32 u1; + uint32 u2; + [range(0,0x100000)] uint32 count; + uint32 u3; + [size_is(count)] drsuapi_DsReplicaCoursor2 coursors[]; + } drsuapi_DsReplicaCoursor2CtrEx; + /* Generic DATA_BLOB values */ typedef struct { [range(0,10485760)] uint32 length; @@ -639,7 +642,7 @@ interface drsuapi drsuapi_DsReplicaHighWaterMark old_highwatermark; drsuapi_DsReplicaHighWaterMark new_highwatermark; drsuapi_DsReplicaCoursorCtrEx *uptodateness_vector; - drsuapi_DsGetNCChangesRequest_Ctr12 ctr12; + drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr; uint32 total_object_count; uint32 object_count; /* this +55 is sometimes +56, so I don't know where this comes from... --metze */ @@ -667,7 +670,7 @@ interface drsuapi drsuapi_DsReplicaHighWaterMark old_highwatermark; drsuapi_DsReplicaHighWaterMark new_highwatermark; drsuapi_DsReplicaCoursor2CtrEx *uptodateness_vector; - drsuapi_DsGetNCChangesRequest_Ctr12 ctr12; + drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr; uint32 total_object_count; uint32 object_count; /* this +55 is sometimes +56, so I don't know where this comes from... --metze */ diff --git a/source/torture/rpc/drsuapi.c b/source/torture/rpc/drsuapi.c index fbe62ae7d41..ef49b0443ee 100644 --- a/source/torture/rpc/drsuapi.c +++ b/source/torture/rpc/drsuapi.c @@ -599,8 +599,8 @@ static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.req.req8.h1 = 0; r.in.req.req8.unique_ptr1 = 0; r.in.req.req8.unique_ptr2 = 0; - r.in.req.req8.ctr12.count = 0; - r.in.req.req8.ctr12.array = NULL; + r.in.req.req8.mapping_ctr.num_mappings = 0; + r.in.req.req8.mapping_ctr.mappings = NULL; break; } diff --git a/source/torture/rpc/dssync.c b/source/torture/rpc/dssync.c index f07df0f7ad0..312ba87f7e6 100644 --- a/source/torture/rpc/dssync.c +++ b/source/torture/rpc/dssync.c @@ -477,8 +477,8 @@ static BOOL test_FetchData(struct DsSyncTest *ctx) r.in.req.req8.h1 = 0; r.in.req.req8.unique_ptr1 = 0; r.in.req.req8.unique_ptr2 = 0; - r.in.req.req8.ctr12.count = 0; - r.in.req.req8.ctr12.array = NULL; + r.in.req.req8.mapping_ctr.num_mappings = 0; + r.in.req.req8.mapping_ctr.mappings = NULL; break; } -- 2.34.1