diff options
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 67ee91e108..b46591be8b 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -8854,8 +8854,6 @@ static WERROR fill_printprocdatatype1(TALLOC_CTX *mem_ctx, static WERROR enumprintprocdatatypes_level_1(TALLOC_CTX *mem_ctx, union spoolss_PrintProcDataTypesInfo **info_p, - uint32_t offered, - uint32_t *needed, uint32_t *count) { WERROR result; @@ -8871,13 +8869,6 @@ static WERROR enumprintprocdatatypes_level_1(TALLOC_CTX *mem_ctx, goto out; } - *needed += ndr_size_spoolss_PrintProcDataTypesInfo1(&info[0].info1, NULL, 0); - - if (*needed > offered) { - result = WERR_INSUFFICIENT_BUFFER; - goto out; - } - out: if (!W_ERROR_IS_OK(result)) { TALLOC_FREE(info); @@ -8897,6 +8888,8 @@ static WERROR enumprintprocdatatypes_level_1(TALLOC_CTX *mem_ctx, WERROR _spoolss_EnumPrintProcDataTypes(pipes_struct *p, struct spoolss_EnumPrintProcDataTypes *r) { + WERROR result; + /* that's an [in out] buffer */ if (!r->in.buffer && (r->in.offered != 0)) { @@ -8911,12 +8904,21 @@ WERROR _spoolss_EnumPrintProcDataTypes(pipes_struct *p, switch (r->in.level) { case 1: - return enumprintprocdatatypes_level_1(p->mem_ctx, r->out.info, - r->in.offered, r->out.needed, - r->out.count); + result = enumprintprocdatatypes_level_1(p->mem_ctx, r->out.info, + r->out.count); + break; default: return WERR_UNKNOWN_LEVEL; } + + *r->out.needed = SPOOLSS_BUFFER_UNION_ARRAY(p->mem_ctx, + spoolss_EnumPrintProcDataTypes, 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); } /**************************************************************************** |