diff options
author | Andreas Schneider <asn@samba.org> | 2011-06-06 11:10:02 +0200 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2011-08-01 08:50:34 +0200 |
commit | e25b34ab0c565cb702b278d22552828e6ba090a5 (patch) | |
tree | ace28d632e3a8de67f82d801e9527daa9c44367d /source3 | |
parent | cca96e47268d32e12e1b6b9a187f3096efa12b29 (diff) | |
download | samba-e25b34ab0c565cb702b278d22552828e6ba090a5.tar.gz samba-e25b34ab0c565cb702b278d22552828e6ba090a5.tar.bz2 samba-e25b34ab0c565cb702b278d22552828e6ba090a5.zip |
s3-rpc_server: Move the endpoint registration to own file.
Diffstat (limited to 'source3')
-rw-r--r-- | source3/Makefile.in | 3 | ||||
-rw-r--r-- | source3/printing/spoolssd.c | 4 | ||||
-rw-r--r-- | source3/rpc_server/rpc_ep_register.c | 286 | ||||
-rw-r--r-- | source3/rpc_server/rpc_ep_register.h | 53 | ||||
-rw-r--r-- | source3/rpc_server/rpc_ep_setup.c | 385 | ||||
-rw-r--r-- | source3/rpc_server/wscript_build | 4 |
6 files changed, 408 insertions, 327 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index ff2d433f82..eea521c415 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -749,7 +749,7 @@ RPC_RPCECHO_OBJ = rpc_server/echo/srv_echo_nt.o librpc/gen_ndr/srv_echo.o RPC_EPMAPPER_OBJ = rpc_server/epmapper/srv_epmapper.o librpc/gen_ndr/srv_epmapper.o -RPC_SERVER_REGISTER_OBJ = rpc_server/rpc_ep_setup.o $(DCE_RPC_EP_OBJ) +RPC_SERVER_REGISTER_OBJ = rpc_server/rpc_ep_register.o $(DCE_RPC_EP_OBJ) RPC_SERVER_OBJ = $(RPC_LSARPC_OBJ) $(RPC_WINREG_OBJ) $(RPC_INITSHUTDOWN_OBJ) \ $(RPC_DSSETUP_OBJ) $(RPC_WKSSVC_OBJ) $(RPC_SVCCTL_OBJ) \ @@ -765,6 +765,7 @@ RPC_SERVER_OBJ = $(RPC_LSARPC_OBJ) $(RPC_WINREG_OBJ) $(RPC_INITSHUTDOWN_OBJ) \ $(LIBCLI_NETLOGON_OBJ) \ $(RPC_SERVER_REGISTER_OBJ) \ $(RPC_CLIENT_SCHANNEL_OBJ) \ + rpc_server/rpc_ep_setup.o \ rpc_client/init_netlogon.o \ rpc_client/init_samr.o diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c index 039eb8872e..bd8a62fb33 100644 --- a/source3/printing/spoolssd.c +++ b/source3/printing/spoolssd.c @@ -27,7 +27,7 @@ #include "librpc/gen_ndr/srv_winreg.h" #include "librpc/gen_ndr/srv_spoolss.h" #include "rpc_server/rpc_server.h" -#include "rpc_server/rpc_ep_setup.h" +#include "rpc_server/rpc_ep_register.h" #include "rpc_server/spoolss/srv_spoolss_nt.h" #define SPOOLSS_PIPE_NAME "spoolss" @@ -226,7 +226,7 @@ void start_spoolssd(struct tevent_context *ev_ctx, exit(1); } - status = rpc_ep_setup_register(ev_ctx, msg_ctx, &ndr_table_spoolss, NULL, 0); + status = rpc_ep_register(ev_ctx, msg_ctx, &ndr_table_spoolss, NULL, 0); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("Failed to register spoolss endpoint! (%s)\n", nt_errstr(status))); diff --git a/source3/rpc_server/rpc_ep_register.c b/source3/rpc_server/rpc_ep_register.c new file mode 100644 index 0000000000..906dd6c59e --- /dev/null +++ b/source3/rpc_server/rpc_ep_register.c @@ -0,0 +1,286 @@ +/* + * Unix SMB/CIFS implementation. + * + * RPC Endpoint Registration + * + * Copyright (c) 2011 Andreas Schneider <asn@samba.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#include "includes.h" +#include "ntdomain.h" + +#include "../librpc/gen_ndr/ndr_epmapper_c.h" + +#include "librpc/rpc/dcerpc_ep.h" +#include "rpc_server/rpc_ep_register.h" + +static void rpc_ep_register_loop(struct tevent_req *subreq); +static NTSTATUS rpc_ep_try_register(TALLOC_CTX *mem_ctx, + struct tevent_context *ev_ctx, + struct messaging_context *msg_ctx, + const struct ndr_interface_table *iface, + const char *ncalrpc, + uint16_t port, + struct dcerpc_binding_handle **pbh); + +struct rpc_ep_regsiter_state { + struct dcerpc_binding_handle *h; + + TALLOC_CTX *mem_ctx; + struct tevent_context *ev_ctx; + struct messaging_context *msg_ctx; + + const struct ndr_interface_table *iface; + + const char *ncalrpc; + uint16_t port; + + uint32_t wait_time; +}; + +NTSTATUS rpc_ep_register(struct tevent_context *ev_ctx, + struct messaging_context *msg_ctx, + const struct ndr_interface_table *iface, + const char *ncalrpc, + uint16_t port) +{ + struct rpc_ep_regsiter_state *state; + struct tevent_req *req; + + state = talloc(ev_ctx, struct rpc_ep_regsiter_state); + if (state == NULL) { + return NT_STATUS_NO_MEMORY; + } + + state->mem_ctx = talloc_named(state, + 0, + "ep %s %p", + iface->name, state); + if (state->mem_ctx == NULL) { + talloc_free(state); + return NT_STATUS_NO_MEMORY; + } + + state->wait_time = 1; + state->ev_ctx = ev_ctx; + state->msg_ctx = msg_ctx; + state->iface = iface; + state->ncalrpc = talloc_strdup(state, ncalrpc); + state->port = port; + + req = tevent_wakeup_send(state->mem_ctx, + state->ev_ctx, + timeval_current_ofs(1, 0)); + if (tevent_req_nomem(state->mem_ctx, req)) { + talloc_free(state); + return NT_STATUS_NO_MEMORY; + } + + tevent_req_set_callback(req, rpc_ep_register_loop, state); + + return NT_STATUS_OK; +} + +#define MONITOR_WAIT_TIME 15 +static void rpc_ep_monitor_loop(struct tevent_req *subreq); + +static void rpc_ep_register_loop(struct tevent_req *subreq) +{ + struct rpc_ep_regsiter_state *state = + tevent_req_callback_data(subreq, struct rpc_ep_regsiter_state); + NTSTATUS status; + bool ok; + + ok = tevent_wakeup_recv(subreq); + TALLOC_FREE(subreq); + if (!ok) { + talloc_free(state); + return; + } + + status = rpc_ep_try_register(state->mem_ctx, + state->ev_ctx, + state->msg_ctx, + state->iface, + state->ncalrpc, + state->port, + &state->h); + if (NT_STATUS_IS_OK(status)) { + /* endpoint registered, monitor the connnection. */ + subreq = tevent_wakeup_send(state->mem_ctx, + state->ev_ctx, + timeval_current_ofs(MONITOR_WAIT_TIME, 0)); + if (tevent_req_nomem(state->mem_ctx, subreq)) { + talloc_free(state); + return; + } + + tevent_req_set_callback(subreq, rpc_ep_monitor_loop, state); + return; + } + + state->wait_time = state->wait_time * 2; + if (state->wait_time > 16) { + DEBUG(0, ("Failed to register endpoint '%s'!\n", + state->iface->name)); + state->wait_time = 16; + } + + subreq = tevent_wakeup_send(state->mem_ctx, + state->ev_ctx, + timeval_current_ofs(state->wait_time, 0)); + if (tevent_req_nomem(state->mem_ctx, subreq)) { + talloc_free(state); + return; + } + + tevent_req_set_callback(subreq, rpc_ep_register_loop, state); + return; +} + +static NTSTATUS rpc_ep_try_register(TALLOC_CTX *mem_ctx, + struct tevent_context *ev_ctx, + struct messaging_context *msg_ctx, + const struct ndr_interface_table *iface, + const char *ncalrpc, + uint16_t port, + struct dcerpc_binding_handle **pbh) +{ + struct dcerpc_binding_vector *v = NULL; + NTSTATUS status; + + status = dcerpc_binding_vector_create(mem_ctx, + iface, + port, + ncalrpc, + &v); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + status = dcerpc_ep_register(mem_ctx, + msg_ctx, + iface, + v, + &iface->syntax_id.uuid, + iface->name, + pbh); + talloc_free(v); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + return status; +} + +/* + * Monitor the connection to the endpoint mapper and if it goes away, try to + * register the endpoint. + */ +static void rpc_ep_monitor_loop(struct tevent_req *subreq) +{ + struct rpc_ep_regsiter_state *state = + tevent_req_callback_data(subreq, struct rpc_ep_regsiter_state); + struct policy_handle entry_handle; + struct dcerpc_binding map_binding; + struct epm_twr_p_t towers[10]; + struct epm_twr_t *map_tower; + uint32_t num_towers = 0; + struct GUID object; + NTSTATUS status; + uint32_t result = EPMAPPER_STATUS_CANT_PERFORM_OP; + TALLOC_CTX *tmp_ctx; + bool ok; + + ZERO_STRUCT(object); + ZERO_STRUCT(entry_handle); + + tmp_ctx = talloc_stackframe(); + if (tmp_ctx == NULL) { + talloc_free(state); + return; + } + + ok = tevent_wakeup_recv(subreq); + TALLOC_FREE(subreq); + if (!ok) { + talloc_free(state); + return; + } + + /* Create map tower */ + map_binding.transport = NCACN_NP; + map_binding.object = state->iface->syntax_id; + map_binding.host = ""; + map_binding.endpoint = ""; + + map_tower = talloc_zero(tmp_ctx, struct epm_twr_t); + if (map_tower == NULL) { + talloc_free(tmp_ctx); + talloc_free(state); + return; + } + + status = dcerpc_binding_build_tower(map_tower, &map_binding, + &map_tower->tower); + if (!NT_STATUS_IS_OK(status)) { + talloc_free(tmp_ctx); + talloc_free(state); + return; + } + + ok = false; + status = dcerpc_epm_Map(state->h, + tmp_ctx, + &object, + map_tower, + &entry_handle, + 10, + &num_towers, + towers, + &result); + if (NT_STATUS_IS_OK(status)) { + ok = true; + } + if (result == EPMAPPER_STATUS_OK || + result == EPMAPPER_STATUS_NO_MORE_ENTRIES) { + ok = true; + } + if (num_towers == 0) { + ok = false; + } + + talloc_free(tmp_ctx); + + subreq = tevent_wakeup_send(state->mem_ctx, + state->ev_ctx, + timeval_current_ofs(MONITOR_WAIT_TIME, 0)); + if (tevent_req_nomem(state->mem_ctx, subreq)) { + talloc_free(state); + return; + } + + if (ok) { + tevent_req_set_callback(subreq, rpc_ep_monitor_loop, state); + } else { + TALLOC_FREE(state->h); + state->wait_time = 1; + + tevent_req_set_callback(subreq, rpc_ep_register_loop, state); + } + + return; +} diff --git a/source3/rpc_server/rpc_ep_register.h b/source3/rpc_server/rpc_ep_register.h new file mode 100644 index 0000000000..4a74a91d75 --- /dev/null +++ b/source3/rpc_server/rpc_ep_register.h @@ -0,0 +1,53 @@ +/* + * Unix SMB/CIFS implementation. + * + * RPC Endpoint Registration + * + * Copyright (c) 2011 Andreas Schneider <asn@samba.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _RPC_EP_REGISTER_H +#define _RPC_EP_REGISTER_H + +struct ndr_interface_table; + +/** + * @brief Register an endpoint at the endpoint mapper. + * + * This just sets up a register and monitor loop to try to regsiter the + * endpoint at the endpoint mapper. + * + * @param[in] ev_ctx The event context to setup the loop. + * + * @param[in] msg_ctx The messaging context to use for the connnection. + * + * @param[in] iface The interface table to register. + * + * @param[in] ncalrpc The name of the ncalrpc pipe or NULL. + * + * @param[in] port The tcpip port or 0. + * + * @return NT_STATUS_OK on success or a corresponding error code. + */ +NTSTATUS rpc_ep_register(struct tevent_context *ev_ctx, + struct messaging_context *msg_ctx, + const struct ndr_interface_table *iface, + const char *ncalrpc, + uint16_t port); + +#endif /* _RPC_EP_REGISTER_H */ + +/* vim: set ts=8 sw=8 noet cindent ft=c.doxygen: */ diff --git a/source3/rpc_server/rpc_ep_setup.c b/source3/rpc_server/rpc_ep_setup.c index 7f40dda919..7afe24ff25 100644 --- a/source3/rpc_server/rpc_ep_setup.c +++ b/source3/rpc_server/rpc_ep_setup.c @@ -45,9 +45,8 @@ #include "rpc_server/spoolss/srv_spoolss_nt.h" #include "rpc_server/svcctl/srv_svcctl_nt.h" -#include "librpc/rpc/dcerpc_ep.h" - #include "rpc_server/rpc_ep_setup.h" +#include "rpc_server/rpc_ep_register.h" #include "rpc_server/rpc_server.h" #include "rpc_server/epmapper/srv_epmapper.h" @@ -126,264 +125,6 @@ static uint16_t _open_sockets(struct tevent_context *ev_ctx, return p; } -static void rpc_ep_setup_register_loop(struct tevent_req *subreq); -static NTSTATUS rpc_ep_setup_try_register(TALLOC_CTX *mem_ctx, - struct tevent_context *ev_ctx, - struct messaging_context *msg_ctx, - const struct ndr_interface_table *iface, - const char *ncalrpc, - uint16_t port, - struct dcerpc_binding_handle **pbh); - -struct rpc_ep_regsiter_state { - struct dcerpc_binding_handle *h; - - TALLOC_CTX *mem_ctx; - struct tevent_context *ev_ctx; - struct messaging_context *msg_ctx; - - const struct ndr_interface_table *iface; - - const char *ncalrpc; - uint16_t port; - - uint32_t wait_time; -}; - -NTSTATUS rpc_ep_setup_register(struct tevent_context *ev_ctx, - struct messaging_context *msg_ctx, - const struct ndr_interface_table *iface, - const char *ncalrpc, - uint16_t port) -{ - struct rpc_ep_regsiter_state *state; - struct tevent_req *req; - - state = talloc(ev_ctx, struct rpc_ep_regsiter_state); - if (state == NULL) { - return NT_STATUS_NO_MEMORY; - } - - state->mem_ctx = talloc_named(state, - 0, - "ep %s %p", - iface->name, state); - if (state->mem_ctx == NULL) { - talloc_free(state); - return NT_STATUS_NO_MEMORY; - } - - state->wait_time = 1; - state->ev_ctx = ev_ctx; - state->msg_ctx = msg_ctx; - state->iface = iface; - state->ncalrpc = talloc_strdup(state, ncalrpc); - state->port = port; - - req = tevent_wakeup_send(state->mem_ctx, - state->ev_ctx, - timeval_current_ofs(1, 0)); - if (tevent_req_nomem(state->mem_ctx, req)) { - talloc_free(state); - return NT_STATUS_NO_MEMORY; - } - - tevent_req_set_callback(req, rpc_ep_setup_register_loop, state); - - return NT_STATUS_OK; -} - -#define MONITOR_WAIT_TIME 15 -static void rpc_ep_setup_monitor_loop(struct tevent_req *subreq); - -static void rpc_ep_setup_register_loop(struct tevent_req *subreq) -{ - struct rpc_ep_regsiter_state *state = - tevent_req_callback_data(subreq, struct rpc_ep_regsiter_state); - NTSTATUS status; - bool ok; - - ok = tevent_wakeup_recv(subreq); - TALLOC_FREE(subreq); - if (!ok) { - talloc_free(state); - return; - } - - status = rpc_ep_setup_try_register(state->mem_ctx, - state->ev_ctx, - state->msg_ctx, - state->iface, - state->ncalrpc, - state->port, - &state->h); - if (NT_STATUS_IS_OK(status)) { - /* endpoint registered, monitor the connnection. */ - subreq = tevent_wakeup_send(state->mem_ctx, - state->ev_ctx, - timeval_current_ofs(MONITOR_WAIT_TIME, 0)); - if (tevent_req_nomem(state->mem_ctx, subreq)) { - talloc_free(state); - return; - } - - tevent_req_set_callback(subreq, rpc_ep_setup_monitor_loop, state); - return; - } - - state->wait_time = state->wait_time * 2; - if (state->wait_time > 16) { - DEBUG(0, ("Failed to register endpoint '%s'!\n", - state->iface->name)); - state->wait_time = 16; - } - - subreq = tevent_wakeup_send(state->mem_ctx, - state->ev_ctx, - timeval_current_ofs(state->wait_time, 0)); - if (tevent_req_nomem(state->mem_ctx, subreq)) { - talloc_free(state); - return; - } - - tevent_req_set_callback(subreq, rpc_ep_setup_register_loop, state); - return; -} - -static NTSTATUS rpc_ep_setup_try_register(TALLOC_CTX *mem_ctx, - struct tevent_context *ev_ctx, - struct messaging_context *msg_ctx, - const struct ndr_interface_table *iface, - const char *ncalrpc, - uint16_t port, - struct dcerpc_binding_handle **pbh) -{ - struct dcerpc_binding_vector *v = NULL; - NTSTATUS status; - - status = dcerpc_binding_vector_create(mem_ctx, - iface, - port, - ncalrpc, - &v); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - - status = dcerpc_ep_register(mem_ctx, - msg_ctx, - iface, - v, - &iface->syntax_id.uuid, - iface->name, - pbh); - talloc_free(v); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - - return status; -} - -/* - * Monitor the connection to the endpoint mapper and if it goes away, try to - * register the endpoint. - */ -static void rpc_ep_setup_monitor_loop(struct tevent_req *subreq) -{ - struct rpc_ep_regsiter_state *state = - tevent_req_callback_data(subreq, struct rpc_ep_regsiter_state); - struct policy_handle entry_handle; - struct dcerpc_binding map_binding; - struct epm_twr_p_t towers[10]; - struct epm_twr_t *map_tower; - uint32_t num_towers = 0; - struct GUID object; - NTSTATUS status; - uint32_t result = EPMAPPER_STATUS_CANT_PERFORM_OP; - TALLOC_CTX *tmp_ctx; - bool ok; - - ZERO_STRUCT(object); - ZERO_STRUCT(entry_handle); - - tmp_ctx = talloc_stackframe(); - if (tmp_ctx == NULL) { - talloc_free(state); - return; - } - - ok = tevent_wakeup_recv(subreq); - TALLOC_FREE(subreq); - if (!ok) { - talloc_free(state); - return; - } - - /* Create map tower */ - map_binding.transport = NCACN_NP; - map_binding.object = state->iface->syntax_id; - map_binding.host = ""; - map_binding.endpoint = ""; - - map_tower = talloc_zero(tmp_ctx, struct epm_twr_t); - if (map_tower == NULL) { - talloc_free(tmp_ctx); - talloc_free(state); - return; - } - - status = dcerpc_binding_build_tower(map_tower, &map_binding, - &map_tower->tower); - if (!NT_STATUS_IS_OK(status)) { - talloc_free(tmp_ctx); - talloc_free(state); - return; - } - - ok = false; - status = dcerpc_epm_Map(state->h, - tmp_ctx, - &object, - map_tower, - &entry_handle, - 10, - &num_towers, - towers, - &result); - if (NT_STATUS_IS_OK(status)) { - ok = true; - } - if (result == EPMAPPER_STATUS_OK || - result == EPMAPPER_STATUS_NO_MORE_ENTRIES) { - ok = true; - } - if (num_towers == 0) { - ok = false; - } - - talloc_free(tmp_ctx); - - subreq = tevent_wakeup_send(state->mem_ctx, - state->ev_ctx, - timeval_current_ofs(MONITOR_WAIT_TIME, 0)); - if (tevent_req_nomem(state->mem_ctx, subreq)) { - talloc_free(state); - return; - } - - if (ok) { - tevent_req_set_callback(subreq, rpc_ep_setup_monitor_loop, state); - } else { - TALLOC_FREE(state->h); - state->wait_time = 1; - - tevent_req_set_callback(subreq, rpc_ep_setup_register_loop, state); - } - - return; -} - static bool epmapper_init_cb(void *ptr) { struct dcesrv_ep_context *ep_ctx = @@ -442,11 +183,11 @@ static bool winreg_init_cb(void *ptr) return false; } - status = rpc_ep_setup_register(ep_ctx->ev_ctx, - ep_ctx->msg_ctx, - &ndr_table_winreg, - pipe_name, - port); + status = rpc_ep_register(ep_ctx->ev_ctx, + ep_ctx->msg_ctx, + &ndr_table_winreg, + pipe_name, + port); if (!NT_STATUS_IS_OK(status)) { return false; } @@ -490,11 +231,11 @@ static bool srvsvc_init_cb(void *ptr) return false; } - status = rpc_ep_setup_register(ep_ctx->ev_ctx, - ep_ctx->msg_ctx, - &ndr_table_srvsvc, - pipe_name, - port); + status = rpc_ep_register(ep_ctx->ev_ctx, + ep_ctx->msg_ctx, + &ndr_table_srvsvc, + pipe_name, + port); if (!NT_STATUS_IS_OK(status)) { return false; } @@ -538,11 +279,11 @@ static bool lsarpc_init_cb(void *ptr) return false; } - status = rpc_ep_setup_register(ep_ctx->ev_ctx, - ep_ctx->msg_ctx, - &ndr_table_lsarpc, - pipe_name, - port); + status = rpc_ep_register(ep_ctx->ev_ctx, + ep_ctx->msg_ctx, + &ndr_table_lsarpc, + pipe_name, + port); if (!NT_STATUS_IS_OK(status)) { return false; } @@ -586,11 +327,11 @@ static bool samr_init_cb(void *ptr) return false; } - status = rpc_ep_setup_register(ep_ctx->ev_ctx, - ep_ctx->msg_ctx, - &ndr_table_samr, - pipe_name, - port); + status = rpc_ep_register(ep_ctx->ev_ctx, + ep_ctx->msg_ctx, + &ndr_table_samr, + pipe_name, + port); if (!NT_STATUS_IS_OK(status)) { return false; } @@ -634,11 +375,11 @@ static bool netlogon_init_cb(void *ptr) return false; } - status = rpc_ep_setup_register(ep_ctx->ev_ctx, - ep_ctx->msg_ctx, - &ndr_table_netlogon, - pipe_name, - port); + status = rpc_ep_register(ep_ctx->ev_ctx, + ep_ctx->msg_ctx, + &ndr_table_netlogon, + pipe_name, + port); if (!NT_STATUS_IS_OK(status)) { return false; } @@ -671,7 +412,7 @@ static bool spoolss_init_cb(void *ptr) strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; - status =rpc_ep_setup_register(ep_ctx->ev_ctx, + status = rpc_ep_register(ep_ctx->ev_ctx, ep_ctx->msg_ctx, &ndr_table_spoolss, "spoolss", @@ -715,11 +456,11 @@ static bool svcctl_init_cb(void *ptr) strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; - status = rpc_ep_setup_register(ep_ctx->ev_ctx, - ep_ctx->msg_ctx, - &ndr_table_svcctl, - "svcctl", - 0); + status = rpc_ep_register(ep_ctx->ev_ctx, + ep_ctx->msg_ctx, + &ndr_table_svcctl, + "svcctl", + 0); if (!NT_STATUS_IS_OK(status)) { return false; } @@ -750,11 +491,11 @@ static bool ntsvcs_init_cb(void *ptr) strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; - status = rpc_ep_setup_register(ep_ctx->ev_ctx, - ep_ctx->msg_ctx, - &ndr_table_ntsvcs, - "ntsvcs", - 0); + status = rpc_ep_register(ep_ctx->ev_ctx, + ep_ctx->msg_ctx, + &ndr_table_ntsvcs, + "ntsvcs", + 0); if (!NT_STATUS_IS_OK(status)) { return false; } @@ -784,7 +525,7 @@ static bool eventlog_init_cb(void *ptr) strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; - status =rpc_ep_setup_register(ep_ctx->ev_ctx, + status = rpc_ep_register(ep_ctx->ev_ctx, ep_ctx->msg_ctx, &ndr_table_eventlog, "eventlog", @@ -812,11 +553,11 @@ static bool initshutdown_init_cb(void *ptr) strcasecmp_m(rpcsrv_type, "daemon") == 0) { NTSTATUS status; - status = rpc_ep_setup_register(ep_ctx->ev_ctx, - ep_ctx->msg_ctx, - &ndr_table_initshutdown, - "initshutdown", - 0); + status = rpc_ep_register(ep_ctx->ev_ctx, + ep_ctx->msg_ctx, + &ndr_table_initshutdown, + "initshutdown", + 0); if (!NT_STATUS_IS_OK(status)) { return false; } @@ -849,11 +590,11 @@ static bool rpcecho_init_cb(void *ptr) { return false; } - status = rpc_ep_setup_register(ep_ctx->ev_ctx, - ep_ctx->msg_ctx, - &ndr_table_rpcecho, - "rpcecho", - port); + status = rpc_ep_register(ep_ctx->ev_ctx, + ep_ctx->msg_ctx, + &ndr_table_rpcecho, + "rpcecho", + port); if (!NT_STATUS_IS_OK(status)) { return false; } @@ -898,11 +639,11 @@ static bool netdfs_init_cb(void *ptr) return false; } - status = rpc_ep_setup_register(ep_ctx->ev_ctx, - ep_ctx->msg_ctx, - &ndr_table_netdfs, - pipe_name, - port); + status = rpc_ep_register(ep_ctx->ev_ctx, + ep_ctx->msg_ctx, + &ndr_table_netdfs, + pipe_name, + port); if (!NT_STATUS_IS_OK(status)) { return false; } @@ -946,11 +687,11 @@ static bool dssetup_init_cb(void *ptr) return false; } - status = rpc_ep_setup_register(ep_ctx->ev_ctx, - ep_ctx->msg_ctx, - &ndr_table_dssetup, - "dssetup", - port); + status = rpc_ep_register(ep_ctx->ev_ctx, + ep_ctx->msg_ctx, + &ndr_table_dssetup, + "dssetup", + port); if (!NT_STATUS_IS_OK(status)) { return false; } @@ -993,11 +734,11 @@ static bool wkssvc_init_cb(void *ptr) return false; } - status = rpc_ep_setup_register(ep_ctx->ev_ctx, - ep_ctx->msg_ctx, - &ndr_table_wkssvc, - "wkssvc", - port); + status = rpc_ep_register(ep_ctx->ev_ctx, + ep_ctx->msg_ctx, + &ndr_table_wkssvc, + "wkssvc", + port); if (!NT_STATUS_IS_OK(status)) { return false; } diff --git a/source3/rpc_server/wscript_build b/source3/rpc_server/wscript_build index db04832550..7daaa5840e 100644 --- a/source3/rpc_server/wscript_build +++ b/source3/rpc_server/wscript_build @@ -42,7 +42,7 @@ bld.SAMBA3_SUBSYSTEM('RPC_PIPE_REGISTER', deps='samba-util') bld.SAMBA3_SUBSYSTEM('RPC_SERVER_REGISTER', - source='rpc_ep_setup.c ../librpc/rpc/dcerpc_ep.c', + source='rpc_ep_register.c ../librpc/rpc/dcerpc_ep.c', deps='samba-util') bld.SAMBA3_SUBSYSTEM('EPMD', @@ -129,7 +129,7 @@ bld.SAMBA3_SUBSYSTEM('RPC_EPMAPPER', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_SERVER', - source='srv_pipe_hnd.c srv_pipe.c', + source='srv_pipe_hnd.c srv_pipe.c rpc_ep_setup.c', deps='''RPC_NCACN_NP RPC_SERVICE RPC_CRYPTO RPC_SAMR RPC_LSARPC RPC_WINREG RPC_INITSHUTDOWN RPC_DSSETUP RPC_WKSSVC RPC_SVCCTL RPC_NTSVCS |