>From 046e8535c69e9ade252a58d43adc64e4e423d4df Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Sun, 20 Oct 2013 13:37:17 -0700 Subject: [PATCH] librpc-idl: change the drsuapi_DsBindInfoCtr so that it match what is on the wire both in NDR32 and NDR64. Previous implementation had a problem with NDR64 with uint32 and uint3264 being in the wrong order Signed-off-by: Matthieu Patou --- librpc/idl/drsuapi.idl | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/librpc/idl/drsuapi.idl b/librpc/idl/drsuapi.idl index 063d135..7af182b 100644 --- a/librpc/idl/drsuapi.idl +++ b/librpc/idl/drsuapi.idl @@ -139,15 +139,10 @@ interface drsuapi GUID config_dn_guid; } drsuapi_DsBindInfo48; - typedef struct { - [flag(NDR_REMAINING)] DATA_BLOB info; - } drsuapi_DsBindInfoFallBack; - typedef [nodiscriminant] union { - [case(24)][subcontext(4)] drsuapi_DsBindInfo24 info24; - [case(28)][subcontext(4)] drsuapi_DsBindInfo28 info28; - [case(48)][subcontext(4)] drsuapi_DsBindInfo48 info48; - [default][subcontext(4)] drsuapi_DsBindInfoFallBack FallBack; + [case(24)][subcontext(0), subcontext_size(24)] drsuapi_DsBindInfo24 info24; + [case(28)][subcontext(0), subcontext_size(28)] drsuapi_DsBindInfo28 info28; + [case(48)][subcontext(0), subcontext_size(48)] drsuapi_DsBindInfo48 info48; } drsuapi_DsBindInfo; /* the drsuapi_DsBindInfoCtr was this before @@ -160,11 +155,44 @@ interface drsuapi * so we're doing it here */ + /* + * MS-DRSR.pdf gives the following definition + typedef struct { + [range(1,10000)] DWORD cb; + [size_is(cb)] BYTE rgb[]; + } DRS_EXTENSIONS; + + But we use a subcontext which has a slighly different signification on how + data are laid out. + With the MS-DRSR definition we will have + size_is_cb cv rgb_array + with size_is_cb being a uint3264 and cv being a uint32 + + We used to have typedef struct { [range(1,10000)] uint32 length; [switch_is(length)] drsuapi_DsBindInfo info; } drsuapi_DsBindInfoCtr; + typedef [nodiscriminant] union { + [case(24)][subcontext(4)] drsuapi_DsBindInfo24 info24; + [case(28)][subcontext(4)] drsuapi_DsBindInfo28 info28; + [case(48)][subcontext(4)] drsuapi_DsBindInfo48 info48; + [default][subcontext(4)] drsuapi_DsBindInfoFallBack FallBack; + } drsuapi_DsBindInfo; + + With this definition data is laid out this way: + length subcontext_size drsuapi_DsBindInfoxx + with length being a uint32 and subcontext_size being a uint3264 + + It has clearly an impact on the way things are aligned when using NDR64 + */ + typedef [flag(NDR_NOALIGN)] struct { + [range(1,10000)] uint3264 length; + [value(length)] uint32 __ndr_length; + [switch_is(length)] drsuapi_DsBindInfo info; + } drsuapi_DsBindInfoCtr; + /* this is a magic guid you need to pass to DsBind to make drsuapi_DsWriteAccountSpn() work * * maybe the bind_guid could also be the invocation_id see drsuapi_DsReplicaConnection04 -- 1.8.1.2