From 463dcc909417f91a576b12b96adfc16e18ffc9a0 Mon Sep 17 00:00:00 2001 From: Garming Sam Date: Mon, 16 Apr 2018 14:53:18 +1200 Subject: [PATCH] preg: Unpack winreg_Data for parsing It seems that there might be pre-existing endianness issues which would be fixed by the ndr_push. Signed-off-by: Garming Sam Reviewed-by: Andrew Bartlett --- librpc/idl/preg.idl | 2 +- source3/libgpo/gpext/registry.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/librpc/idl/preg.idl b/librpc/idl/preg.idl index f14cea9fe2e..fc28bb65ebd 100644 --- a/librpc/idl/preg.idl +++ b/librpc/idl/preg.idl @@ -27,7 +27,7 @@ import "misc.idl"; [charset(DOS),value(";"),noprint] uint8 _sep3[2]; uint32 size; [charset(DOS),value(";"),noprint] uint8 _sep4[2]; - uint8 data[size]; + [subcontext(0),subcontext_size(size),flag(NDR_REMAINING), switch_is(type)] winreg_Data data; [charset(DOS),value("]"),noprint] uint8 _closing_bracket[2]; } preg_entry; diff --git a/source3/libgpo/gpext/registry.c b/source3/libgpo/gpext/registry.c index ceb05f030b6..5d51bdff6e9 100644 --- a/source3/libgpo/gpext/registry.c +++ b/source3/libgpo/gpext/registry.c @@ -119,7 +119,9 @@ static bool gp_reg_entry_from_file_entry(TALLOC_CTX *mem_ctx, return false; data->type = r->type; - data->data = data_blob_talloc(data, r->data, r->size); + + ndr_push_union_blob(&data->data, mem_ctx, &r->data, r->type, + (ndr_push_flags_fn_t)ndr_push_winreg_Data); entry = talloc_zero(mem_ctx, struct gp_registry_entry); if (!entry)