1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00

s3:rpc_server: Register endpoint servers in external spoolssd daemon

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Samuel Cabrero 2019-02-26 13:51:23 +01:00 committed by Samuel Cabrero
parent 612c7fa341
commit 3692290e3b

View File

@ -29,11 +29,14 @@
#include "ntdomain.h"
#include "librpc/gen_ndr/srv_winreg.h"
#include "librpc/gen_ndr/srv_spoolss.h"
#include "librpc/gen_ndr/ndr_winreg_scompat.h"
#include "librpc/gen_ndr/ndr_spoolss_scompat.h"
#include "rpc_server/rpc_server.h"
#include "rpc_server/rpc_ep_register.h"
#include "rpc_server/rpc_config.h"
#include "rpc_server/spoolss/srv_spoolss_nt.h"
#include "librpc/rpc/dcerpc_ep.h"
#include "librpc/rpc/dcesrv_core.h"
#include "lib/server_prefork.h"
#include "lib/server_prefork_util.h"
@ -676,6 +679,7 @@ pid_t start_spoolssd(struct tevent_context *ev_ctx,
int listen_fds_size = 0;
int ret;
bool ok;
const struct dcesrv_endpoint_server *ep_server = NULL;
DEBUG(1, ("Forking SPOOLSS Daemon\n"));
@ -732,6 +736,35 @@ pid_t start_spoolssd(struct tevent_context *ev_ctx,
background_lpq_updater_pid = pid;
}
DBG_INFO("Registering DCE/RPC endpoint servers\n");
ep_server = winreg_get_ep_server();
if (ep_server == NULL) {
DBG_ERR("Failed to get 'winreg' endpoint server\n");
exit(1);
}
status = dcerpc_register_ep_server(ep_server);
if (!NT_STATUS_IS_OK(status) &&
!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
DBG_ERR("Failed to register 'winreg' endpoint server: %s\n",
nt_errstr(status));
exit(1);
}
ep_server = spoolss_get_ep_server();
if (ep_server == NULL) {
DBG_ERR("Failed to get 'spoolss' endpoint server\n");
exit(1);
}
status = dcerpc_register_ep_server(ep_server);
if (!NT_STATUS_IS_OK(status)) {
DBG_ERR("Failed to register 'spoolss' endpoint server: %s\n",
nt_errstr(status));
exit(1);
}
/* the listening fd must be created before the children are actually
* forked out. */
status = spoolssd_create_sockets(ev_ctx, msg_ctx, listen_fds,