From 4536f0ef914d12f6400122b7ab20291ffee56de0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 2 Jun 2005 00:18:06 +0000 Subject: r7181: add functions to calculate the buffer size needed for array buffer in the spoolss_Enum* functions they will be later used in the spoolss server code metze (This used to be commit 539fe32cedb73be0520675a1052cba476e4974d2) --- source4/librpc/ndr/ndr_spoolss_buf.c | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'source4/librpc/ndr') diff --git a/source4/librpc/ndr/ndr_spoolss_buf.c b/source4/librpc/ndr/ndr_spoolss_buf.c index 2ea9f95d45..3e966176c3 100644 --- a/source4/librpc/ndr/ndr_spoolss_buf.c +++ b/source4/librpc/ndr/ndr_spoolss_buf.c @@ -111,6 +111,25 @@ }\ } while(0) +#define _NDR_CHECK_UINT32(call) do { NTSTATUS _status; \ + _status = call; \ + if (!NT_STATUS_IS_OK(_status)) \ + return 0; \ + } while (0) + +#define NDR_SPOOLSS_SIZE_ENUM(fn) do { \ + struct __##fn __r;\ + DATA_BLOB _data_blob_info;\ + struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx);\ + if (!_ndr_info) return 0;\ + __r.in.level = level;\ + __r.in.count = count;\ + __r.out.info = info;\ + _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \ + _data_blob_info = ndr_push_blob(_ndr_info);\ + return _data_blob_info.length;\ +} while(0) + /* spoolss_EnumPrinters */ @@ -138,6 +157,11 @@ NTSTATUS ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, struct s return NT_STATUS_OK; } +uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_PrinterInfo *info) +{ + NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinters); +} + /* spoolss_EnumJobs */ @@ -169,6 +193,11 @@ NTSTATUS ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, struct spool return NT_STATUS_OK; } +uint32_t ndr_size_spoolss_EnumJobss_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_JobInfo *info) +{ + NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumJobs); +} + /* spoolss_EnumPrinterDrivers */ @@ -196,6 +225,11 @@ NTSTATUS ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int flags, st return NT_STATUS_OK; } +uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_DriverInfo *info) +{ + NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDrivers); +} + /* spoolss_EnumForms */ @@ -219,6 +253,11 @@ NTSTATUS ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, struct spoo return NT_STATUS_OK; } +uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_FormInfo *info) +{ + NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumForms); +} + /* spoolss_EnumPorts */ @@ -242,6 +281,11 @@ NTSTATUS ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, struct spoo return NT_STATUS_OK; } +uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_PortInfo *info) +{ + NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPorts); +} + /* spoolss_EnumMonitors */ @@ -265,6 +309,11 @@ NTSTATUS ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct s return NT_STATUS_OK; } +uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_MonitorInfo *info) +{ + NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumMonitors); +} + /* spoolss_EnumPrintProcessors */ @@ -291,3 +340,8 @@ NTSTATUS ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, s }); return NT_STATUS_OK; } + +uint32_t ndr_size_spoolss_EnumPrinterProcessors_info(TALLOC_CTX *mem_ctx, uint32_t level, uint32_t count, union spoolss_PrintProcessorInfo *info) +{ + NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrintProcessors); +} -- cgit