From 54a703d433cc586504bbdf445a03e3c3e0b4fe50 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 23 Aug 2005 09:28:37 +0000 Subject: r9509: start to fix the pushing of drsuapi_DsAttributeValueDNString structs, this uses a trick with talloc_get_type() to workaround using [value()] vars in [subcontext_size()] metze (This used to be commit 93065f2d3439bceeaa7c2a09679cc6d81472150d) --- source4/include/structs.h | 5 +++-- source4/librpc/idl/drsuapi.idl | 8 ++++---- source4/librpc/ndr/ndr_drsuapi.c | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/source4/include/structs.h b/source4/include/structs.h index 5c6ef29774..eec211cec3 100644 --- a/source4/include/structs.h +++ b/source4/include/structs.h @@ -77,8 +77,11 @@ struct spoolss_DeviceMode; struct ntptr_context; struct ntptr_GenericHandle; +struct drsuapi_DsCrackNames; struct drsuapi_DsReplicaObjectListItem; struct drsuapi_DsReplicaObjectListItemEx; +struct drsuapi_DsAttributeValueDNString; +struct drsuapi_DsReplicaObjectIdentifier3; struct MULTI_QI; struct COSERVERINFO; @@ -87,8 +90,6 @@ struct COSERVERINFO; struct epm_floor; struct epm_tower; -struct drsuapi_DsCrackNames; - struct PAC_BUFFER; struct PAC_DATA; diff --git a/source4/librpc/idl/drsuapi.idl b/source4/librpc/idl/drsuapi.idl index a9ecd30cb5..10170bc282 100644 --- a/source4/librpc/idl/drsuapi.idl +++ b/source4/librpc/idl/drsuapi.idl @@ -428,16 +428,16 @@ interface drsuapi /* DN String values */ typedef [gensize] struct { - [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3(r, ndr->flags)-4)] uint32 __ndr_size; + [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3(r, ndr->flags))] uint32 __ndr_size; [value(ndr_length_dom_sid(&r->sid))] uint32 __ndr_size_sid; GUID guid; dom_sid28 sid; [flag(STR_SIZE4|STR_CHARLEN)] string dn; } drsuapi_DsReplicaObjectIdentifier3; - typedef struct { - [range(0,10485760)] uint32 length; - [subcontext(4)] drsuapi_DsReplicaObjectIdentifier3 *object; + typedef struct { + [range(0,10485760),value(_ndr_size_drsuapi_DsReplicaObjectIdentifier3(ndr, r, object, ndr->flags))] uint32 __ndr_size; + [subcontext(4),subcontext_size(_ndr_size_drsuapi_DsReplicaObjectIdentifier3(ndr, r, object, ndr->flags))] drsuapi_DsReplicaObjectIdentifier3 *object; } drsuapi_DsAttributeValueDNString; typedef struct { diff --git a/source4/librpc/ndr/ndr_drsuapi.c b/source4/librpc/ndr/ndr_drsuapi.c index 6f6dd74ea4..f220966b9d 100644 --- a/source4/librpc/ndr/ndr_drsuapi.c +++ b/source4/librpc/ndr/ndr_drsuapi.c @@ -61,3 +61,18 @@ void ndr_print_drsuapi_DsReplicaObjectListItemEx(struct ndr_print *ndr, const ch ndr_print_drsuapi_DsReplicaObjectListItemEx(ndr, "next_object", r->next_object); } } + +uint32_t _ndr_size_drsuapi_DsReplicaObjectIdentifier3(const void *ndr, + const struct drsuapi_DsAttributeValueDNString *dn, + const struct drsuapi_DsReplicaObjectIdentifier3 *id, + uint32_t flags) +{ + if (talloc_get_type(ndr, struct ndr_pull)) { + return dn->__ndr_size; + } else if (talloc_get_type(ndr, struct ndr_push)) { + return ndr_size_drsuapi_DsReplicaObjectIdentifier3(id, flags) + 2; + } else if (talloc_get_type(ndr, struct ndr_print)) { + return ndr_size_drsuapi_DsReplicaObjectIdentifier3(id, flags) + 2; + } + return 0; +} -- cgit