From 29e3c0cdb787d8316287413c09d4584dda87b621 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 29 Sep 2020 10:09:48 +0200 Subject: [PATCH] librpc: Use GUID_to_ndr_buf() in GUID_to_ndr_blob() Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- librpc/ndr/uuid.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/librpc/ndr/uuid.c b/librpc/ndr/uuid.c index 4b5f180b865..ad5c9d37d11 100644 --- a/librpc/ndr/uuid.c +++ b/librpc/ndr/uuid.c @@ -44,14 +44,19 @@ _PUBLIC_ NTSTATUS GUID_to_ndr_buf( */ _PUBLIC_ NTSTATUS GUID_to_ndr_blob(const struct GUID *guid, TALLOC_CTX *mem_ctx, DATA_BLOB *b) { - enum ndr_err_code ndr_err; - *b = data_blob_talloc(mem_ctx, NULL, 16); + struct GUID_ndr_buf buf = { .buf = {0}, }; + NTSTATUS status; + + status = GUID_to_ndr_buf(guid, &buf); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + *b = data_blob_talloc(mem_ctx, buf.buf, sizeof(buf.buf)); if (b->data == NULL) { return NT_STATUS_NO_MEMORY; } - ndr_err = ndr_push_struct_into_fixed_blob( - b, guid, (ndr_push_flags_fn_t)ndr_push_GUID); - return ndr_map_error2ntstatus(ndr_err); + return NT_STATUS_OK; }