]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3-iremotewinspool: properly map incoming PAR to RPRN requests.
authorGünther Deschner <gd@samba.org>
Fri, 22 Sep 2023 22:29:51 +0000 (00:29 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 13 Oct 2023 02:18:31 +0000 (02:18 +0000)
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 <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/rpc_server/spoolss/srv_iremotewinspool.c

index 2fc7e74d5464cac71a2f33e4242ffaaf4971fefb..fb60dfef8224ceedf579547e5ec0d268d8d26d65 100644 (file)
@@ -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);
        }