summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-03-11 01:38:20 +0100
committerGünther Deschner <gd@samba.org>2009-03-13 09:25:19 +0100
commitfacf66b40c6f8919bd78613990959a4f45a5738c (patch)
tree6229aad1732a177704af4cb23a9a0a17ad9b8524
parent84b38c859899d1bffcabdd7cb846c6fe59ad5d3f (diff)
downloadsamba-facf66b40c6f8919bd78613990959a4f45a5738c.tar.gz
samba-facf66b40c6f8919bd78613990959a4f45a5738c.tar.bz2
samba-facf66b40c6f8919bd78613990959a4f45a5738c.zip
s3-spoolss: use macros for _spoolss_EnumPrintProcessors.
Guenther
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index b10eb71cc2..8c6de1f264 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -8767,8 +8767,6 @@ static WERROR fill_print_processor1(TALLOC_CTX *mem_ctx,
static WERROR enumprintprocessors_level_1(TALLOC_CTX *mem_ctx,
union spoolss_PrintProcessorInfo **info_p,
- uint32_t offered,
- uint32_t *needed,
uint32_t *count)
{
union spoolss_PrintProcessorInfo *info;
@@ -8784,13 +8782,6 @@ static WERROR enumprintprocessors_level_1(TALLOC_CTX *mem_ctx,
goto out;
}
- *needed += ndr_size_spoolss_PrintProcessorInfo1(&info[0].info1, NULL, 0);
-
- if (*needed > offered) {
- result = WERR_INSUFFICIENT_BUFFER;
- goto out;
- }
-
out:
if (!W_ERROR_IS_OK(result)) {
TALLOC_FREE(info);
@@ -8810,6 +8801,8 @@ static WERROR enumprintprocessors_level_1(TALLOC_CTX *mem_ctx,
WERROR _spoolss_EnumPrintProcessors(pipes_struct *p,
struct spoolss_EnumPrintProcessors *r)
{
+ WERROR result;
+
/* that's an [in out] buffer */
if (!r->in.buffer && (r->in.offered != 0)) {
@@ -8831,12 +8824,25 @@ WERROR _spoolss_EnumPrintProcessors(pipes_struct *p,
switch (r->in.level) {
case 1:
- return enumprintprocessors_level_1(p->mem_ctx, r->out.info,
- r->in.offered, r->out.needed,
- r->out.count);
+ result = enumprintprocessors_level_1(p->mem_ctx, r->out.info,
+ r->out.count);
+ break;
default:
return WERR_UNKNOWN_LEVEL;
}
+
+ if (!W_ERROR_IS_OK(result)) {
+ return result;
+ }
+
+ *r->out.needed = SPOOLSS_BUFFER_UNION_ARRAY(p->mem_ctx,
+ spoolss_EnumPrintProcessors, NULL,
+ *r->out.info, r->in.level,
+ *r->out.count);
+ *r->out.info = SPOOLSS_BUFFER_OK(*r->out.info, NULL);
+ *r->out.count = SPOOLSS_BUFFER_OK(*r->out.count, 0);
+
+ return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER);
}
/****************************************************************************