s3-iremotewinspool: start iremotewinspool server by default.
authorGünther Deschner <gd@samba.org>
Tue, 20 Sep 2016 18:23:40 +0000 (20:23 +0200)
committerGünther Deschner <gd@samba.org>
Wed, 30 Oct 2019 13:39:53 +0000 (14:39 +0100)
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
source3/printing/spoolssd.c
source3/rpc_server/rpc_service_setup.c
source3/rpc_server/wscript_build

index 427e31e0122ca8dde157caf5f56002ff7ea7f745..5fc93f1abd03ff40c07941a2a3d7627cefd8f383 100644 (file)
@@ -29,6 +29,7 @@
 #include "ntdomain.h"
 #include "librpc/gen_ndr/srv_winreg.h"
 #include "librpc/gen_ndr/srv_spoolss.h"
+#include "librpc/gen_ndr/srv_winspool.h"
 #include "rpc_server/rpc_server.h"
 #include "rpc_server/rpc_ep_register.h"
 #include "rpc_server/rpc_config.h"
@@ -36,6 +37,7 @@
 #include "librpc/rpc/dcerpc_ep.h"
 #include "lib/server_prefork.h"
 #include "lib/server_prefork_util.h"
+#include "rpc_server/rpc_sock_helper.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_RPC_SRV
@@ -310,6 +312,13 @@ static bool spoolss_child_init(struct tevent_context *ev_ctx,
                return false;
        }
 
+       status = rpc_iremotewinspool_init(NULL);
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0, ("Failed to register iremotewinspool rpc interface! (%s)\n",
+                         nt_errstr(status)));
+               return false;
+       }
+
        return true;
 }
 
@@ -643,13 +652,26 @@ static NTSTATUS spoolssd_create_sockets(struct tevent_context *ev_ctx,
                                nt_errstr(status));
                        goto done;
                }
+       }
 
-               status = rpc_ep_register(ev_ctx, msg_ctx, &ndr_table_spoolss, v);
-               if (!NT_STATUS_IS_OK(status)) {
-                       DBG_ERR("Failed to register spoolss endpoint! (%s)\n",
-                               nt_errstr(status));
-                       goto done;
-               }
+       status = dcesrv_setup_ncacn_ip_tcp_sockets(ev_ctx,
+                                                  msg_ctx,
+                                                  &ndr_table_iremotewinspool,
+                                                  v,
+                                                  0);
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0, ("Failed to open iremotewinspool tcpip sockets!\n"));
+               goto done;
+       }
+
+       status = rpc_ep_register(ev_ctx,
+                                msg_ctx,
+                                &ndr_table_iremotewinspool,
+                                v);
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0, ("Failed to register with endpoint mapper! Error was: %s\n",
+                       nt_errstr(status)));
+               goto done;
        }
 
        status = NT_STATUS_OK;
@@ -791,6 +813,13 @@ pid_t start_spoolssd(struct tevent_context *ev_ctx,
                exit(1);
        }
 
+       status = rpc_iremotewinspool_init(NULL);
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0, ("Failed to register iremotewinspool rpc interface! (%s)\n",
+                         nt_errstr(status)));
+               exit(1);
+       }
+
        ok = spoolssd_setup_children_monitor(ev_ctx, msg_ctx);
        if (!ok) {
                DEBUG(0, ("Failed to setup children monitoring!\n"));
index 4011ebe88233e42d1da4a8604eedb0354592ee66..2812a83a6c51c2521bf90b4dff6100ccb248e54b 100644 (file)
@@ -36,6 +36,7 @@
 #include "../librpc/gen_ndr/srv_ntsvcs.h"
 #include "../librpc/gen_ndr/srv_samr.h"
 #include "../librpc/gen_ndr/srv_spoolss.h"
+#include "../librpc/gen_ndr/srv_winspool.h"
 #include "../librpc/gen_ndr/srv_svcctl.h"
 #include "../librpc/gen_ndr/srv_wkssvc.h"
 
@@ -391,6 +392,28 @@ static NTSTATUS rpc_setup_spoolss(struct tevent_context *ev_ctx,
        return NT_STATUS_OK;
 }
 
+static NTSTATUS rpc_setup_iremotewinspool(struct tevent_context *ev_ctx,
+                                         struct messaging_context *msg_ctx)
+{
+       enum rpc_daemon_type_e spoolss_type = rpc_spoolss_daemon();
+       NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+
+       if (lp__disable_spoolss()) {
+               return NT_STATUS_OK;
+       }
+
+       if (spoolss_type != RPC_DAEMON_EMBEDDED) {
+               return NT_STATUS_OK;
+       }
+
+       status = rpc_iremotewinspool_init(NULL);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;;
+       }
+
+       return NT_STATUS_OK;
+}
+
 static bool svcctl_init_cb(void *ptr)
 {
        struct messaging_context *msg_ctx =
@@ -601,6 +624,11 @@ NTSTATUS dcesrv_ep_setup(struct tevent_context *ev_ctx,
                goto done;
        }
 
+       status = rpc_setup_iremotewinspool(ev_ctx, msg_ctx);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto done;
+       }
+
        status = rpc_setup_svcctl(ev_ctx, msg_ctx);
        if (!NT_STATUS_IS_OK(status)) {
                goto done;
index 870eb3d39d60195e390960e4c2926f58f41a7531..090f821874a7cdc3848ad6f1388b8c688400df60 100644 (file)
@@ -212,6 +212,7 @@ bld.SAMBA3_SUBSYSTEM('RPC_SERVICE',
                     RPC_SERVER
                     RPC_EPMAPPER
                    RPC_FSS_AGENT
+                    RPC_SOCK_HELPER
                     ''')
 
 # RPC_DAEMONS