librpc: Use GUID_to_ndr_buf() in GUID_to_ndr_blob()
authorVolker Lendecke <vl@samba.org>
Tue, 29 Sep 2020 08:09:48 +0000 (10:09 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 2 Oct 2020 21:30:33 +0000 (21:30 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
librpc/ndr/uuid.c

index 4b5f180b86580642a062ec405ebaed53a4beda79..ad5c9d37d1139e4539f5e7674fb9b7bf74f007f7 100644 (file)
@@ -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;
 }