s3:rpc_server: Init registered ep servers in external lsasd daemon
authorSamuel Cabrero <scabrero@suse.de>
Tue, 26 Feb 2019 16:57:58 +0000 (17:57 +0100)
committerSamuel Cabrero <scabrero@sn-devel-184>
Fri, 20 Mar 2020 15:36:33 +0000 (15:36 +0000)
Initialize and shutdown the endpoint servers registed by the lsasd
daemon. The pidl-generated init function will register the
api_struct for backward compatibility until completely removed.

The common server exit routine will shutdown all registered endpoint
servers, and the pidl-generated shutdown function will unregister the
api_struct.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/rpc_server/lsasd.c

index 3264385e7c25a507f954d814b724e5f7e012babc..b9f54d3b536edf3d5946693eb8c47d9a41227268 100644 (file)
@@ -270,27 +270,6 @@ static bool lsasd_child_init(struct tevent_context *ev_ctx,
                           MSG_PREFORK_PARENT_EVENT, parent_ping);
        id_cache_register_msgs(msg_ctx);
 
-       status = rpc_lsarpc_init(NULL);
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(0, ("Failed to register lsarpc rpc interface! (%s)\n",
-                         nt_errstr(status)));
-               return false;
-       }
-
-       status = rpc_samr_init(NULL);
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(0, ("Failed to register samr rpc interface! (%s)\n",
-                         nt_errstr(status)));
-               return false;
-       }
-
-       status = rpc_netlogon_init(NULL);
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(0, ("Failed to register netlogon rpc interface! (%s)\n",
-                         nt_errstr(status)));
-               return false;
-       }
-
        return true;
 }
 
@@ -847,6 +826,7 @@ void start_lsasd(struct tevent_context *ev_ctx,
        int rc;
        bool ok;
        const struct dcesrv_endpoint_server *ep_server = NULL;
+       const char *ep_servers[] = { "lsarpc", "samr", "netlogon", NULL };
 
        DEBUG(1, ("Forking LSA Service Daemon\n"));
 
@@ -946,6 +926,16 @@ void start_lsasd(struct tevent_context *ev_ctx,
                exit(1);
        }
 
+       DBG_INFO("Initializing DCE/RPC registered endpoint servers\n");
+
+       /* Init ep servers */
+       status = dcesrv_init_ep_servers(dce_ctx, ep_servers);
+       if (!NT_STATUS_IS_OK(status)) {
+               DBG_ERR("Failed to init DCE/RPC endpoint server: %s\n",
+                       nt_errstr(status));
+               exit(1);
+       }
+
        ok = lsasd_create_sockets(ev_ctx, msg_ctx, listen_fd, &listen_fd_size);
        if (!ok) {
                exit(1);
@@ -973,27 +963,6 @@ void start_lsasd(struct tevent_context *ev_ctx,
        messaging_register(msg_ctx, ev_ctx,
                           MSG_PREFORK_CHILD_EVENT, child_ping);
 
-       status = rpc_lsarpc_init(NULL);
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(0, ("Failed to register lsarpc rpc interface in lsasd! (%s)\n",
-                         nt_errstr(status)));
-               exit(1);
-       }
-
-       status = rpc_samr_init(NULL);
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(0, ("Failed to register samr rpc interface in lsasd! (%s)\n",
-                         nt_errstr(status)));
-               exit(1);
-       }
-
-       status = rpc_netlogon_init(NULL);
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(0, ("Failed to register netlogon rpc interface in lsasd! (%s)\n",
-                         nt_errstr(status)));
-               exit(1);
-       }
-
        ok = lsasd_setup_children_monitor(ev_ctx, msg_ctx);
        if (!ok) {
                DEBUG(0, ("Failed to setup children monitoring!\n"));