(*listen_fd_size)++;
fd = -1;
- status = dcesrv_create_ncalrpc_socket("lsarpc", &fd);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- rc = listen(fd, pf_lsasd_cfg.max_allowed_clients);
- if (rc == -1) {
- DEBUG(0, ("Failed to listen on lsarpc ncalrpc - %s\n",
- strerror(errno)));
- goto done;
- }
- listen_fd[*listen_fd_size].fd = fd;
- listen_fd[*listen_fd_size].fd_data = NULL;
- (*listen_fd_size)++;
- fd = -1;
-
v = dcerpc_binding_vector_dup(tmp_ctx, v_orig);
if (v == NULL) {
goto done;
(*listen_fd_size)++;
fd = -1;
- status = dcesrv_create_ncalrpc_socket("samr", &fd);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- rc = listen(fd, pf_lsasd_cfg.max_allowed_clients);
- if (rc == -1) {
- DEBUG(0, ("Failed to listen on samr ncalrpc - %s\n",
- strerror(errno)));
- goto done;
- }
- listen_fd[*listen_fd_size].fd = fd;
- listen_fd[*listen_fd_size].fd_data = NULL;
- (*listen_fd_size)++;
- fd = -1;
-
v = dcerpc_binding_vector_dup(tmp_ctx, v_orig);
if (v == NULL) {
goto done;
(*listen_fd_size)++;
fd = -1;
- status = dcesrv_create_ncalrpc_socket("netlogon", &fd);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- rc = listen(fd, pf_lsasd_cfg.max_allowed_clients);
- if (rc == -1) {
- DEBUG(0, ("Failed to listen on netlogon ncalrpc - %s\n",
- strerror(errno)));
- goto done;
- }
- listen_fd[*listen_fd_size].fd = fd;
- listen_fd[*listen_fd_size].fd_data = NULL;
- (*listen_fd_size)++;
- fd = -1;
-
v = dcerpc_binding_vector_dup(tmp_ctx, v_orig);
if (v == NULL) {
goto done;
uint16_t flags,
void *private_data);
-NTSTATUS dcesrv_create_ncalrpc_socket(const char *name, int *out_fd)
+NTSTATUS dcesrv_create_ncalrpc_socket(struct dcesrv_endpoint *e, int *out_fd)
{
int fd = -1;
+ const char *endpoint = NULL;
NTSTATUS status;
- if (name == NULL) {
- name = "DEFAULT";
+ endpoint = dcerpc_binding_get_string_option(e->ep_description,
+ "endpoint");
+ if (endpoint == NULL) {
+ /*
+ * No identifier specified: use DEFAULT.
+ *
+ * TODO: DO NOT hardcode this value anywhere else. Rather,
+ * specify no endpoint and let the epmapper worry about it.
+ */
+ endpoint = "DEFAULT";
+ status = dcerpc_binding_set_string_option(e->ep_description,
+ "endpoint",
+ endpoint);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_ERR("Failed to set ncalrpc 'endpoint' binding "
+ "string option to '%s': %s\n",
+ endpoint, nt_errstr(status));
+ return status;
+ }
}
if (!directory_create_or_exist(lp_ncalrpc_dir(), 0755)) {
goto out;
}
- fd = create_pipe_sock(lp_ncalrpc_dir(), name, 0755);
+ fd = create_pipe_sock(lp_ncalrpc_dir(), endpoint, 0755);
if (fd == -1) {
status = map_nt_error_from_unix_common(errno);
DBG_ERR("Failed to create ncalrpc socket '%s/%s': %s\n",
- lp_ncalrpc_dir(), name, strerror(errno));
+ lp_ncalrpc_dir(), endpoint, strerror(errno));
goto out;
}
DBG_DEBUG("Opened ncalrpc socket fd '%d' for '%s/%s'\n",
- fd, lp_ncalrpc_dir(), name);
+ fd, lp_ncalrpc_dir(), endpoint);
*out_fd = fd;
struct tevent_fd *fde;
int rc;
NTSTATUS status;
- const char *endpoint = NULL;
/* Alloc in endpoint context. If the endpoint is freed (for example
* when forked daemons reinit the dcesrv_context, the tevent_fd
state->termination_fn = term_fn;
state->termination_data = termination_data;
- endpoint = dcerpc_binding_get_string_option(e->ep_description,
- "endpoint");
- if (endpoint == NULL) {
- /*
- * No identifier specified: use DEFAULT.
- *
- * TODO: DO NOT hardcode this value anywhere else. Rather,
- * specify no endpoint and let the epmapper worry about it.
- */
- endpoint = "DEFAULT";
- status = dcerpc_binding_set_string_option(e->ep_description,
- "endpoint",
- endpoint);
- if (!NT_STATUS_IS_OK(status)) {
- DBG_ERR("Failed to set ncalrpc 'endpoint' binding "
- "string option to '%s': %s\n",
- endpoint, nt_errstr(status));
- goto out;
- }
- }
-
- status = dcesrv_create_ncalrpc_socket(endpoint, &state->fd);
+ status = dcesrv_create_ncalrpc_socket(e, &state->fd);
if (!NT_STATUS_IS_OK(status)) {
DBG_ERR("Failed to create ncalrpc socket: %s\n",
nt_errstr(status));
rc = listen(state->fd, 5);
if (rc < 0) {
+ const char *endpoint = dcerpc_binding_get_string_option(
+ e->ep_description, "endpoint");
status = map_nt_error_from_unix_common(errno);
DBG_ERR("Failed to listen on ncalrpc socket %s: %s\n",
endpoint, strerror(errno));
#include "rpc_server/spoolss/srv_spoolss_nt.h"
#include "rpc_server/svcctl/srv_svcctl_nt.h"
+#include "lib/server_prefork.h"
#include "librpc/rpc/dcesrv_core.h"
#include "librpc/rpc/dcerpc_ep.h"
#include "rpc_server/rpc_sock_helper.h"
dcerpc_binding_get_transport(e->ep_description);
char *binding = NULL;
NTSTATUS status;
+ int out_fd;
binding = dcerpc_binding_string(dce_ctx, e->ep_description);
if (binding == NULL) {
switch (transport) {
case NCALRPC:
- /* TODO */
- status = NT_STATUS_OK;
+ status = dcesrv_create_ncalrpc_socket(e, &out_fd);
+ if (NT_STATUS_IS_OK(status)) {
+ listen_fds[*listen_fds_size].fd = out_fd;
+ listen_fds[*listen_fds_size].fd_data = e;
+ (*listen_fds_size)++;
+ }
break;
case NCACN_IP_TCP: