mirror of
https://github.com/samba-team/samba.git
synced 2025-02-26 21:57:41 +03:00
s3:rpc_server: Init registered endpoint servers for embedded services
Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
7eab9f8850
commit
36c2abbc16
@ -33,6 +33,11 @@
|
||||
#include "auth.h"
|
||||
#include "util_tdb.h"
|
||||
|
||||
#include "rpc_server/rpc_server.h"
|
||||
#include "librpc/rpc/dcesrv_core.h"
|
||||
#include "librpc/gen_ndr/ndr_eventlog_scompat.h"
|
||||
#include "rpc_server/eventlog/srv_eventlog_reg.h"
|
||||
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_RPC_SRV
|
||||
|
||||
@ -947,5 +952,31 @@ NTSTATUS _eventlog_ReportEventAndSourceW(struct pipes_struct *p,
|
||||
return NT_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static NTSTATUS eventlog__op_init_server(struct dcesrv_context *dce_ctx,
|
||||
const struct dcesrv_endpoint_server *ep_server);
|
||||
|
||||
#define DCESRV_INTERFACE_EVENTLOG_INIT_SERVER \
|
||||
eventlog_init_server
|
||||
|
||||
static NTSTATUS eventlog_init_server(struct dcesrv_context *dce_ctx,
|
||||
const struct dcesrv_endpoint_server *ep_server)
|
||||
{
|
||||
struct messaging_context *msg_ctx = global_messaging_context();
|
||||
NTSTATUS status;
|
||||
bool ok;
|
||||
|
||||
status = dcesrv_init_ep_server(dce_ctx, "winreg");
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
ok = eventlog_init_winreg(msg_ctx);
|
||||
if (!ok) {
|
||||
return NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
return eventlog__op_init_server(dce_ctx, ep_server);
|
||||
}
|
||||
|
||||
/* include the generated boilerplate */
|
||||
#include "librpc/gen_ndr/ndr_eventlog_scompat.c"
|
||||
|
@ -143,11 +143,6 @@ static NTSTATUS rpc_setup_winreg(struct tevent_context *ev_ctx,
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_winreg_init(NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_setup_embedded(ev_ctx, msg_ctx, t, pipe_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -184,11 +179,6 @@ static NTSTATUS rpc_setup_srvsvc(struct tevent_context *ev_ctx,
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_srvsvc_init(NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_setup_embedded(ev_ctx, msg_ctx, t, pipe_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -227,11 +217,6 @@ static NTSTATUS rpc_setup_lsarpc(struct tevent_context *ev_ctx,
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_lsarpc_init(NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_setup_embedded(ev_ctx, msg_ctx, t, pipe_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -270,11 +255,6 @@ static NTSTATUS rpc_setup_samr(struct tevent_context *ev_ctx,
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_samr_init(NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_setup_embedded(ev_ctx, msg_ctx, t, pipe_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -313,11 +293,6 @@ static NTSTATUS rpc_setup_netlogon(struct tevent_context *ev_ctx,
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_netlogon_init(NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_setup_embedded(ev_ctx, msg_ctx, t, pipe_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -354,11 +329,6 @@ static NTSTATUS rpc_setup_netdfs(struct tevent_context *ev_ctx,
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_netdfs_init(NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_setup_embedded(ev_ctx, msg_ctx, t, pipe_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -396,11 +366,6 @@ static NTSTATUS rpc_setup_rpcecho(struct tevent_context *ev_ctx,
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_rpcecho_init(NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_setup_embedded(ev_ctx, msg_ctx, t, pipe_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -438,11 +403,6 @@ static NTSTATUS rpc_setup_dssetup(struct tevent_context *ev_ctx,
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_dssetup_init(NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_setup_embedded(ev_ctx, msg_ctx, t, pipe_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -479,11 +439,6 @@ static NTSTATUS rpc_setup_wkssvc(struct tevent_context *ev_ctx,
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_wkssvc_init(NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_setup_embedded(ev_ctx, msg_ctx, t, pipe_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -492,35 +447,10 @@ static NTSTATUS rpc_setup_wkssvc(struct tevent_context *ev_ctx,
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
static bool spoolss_init_cb(void *ptr)
|
||||
{
|
||||
struct messaging_context *msg_ctx =
|
||||
talloc_get_type_abort(ptr, struct messaging_context);
|
||||
bool ok;
|
||||
|
||||
/*
|
||||
* Migrate the printers first.
|
||||
*/
|
||||
ok = nt_printing_tdb_migrate(msg_ctx);
|
||||
if (!ok) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool spoolss_shutdown_cb(void *ptr)
|
||||
{
|
||||
srv_spoolss_cleanup();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static NTSTATUS rpc_setup_spoolss(struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx)
|
||||
{
|
||||
const struct ndr_interface_table *t = &ndr_table_spoolss;
|
||||
struct rpc_srv_callbacks spoolss_cb;
|
||||
enum rpc_daemon_type_e spoolss_type = rpc_spoolss_daemon();
|
||||
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
|
||||
enum rpc_service_mode_e service_mode;
|
||||
@ -550,15 +480,6 @@ static NTSTATUS rpc_setup_spoolss(struct tevent_context *ev_ctx,
|
||||
return status;
|
||||
}
|
||||
|
||||
spoolss_cb.init = spoolss_init_cb;
|
||||
spoolss_cb.shutdown = spoolss_shutdown_cb;
|
||||
spoolss_cb.private_data = msg_ctx;
|
||||
|
||||
status = rpc_spoolss_init(&spoolss_cb);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;;
|
||||
}
|
||||
|
||||
status = rpc_setup_embedded(ev_ctx, msg_ctx, t, NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -567,36 +488,11 @@ static NTSTATUS rpc_setup_spoolss(struct tevent_context *ev_ctx,
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
static bool svcctl_init_cb(void *ptr)
|
||||
{
|
||||
struct messaging_context *msg_ctx =
|
||||
talloc_get_type_abort(ptr, struct messaging_context);
|
||||
bool ok;
|
||||
|
||||
/* initialize the control hooks */
|
||||
init_service_op_table();
|
||||
|
||||
ok = svcctl_init_winreg(msg_ctx);
|
||||
if (!ok) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool svcctl_shutdown_cb(void *ptr)
|
||||
{
|
||||
shutdown_service_op_table();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static NTSTATUS rpc_setup_svcctl(struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx)
|
||||
{
|
||||
const struct ndr_interface_table *t = &ndr_table_svcctl;
|
||||
const char *pipe_name = "svcctl";
|
||||
struct rpc_srv_callbacks svcctl_cb;
|
||||
NTSTATUS status;
|
||||
enum rpc_service_mode_e service_mode;
|
||||
const struct dcesrv_endpoint_server *ep_server = NULL;
|
||||
@ -620,15 +516,6 @@ static NTSTATUS rpc_setup_svcctl(struct tevent_context *ev_ctx,
|
||||
return status;
|
||||
}
|
||||
|
||||
svcctl_cb.init = svcctl_init_cb;
|
||||
svcctl_cb.shutdown = svcctl_shutdown_cb;
|
||||
svcctl_cb.private_data = msg_ctx;
|
||||
|
||||
status = rpc_svcctl_init(&svcctl_cb);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_setup_embedded(ev_ctx, msg_ctx, t, pipe_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -664,11 +551,6 @@ static NTSTATUS rpc_setup_ntsvcs(struct tevent_context *ev_ctx,
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_ntsvcs_init(NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_setup_embedded(ev_ctx, msg_ctx, t, NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -677,25 +559,10 @@ static NTSTATUS rpc_setup_ntsvcs(struct tevent_context *ev_ctx,
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
static bool eventlog_init_cb(void *ptr)
|
||||
{
|
||||
struct messaging_context *msg_ctx =
|
||||
talloc_get_type_abort(ptr, struct messaging_context);
|
||||
bool ok;
|
||||
|
||||
ok = eventlog_init_winreg(msg_ctx);
|
||||
if (!ok) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static NTSTATUS rpc_setup_eventlog(struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx)
|
||||
{
|
||||
const struct ndr_interface_table *t = &ndr_table_eventlog;
|
||||
struct rpc_srv_callbacks eventlog_cb;
|
||||
NTSTATUS status;
|
||||
enum rpc_service_mode_e service_mode;
|
||||
const struct dcesrv_endpoint_server *ep_server = NULL;
|
||||
@ -719,15 +586,6 @@ static NTSTATUS rpc_setup_eventlog(struct tevent_context *ev_ctx,
|
||||
return status;
|
||||
}
|
||||
|
||||
eventlog_cb.init = eventlog_init_cb;
|
||||
eventlog_cb.shutdown = NULL;
|
||||
eventlog_cb.private_data = msg_ctx;
|
||||
|
||||
status = rpc_eventlog_init(&eventlog_cb);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_setup_embedded(ev_ctx, msg_ctx, t, NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -763,11 +621,6 @@ static NTSTATUS rpc_setup_initshutdown(struct tevent_context *ev_ctx,
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_initshutdown_init(NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = rpc_setup_embedded(ev_ctx, msg_ctx, t, NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
@ -899,7 +752,14 @@ NTSTATUS dcesrv_init(TALLOC_CTX *mem_ctx,
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* TODO Initialize endpoints for registered endpoint servers */
|
||||
DBG_INFO("Initializing DCE/RPC registered endpoint servers\n");
|
||||
|
||||
status = dcesrv_init_registered_ep_servers(dce_ctx);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DBG_ERR("Failed to init DCE/RPC endpoint servers: %s\n",
|
||||
nt_errstr(status));
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = NT_STATUS_OK;
|
||||
done:
|
||||
|
@ -59,6 +59,9 @@
|
||||
#include "../libcli/smb/smbXcli_base.h"
|
||||
#include "rpc_server/spoolss/srv_spoolss_handle.h"
|
||||
#include "lib/gencache.h"
|
||||
#include "rpc_server/rpc_server.h"
|
||||
#include "librpc/rpc/dcesrv_core.h"
|
||||
#include "printing/nt_printing_migrate_internal.h"
|
||||
|
||||
/* macros stolen from s4 spoolss server */
|
||||
#define SPOOLSS_BUFFER_UNION(fn,info,level) \
|
||||
@ -11519,5 +11522,48 @@ WERROR _spoolss_LogJobInfoForBranchOffice(struct pipes_struct *p,
|
||||
return WERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static NTSTATUS spoolss__op_init_server(struct dcesrv_context *dce_ctx,
|
||||
const struct dcesrv_endpoint_server *ep_server);
|
||||
|
||||
static NTSTATUS spoolss__op_shutdown_server(struct dcesrv_context *dce_ctx,
|
||||
const struct dcesrv_endpoint_server *ep_server);
|
||||
|
||||
#define DCESRV_INTERFACE_SPOOLSS_INIT_SERVER \
|
||||
spoolss_init_server
|
||||
|
||||
#define DCESRV_INTERFACE_SPOOLSS_SHUTDOWN_SERVER \
|
||||
spoolss_shutdown_server
|
||||
|
||||
static NTSTATUS spoolss_init_server(struct dcesrv_context *dce_ctx,
|
||||
const struct dcesrv_endpoint_server *ep_server)
|
||||
{
|
||||
struct messaging_context *msg_ctx = global_messaging_context();
|
||||
NTSTATUS status;
|
||||
bool ok;
|
||||
|
||||
status = dcesrv_init_ep_server(dce_ctx, "winreg");
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Migrate the printers first.
|
||||
*/
|
||||
ok = nt_printing_tdb_migrate(msg_ctx);
|
||||
if (!ok) {
|
||||
return NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
return spoolss__op_init_server(dce_ctx, ep_server);
|
||||
}
|
||||
|
||||
static NTSTATUS spoolss_shutdown_server(struct dcesrv_context *dce_ctx,
|
||||
const struct dcesrv_endpoint_server *ep_server)
|
||||
{
|
||||
srv_spoolss_cleanup();
|
||||
|
||||
return spoolss__op_shutdown_server(dce_ctx, ep_server);
|
||||
}
|
||||
|
||||
/* include the generated boilerplate */
|
||||
#include "librpc/gen_ndr/ndr_spoolss_scompat.c"
|
||||
|
@ -33,6 +33,11 @@
|
||||
#include "auth.h"
|
||||
#include "rpc_server/svcctl/srv_svcctl_nt.h"
|
||||
|
||||
#include "rpc_server/rpc_server.h"
|
||||
#include "librpc/rpc/dcesrv_core.h"
|
||||
#include "librpc/gen_ndr/ndr_svcctl_scompat.h"
|
||||
#include "srv_svcctl_reg.h"
|
||||
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_RPC_SRV
|
||||
|
||||
@ -1216,5 +1221,48 @@ WERROR _svcctl_SCSendTSMessage(struct pipes_struct *p,
|
||||
return WERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static NTSTATUS svcctl__op_init_server(struct dcesrv_context *dce_ctx,
|
||||
const struct dcesrv_endpoint_server *ep_server);
|
||||
|
||||
static NTSTATUS svcctl__op_shutdown_server(struct dcesrv_context *dce_ctx,
|
||||
const struct dcesrv_endpoint_server *ep_server);
|
||||
|
||||
#define DCESRV_INTERFACE_SVCCTL_INIT_SERVER \
|
||||
svcctl_init_server
|
||||
|
||||
#define DCESRV_INTERFACE_SVCCTL_SHUTDOWN_SERVER \
|
||||
svcctl_shutdown_server
|
||||
|
||||
static NTSTATUS svcctl_init_server(struct dcesrv_context *dce_ctx,
|
||||
const struct dcesrv_endpoint_server *ep_server)
|
||||
{
|
||||
struct messaging_context *msg_ctx = global_messaging_context();
|
||||
NTSTATUS status;
|
||||
bool ok;
|
||||
|
||||
status = dcesrv_init_ep_server(dce_ctx, "winreg");
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* initialize the control hooks */
|
||||
init_service_op_table();
|
||||
|
||||
ok = svcctl_init_winreg(msg_ctx);
|
||||
if (!ok) {
|
||||
return NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
return svcctl__op_init_server(dce_ctx, ep_server);
|
||||
}
|
||||
|
||||
static NTSTATUS svcctl_shutdown_server(struct dcesrv_context *dce_ctx,
|
||||
const struct dcesrv_endpoint_server *ep_server)
|
||||
{
|
||||
shutdown_service_op_table();
|
||||
|
||||
return svcctl__op_shutdown_server(dce_ctx, ep_server);
|
||||
}
|
||||
|
||||
/* include the generated boilerplate */
|
||||
#include "librpc/gen_ndr/ndr_svcctl_scompat.c"
|
||||
|
Loading…
x
Reference in New Issue
Block a user