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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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:
#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) \
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"
#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
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"