From c638a8380defc9afc713886f3290d581ac37995d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 16 Mar 2005 15:47:19 +0000 Subject: r5830: start to analyse the attribute values, depending on the attribute type metze (This used to be commit 63229b9503950847fbecd6ec22171d8c18d7ac91) --- source4/librpc/idl/drsuapi.idl | 183 ++++++++++++++++++++++++++++++++++++----- source4/torture/rpc/drsuapi.c | 29 ++++++- 2 files changed, 189 insertions(+), 23 deletions(-) diff --git a/source4/librpc/idl/drsuapi.idl b/source4/librpc/idl/drsuapi.idl index dbeaa3ccab..50706a1739 100644 --- a/source4/librpc/idl/drsuapi.idl +++ b/source4/librpc/idl/drsuapi.idl @@ -249,38 +249,169 @@ interface drsuapi [size_is(count)] drsuapi_DsReplicaCoursorEx array[]; } drsuapi_DsReplicaCoursorEx05Ctr; + typedef [v1_enum] enum { + DRSUAPI_OBJECTCLASS_top = 0x0 + } drsuapi_DsObjectClassId; + + typedef [v1_enum] enum { + DRSUAPI_ATTRIBUTE_objectClass = 0x00000000, + DRSUAPI_ATTRIBUTE_description = 0x0000000d, + DRSUAPI_ATTRIBUTE_invocationId = 0x00020073, + DRSUAPI_ATTRIBUTE_ntSecurityDescriptor = 0x00020119, + DRSUAPI_ATTRIBUTE_objectSid = 0x00090092, + DRSUAPI_ATTRIBUTE_objectCategory = 0x0009030e + } drsuapi_DsAttributeId; + + /* Generic DATA_BLOB values */ typedef struct { - uint32 version; - NTTIME_1sec time; + [range(0,10485760)] uint32 length; + DATA_BLOB *data; + } drsuapi_DsAttributeValueDataBlob; + + typedef struct { + [range(0,10485760)] uint32 num_values; + [size_is(num_values)] drsuapi_DsAttributeValueDataBlob *values[]; + } drsuapi_DsAttributeValueCtrDataBlob; + + /* objectClass values */ + typedef struct { + [range(0,10485760)] uint32 length; + [subcontext(4)] drsuapi_DsObjectClassId *objectClassId; + } drsuapi_DsAttributeValueObjectClassId; + + typedef struct { + [range(0,10485760)] uint32 num_values; + [size_is(num_values)] drsuapi_DsAttributeValueObjectClassId *values[]; + } drsuapi_DsAttributeValueCtrObjectClassId; + + /* uint32 values */ + typedef struct { + [range(0,10485760)] uint32 length; + [subcontext(4)] uint32 *value; + } drsuapi_DsAttributeValueUINT32; + + typedef struct { + [range(0,10485760)] uint32 num_values; + [size_is(num_values)] drsuapi_DsAttributeValueUINT32 *values[]; + } drsuapi_DsAttributeValueCtrUINT32; + + /* UnicodeString values */ + typedef struct { + [range(0,10485760)] uint32 length; + [subcontext(4)] nstring *string; + } drsuapi_DsAttributeValueUnicodeString; + + typedef struct { + [range(0,10485760)] uint32 num_values; + [size_is(num_values)] drsuapi_DsAttributeValueUnicodeString *values[]; + } drsuapi_DsAttributeValueCtrUnicodeString; + + /* DN String values */ + typedef [gensize] struct { + [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3(r, ndr->flags)-4)] uint32 __ndr_size; + [value(ndr_length_dom_sid(&r->sid))] uint32 __ndr_size_sid; GUID guid; - hyper usn; - } drsuapi_DsReplicaMetaData; + [subcontext_size(28),subcontext(0)] dom_sid sid; + [flag(STR_SIZE4|STR_CHARLEN)] string dn; + } drsuapi_DsReplicaObjectIdentifier3; - typedef [public] struct { - [range(0,1048576)] uint32 count; - [size_is(count)] drsuapi_DsReplicaMetaData meta_data[]; - } drsuapi_DsReplicaMetaDataCtr; + typedef struct { + [range(0,10485760)] uint32 length; + [subcontext(4)] drsuapi_DsReplicaObjectIdentifier3 *object; + } drsuapi_DsAttributeValueDNString; - typedef [flag(NDR_PAHEX)] struct { + typedef struct { + [range(0,10485760)] uint32 num_values; + [size_is(num_values)] drsuapi_DsAttributeValueDNString *values[]; + } drsuapi_DsAttributeValueCtrDNString; + + /* GUID values */ + typedef struct { [range(0,10485760)] uint32 length; - DATA_BLOB *data; - } drsuapi_DsReplicaAttributeValue; + [subcontext(4)] GUID *guid; + } drsuapi_DsAttributeValueGUID; typedef struct { [range(0,10485760)] uint32 num_values; - [size_is(num_values)] drsuapi_DsReplicaAttributeValue *values[]; - } drsuapi_DsReplicaAttributeValueCtr; + [size_is(num_values)] drsuapi_DsAttributeValueGUID *values[]; + } drsuapi_DsAttributeValueCtrGUID; - typedef [v1_enum] enum { - DRSUAPI_ATTR_objectClass = 0x00000000, - DRSUAPI_ATTR_description = 0x0000000d, - DRSUAPI_ATTR_ntSecurityDescriptor = 0x00020119, - DRSUAPI_ATTR_objectSid = 0x00090092 - } drsuapi_DsAttributeId; + /* SID values */ + typedef struct { + [range(0,10485760)] uint32 length; + [subcontext(4)] dom_sid *sid; + } drsuapi_DsAttributeValueSID; + + typedef struct { + [range(0,10485760)] uint32 num_values; + [size_is(num_values)] drsuapi_DsAttributeValueSID *values[]; + } drsuapi_DsAttributeValueCtrSID; + + /* SecurityDescriptor values */ + typedef struct { + [range(0,10485760)] uint32 length; + [subcontext(4)] security_descriptor *sd; + } drsuapi_DsAttributeValueSecurityDescriptor; + + typedef struct { + [range(0,10485760)] uint32 num_values; + [size_is(num_values)] drsuapi_DsAttributeValueSecurityDescriptor *values[]; + } drsuapi_DsAttributeValueCtrSecurityDescriptor; + + /* NTTIME_1sec values */ + typedef struct { + [range(0,10485760)] uint32 length; + [subcontext(4)] NTTIME_1sec *time; + } drsuapi_DsAttributeValueNTTIME_1sec; + + typedef struct { + [range(0,10485760)] uint32 num_values; + [size_is(num_values)] drsuapi_DsAttributeValueNTTIME_1sec *values[]; + } drsuapi_DsAttributeValueCtrNTTIME_1sec; + + typedef [nodiscriminant] union { + [case(DRSUAPI_ATTRIBUTE_objectClass)] drsuapi_DsAttributeValueCtrObjectClassId object_class_id; + + /* UINT32 */ + [case(0x00020001)] drsuapi_DsAttributeValueCtrUINT32 uint32; + [case(0x00090177)] drsuapi_DsAttributeValueCtrUINT32 uint32; + [case(0x000905b3)] drsuapi_DsAttributeValueCtrUINT32 uint32; + + /* GUID */ + [case(DRSUAPI_ATTRIBUTE_invocationId)] drsuapi_DsAttributeValueCtrGUID guid; + + /* SID */ + [case(DRSUAPI_ATTRIBUTE_objectSid)] drsuapi_DsAttributeValueCtrSID sid; + + /* SecurityDescriptor */ + /* we can't parse some ads specific security_descriptors yet + [case(DRSUAPI_ATTRIBUTE_ntSecurityDescriptor)] drsuapi_DsAttributeValueCtrSecurityDescriptor security_descriptor; + */ + + /* UnicodeString */ + [case(DRSUAPI_ATTRIBUTE_description)] drsuapi_DsAttributeValueCtrUnicodeString unicode_string; + [case(0x00090001)] drsuapi_DsAttributeValueCtrUnicodeString unicode_string; + [case(0x0009037b)] drsuapi_DsAttributeValueCtrUnicodeString unicode_string; + + /* DN String */ + [case(DRSUAPI_ATTRIBUTE_objectCategory)] drsuapi_DsAttributeValueCtrDNString dn_string; + [case(0x0002000e)] drsuapi_DsAttributeValueCtrDNString dn_string; + [case(0x00020024)] drsuapi_DsAttributeValueCtrDNString dn_string; + [case(0x0009071c)] drsuapi_DsAttributeValueCtrDNString dn_string; + [case(0x0009072c)] drsuapi_DsAttributeValueCtrDNString dn_string; + [case(0x0009026a)] drsuapi_DsAttributeValueCtrDNString dn_string; + [case(0x00090203)] drsuapi_DsAttributeValueCtrDNString dn_string; + + /* NTTIME_1sec */ + [case(0x00020002)] drsuapi_DsAttributeValueCtrNTTIME_1sec nttime_1sec; + + /* the default is the DATA_BLOB */ + [default] drsuapi_DsAttributeValueCtrDataBlob data_blob; + } drsuapi_DsReplicaAttributeValueCtr; typedef [flag(NDR_PAHEX)] struct { drsuapi_DsAttributeId attid; - drsuapi_DsReplicaAttributeValueCtr value_ctr; + [switch_is(attid)] drsuapi_DsReplicaAttributeValueCtr value_ctr; } drsuapi_DsReplicaAttribute; typedef struct { @@ -294,6 +425,18 @@ interface drsuapi drsuapi_DsReplicaAttributeCtr attribute_ctr; } drsuapi_DsReplicaObject; + typedef struct { + uint32 version; + NTTIME_1sec time; + GUID guid; + hyper usn; + } drsuapi_DsReplicaMetaData; + + typedef [public] struct { + [range(0,1048576)] uint32 count; + [size_is(count)] drsuapi_DsReplicaMetaData meta_data[]; + } drsuapi_DsReplicaMetaDataCtr; + typedef [noprint] struct { drsuapi_DsReplicaObjectListItemEx *next_object; drsuapi_DsReplicaObject object; diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c index 57382289a2..c4dbe00958 100644 --- a/source4/torture/rpc/drsuapi.c +++ b/source4/torture/rpc/drsuapi.c @@ -907,7 +907,6 @@ static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("testing DsGetNCChanges level %d\n", array[i].level); - ZERO_STRUCT(r.in); r.in.bind_handle = &priv->bind_handle; r.in.level = array[i].level; @@ -915,20 +914,44 @@ static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, case 5: nc.guid = null_guid; nc.sid = null_sid; - nc.dn = talloc_asprintf(mem_ctx, "CN=Schema,CN=Configuration,%s", - priv->domain_obj_dn?priv->domain_obj_dn:""); nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:""; + r.in.req.req5.guid1 = null_guid; + r.in.req.req5.guid2 = null_guid; r.in.req.req5.naming_context = &nc; r.in.req.req5.usn1.usn1 = 0; + r.in.req.req5.usn1.usn2 = 0; + r.in.req.req5.usn1.usn3 = 0; + r.in.req.req5.coursor = NULL; + r.in.req.req5.unknown1 = 0;/*0x10201C70;*/ + r.in.req.req5.unknown2 = 0;/*402;*/ + r.in.req.req5.unknown3 = 0;/*402116;*/ + r.in.req.req5.unknown4 = 0; + r.in.req.req5.h1 = 0; + break; case 8: nc.guid = null_guid; nc.sid = null_sid; nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:""; + r.in.req.req8.guid1 = null_guid; + r.in.req.req8.guid2 = null_guid; r.in.req.req8.naming_context = &nc; r.in.req.req8.usn1.usn1 = 0; + r.in.req.req8.usn1.usn2 = 0; + r.in.req.req8.usn1.usn3 = 0; + r.in.req.req8.coursor = NULL; + r.in.req.req8.unknown1 = 0;/*0x10201C70;*/ + r.in.req.req8.unknown2 = 0;/*402;*/ + r.in.req.req8.unknown3 = 0;/*402116;*/ + r.in.req.req8.unknown4 = 0; + 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; + break; } -- cgit