From e7a4c86878ac5968dba73d9156366754b1a7e791 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnther=20Deschner?= Date: Sat, 23 Sep 2023 00:29:51 +0200 Subject: [PATCH] s3-iremotewinspool: properly map incoming PAR to RPRN requests. Map the incoming iremotewinspool opnum to match the appropriate call in the spoolss server in the pull path. There is no 1:1 mapping in the opnums between the procols, only in the corresponding functions. Without doing the mapping we currently forward e.g. winspool_AsyncOpenPrinter() to spoolss_EnumPrinters() leading to all sorts of errors. A correct mapping was in place earlier with an handsorted server call table but it got removed with the rpc server rewrite. Guenther Signed-off-by: Guenther Deschner Reviewed-by: Andrew Bartlett --- source3/rpc_server/spoolss/srv_iremotewinspool.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source3/rpc_server/spoolss/srv_iremotewinspool.c b/source3/rpc_server/spoolss/srv_iremotewinspool.c index 2fc7e74d546..fb60dfef822 100644 --- a/source3/rpc_server/spoolss/srv_iremotewinspool.c +++ b/source3/rpc_server/spoolss/srv_iremotewinspool.c @@ -12,6 +12,7 @@ #include "librpc/gen_ndr/ndr_spoolss_scompat.h" #include "rpc_server/rpc_config.h" #include "rpc_server/rpc_server.h" +#include "rpc_server/spoolss/iremotewinspool_util.h" static bool forward_opnum_to_spoolss(uint16_t opnum) { switch (opnum) { @@ -53,10 +54,16 @@ NTSTATUS iremotewinspool__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC { enum ndr_err_code ndr_err; uint16_t opnum = dce_call->pkt.u.request.opnum; + uint16_t mapped_opnum; dce_call->fault_code = 0; if (forward_opnum_to_spoolss(opnum)) { + bool ok; + ok = iremotewinspool_map_opcode(opnum, &mapped_opnum); + if (ok) { + dce_call->pkt.u.request.opnum = mapped_opnum; + } return spoolss__op_ndr_pull(dce_call, mem_ctx, pull, r); } -- 2.47.3