#include "auth.h"
#include "rpc_server/rpc_ncacn_np.h"
#include "../lib/tsocket/tsocket.h"
+
+#include "librpc/rpc/dcesrv_core.h"
#include "rpc_server/rpc_config.h"
#define EPM_MAX_ANNOTATION_SIZE 64
-struct dcerpc_binding_vector {
- struct dcerpc_binding **bindings;
- uint32_t count;
- uint32_t allocated;
-};
-
-static bool binding_vector_realloc(struct dcerpc_binding_vector *bvec)
-{
- if (bvec->count >= bvec->allocated) {
- struct dcerpc_binding **tmp;
-
- tmp = talloc_realloc(bvec,
- bvec->bindings,
- struct dcerpc_binding *,
- bvec->allocated * 2);
- if (tmp == NULL) {
- return false;
- }
- bvec->bindings = tmp;
- bvec->allocated = bvec->allocated * 2;
- }
-
- return true;
-}
-
-NTSTATUS dcerpc_binding_vector_new(TALLOC_CTX *mem_ctx,
- struct dcerpc_binding_vector **pbvec)
-{
- struct dcerpc_binding_vector *bvec;
- NTSTATUS status;
- TALLOC_CTX *tmp_ctx;
-
- tmp_ctx = talloc_stackframe();
- if (tmp_ctx == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
-
- bvec = talloc_zero(tmp_ctx, struct dcerpc_binding_vector);
- if (bvec == NULL) {
- status = NT_STATUS_NO_MEMORY;
- goto done;
- }
-
- bvec->bindings = talloc_zero_array(bvec,
- struct dcerpc_binding *,
- 4);
- if (bvec->bindings == NULL) {
- status = NT_STATUS_NO_MEMORY;
- goto done;
- }
-
- bvec->allocated = 4;
- bvec->count = 0;
-
- *pbvec = talloc_move(mem_ctx, &bvec);
-
- status = NT_STATUS_OK;
-done:
- talloc_free(tmp_ctx);
-
- return status;
-}
-
-NTSTATUS dcerpc_binding_vector_add_np_default(const struct ndr_interface_table *iface,
- struct dcerpc_binding_vector *bvec)
-{
- uint32_t ep_count = iface->endpoints->count;
- uint32_t i;
- NTSTATUS status;
- bool ok;
-
- for (i = 0; i < ep_count; i++) {
- struct dcerpc_binding *b;
- enum dcerpc_transport_t transport;
- char *unc = NULL;
-
- status = dcerpc_parse_binding(bvec->bindings,
- iface->endpoints->names[i],
- &b);
- if (!NT_STATUS_IS_OK(status)) {
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- /* Only add the named pipes defined in the iface endpoints */
- transport = dcerpc_binding_get_transport(b);
- if (transport != NCACN_NP) {
- talloc_free(b);
- continue;
- }
-
- status = dcerpc_binding_set_abstract_syntax(b, &iface->syntax_id);
- if (!NT_STATUS_IS_OK(status)) {
- talloc_free(b);
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- unc = talloc_asprintf(b, "\\\\%s", lp_netbios_name());
- if (unc == NULL) {
- talloc_free(b);
- return NT_STATUS_NO_MEMORY;
- }
-
- status = dcerpc_binding_set_string_option(b, "host", unc);
- TALLOC_FREE(unc);
- if (!NT_STATUS_IS_OK(status)) {
- talloc_free(b);
- return NT_STATUS_NO_MEMORY;
- }
-
- ok = binding_vector_realloc(bvec);
- if (!ok) {
- talloc_free(b);
- return NT_STATUS_NO_MEMORY;
- }
-
- bvec->bindings[bvec->count] = b;
- bvec->count++;
- }
-
- return NT_STATUS_OK;
-}
-
-NTSTATUS dcerpc_binding_vector_add_port(const struct ndr_interface_table *iface,
- struct dcerpc_binding_vector *bvec,
- const char *host,
- uint16_t _port)
-{
- uint32_t ep_count = iface->endpoints->count;
- uint32_t i;
- NTSTATUS status;
- bool ok;
- char port[6];
-
- snprintf(port, sizeof(port), "%u", _port);
-
- for (i = 0; i < ep_count; i++) {
- struct dcerpc_binding *b;
- enum dcerpc_transport_t transport;
-
- status = dcerpc_parse_binding(bvec->bindings,
- iface->endpoints->names[i],
- &b);
- if (!NT_STATUS_IS_OK(status)) {
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- transport = dcerpc_binding_get_transport(b);
- if (transport != NCACN_IP_TCP) {
- talloc_free(b);
- continue;
- }
-
- status = dcerpc_binding_set_abstract_syntax(b, &iface->syntax_id);
- if (!NT_STATUS_IS_OK(status)) {
- talloc_free(b);
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- status = dcerpc_binding_set_string_option(b, "host", host);
- if (!NT_STATUS_IS_OK(status)) {
- talloc_free(b);
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- status = dcerpc_binding_set_string_option(b, "endpoint", port);
- if (!NT_STATUS_IS_OK(status)) {
- talloc_free(b);
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- ok = binding_vector_realloc(bvec);
- if (!ok) {
- talloc_free(b);
- return NT_STATUS_NO_MEMORY;
- }
-
- bvec->bindings[bvec->count] = b;
- bvec->count++;
-
- break;
- }
-
- return NT_STATUS_OK;
-}
-
-NTSTATUS dcerpc_binding_vector_add_unix(const struct ndr_interface_table *iface,
- struct dcerpc_binding_vector *bvec,
- const char *name)
-{
- uint32_t ep_count = iface->endpoints->count;
- uint32_t i;
- NTSTATUS status;
- bool ok;
-
- for (i = 0; i < ep_count; i++) {
- struct dcerpc_binding *b;
- enum dcerpc_transport_t transport;
- char *endpoint = NULL;
-
- status = dcerpc_parse_binding(bvec->bindings,
- iface->endpoints->names[i],
- &b);
- if (!NT_STATUS_IS_OK(status)) {
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- transport = dcerpc_binding_get_transport(b);
- if (transport != NCALRPC) {
- talloc_free(b);
- continue;
- }
-
- status = dcerpc_binding_set_abstract_syntax(b, &iface->syntax_id);
- if (!NT_STATUS_IS_OK(status)) {
- talloc_free(b);
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- endpoint = talloc_asprintf(b,
- "%s/%s",
- lp_ncalrpc_dir(),
- name);
- if (endpoint == NULL) {
- talloc_free(b);
- return NT_STATUS_NO_MEMORY;
- }
-
- status = dcerpc_binding_set_string_option(b, "endpoint", endpoint);
- TALLOC_FREE(endpoint);
- if (!NT_STATUS_IS_OK(status)) {
- talloc_free(b);
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- ok = binding_vector_realloc(bvec);
- if (!ok) {
- talloc_free(b);
- return NT_STATUS_NO_MEMORY;
- }
-
- bvec->bindings[bvec->count] = b;
- bvec->count++;
-
- break;
- }
-
- return NT_STATUS_OK;
-}
-
-NTSTATUS dcerpc_binding_vector_replace_iface(const struct ndr_interface_table *iface,
- struct dcerpc_binding_vector *v)
-{
- uint32_t i;
-
- for (i = 0; i < v->count; i++) {
- struct dcerpc_binding *b = v->bindings[i];
- NTSTATUS status;
-
- status = dcerpc_binding_set_abstract_syntax(b,
- &iface->syntax_id);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
- }
-
- return NT_STATUS_OK;
-}
-
-struct dcerpc_binding_vector *dcerpc_binding_vector_dup(TALLOC_CTX *mem_ctx,
- const struct dcerpc_binding_vector *bvec)
-{
- struct dcerpc_binding_vector *v;
- uint32_t i;
-
- v = talloc(mem_ctx, struct dcerpc_binding_vector);
- if (v == NULL) {
- return NULL;
- }
-
- v->bindings = talloc_array(v, struct dcerpc_binding *, bvec->allocated);
- if (v->bindings == NULL) {
- talloc_free(v);
- return NULL;
- }
- v->allocated = bvec->allocated;
-
- for (i = 0; i < bvec->count; i++) {
- struct dcerpc_binding *b;
-
- b = dcerpc_binding_dup(v->bindings, bvec->bindings[i]);
- if (b == NULL) {
- talloc_free(v);
- return NULL;
- }
- v->bindings[i] = b;
- }
- v->count = bvec->count;
-
- return v;
-}
-
static NTSTATUS ep_register(TALLOC_CTX *mem_ctx,
struct messaging_context *msg_ctx,
- const struct ndr_interface_table *iface,
- const struct dcerpc_binding_vector *bind_vec,
+ struct dcesrv_context *dce_ctx,
+ const struct dcesrv_interface *iface,
const struct GUID *object_guid,
const char *annotation,
uint32_t replace,
struct pipe_auth_data *auth;
const char *ncalrpc_sock;
enum rpc_service_mode_e epmd_mode;
- struct epm_entry_t *entries;
- uint32_t num_ents, i;
+ struct epm_entry_t *entries = NULL;
+ uint32_t i = 0;
TALLOC_CTX *tmp_ctx;
uint32_t result = EPMAPPER_STATUS_OK;
NTSTATUS status;
+ struct dcesrv_endpoint *ep;
+ bool found = false;
if (iface == NULL) {
return NT_STATUS_INVALID_PARAMETER;
}
- if (bind_vec == NULL || bind_vec->count == 0) {
+ if (dce_ctx == NULL || iface == NULL) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ /* Check if interface is registered */
+ for (ep = dce_ctx->endpoint_list; ep; ep = ep->next) {
+ struct dcesrv_if_list *ifl;
+ for (ifl = ep->interface_list; ifl; ifl = ifl->next) {
+ if (ndr_syntax_id_equal(&ifl->iface->syntax_id,
+ &iface->syntax_id)) {
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ break;
+ }
+ }
+ if (!found) {
+ DBG_ERR("Failed to register interface '%s' in the endpoint "
+ "mapper as it is not registered in any endpoint\n",
+ iface->name);
return NT_STATUS_INVALID_PARAMETER;
}
goto done;
}
- num_ents = bind_vec->count;
- entries = talloc_array(tmp_ctx, struct epm_entry_t, num_ents);
-
- for (i = 0; i < num_ents; i++) {
+ for (i = 0, ep = dce_ctx->endpoint_list; ep; i++, ep = ep->next) {
struct dcerpc_binding *map_binding;
struct epm_twr_t *map_tower;
+ struct dcesrv_if_list *ifl;
+
+ for (ifl = ep->interface_list; ifl; ifl = ifl->next) {
+ if (!ndr_syntax_id_equal(&ifl->iface->syntax_id,
+ &iface->syntax_id)) {
+ continue;
+ }
+ }
+
+ /* The interface is registered in this endpoint, add it */
+ entries = talloc_realloc(tmp_ctx, entries, struct epm_entry_t,
+ i + 1);
+ if (entries == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
- map_binding = dcerpc_binding_dup(entries, bind_vec->bindings[i]);
+ map_binding = dcerpc_binding_dup(entries, ep->ep_description);
if (map_binding == NULL) {
status = NT_STATUS_NO_MEMORY;
goto done;
if (unregister) {
status = dcerpc_epm_Delete(h,
tmp_ctx,
- num_ents,
+ i,
entries,
&result);
} else {
status = dcerpc_epm_Insert(h,
tmp_ctx,
- num_ents,
+ i,
entries,
replace,
&result);
NTSTATUS dcerpc_ep_register(TALLOC_CTX *mem_ctx,
struct messaging_context *msg_ctx,
- const struct ndr_interface_table *iface,
- const struct dcerpc_binding_vector *bind_vec,
+ struct dcesrv_context *dce_ctx,
+ const struct dcesrv_interface *iface,
const struct GUID *object_guid,
const char *annotation,
struct dcerpc_binding_handle **ph)
{
return ep_register(mem_ctx,
msg_ctx,
+ dce_ctx,
iface,
- bind_vec,
object_guid,
annotation,
1,
NTSTATUS dcerpc_ep_register_noreplace(TALLOC_CTX *mem_ctx,
struct messaging_context *msg_ctx,
- const struct ndr_interface_table *iface,
- const struct dcerpc_binding_vector *bind_vec,
+ struct dcesrv_context *dce_ctx,
+ const struct dcesrv_interface *iface,
const struct GUID *object_guid,
const char *annotation,
struct dcerpc_binding_handle **ph)
{
return ep_register(mem_ctx,
msg_ctx,
+ dce_ctx,
iface,
- bind_vec,
object_guid,
annotation,
0,
}
NTSTATUS dcerpc_ep_unregister(struct messaging_context *msg_ctx,
- const struct ndr_interface_table *iface,
- const struct dcerpc_binding_vector *bind_vec,
+ struct dcesrv_context *dce_ctx,
+ const struct dcesrv_interface *iface,
const struct GUID *object_guid)
{
return ep_register(NULL,
msg_ctx,
+ dce_ctx,
iface,
- bind_vec,
object_guid,
NULL,
0,
#ifndef _DCERPC_EP_H_
#define _DCERPC_EP_H_
-struct dcerpc_binding_vector;
-
-/**
- * @brief Allocate a new binding vector.
- *
- * @param[in] mem_ctx The memory context to allocate the vector.
- *
- * @param[out] pbvec A pointer to store the binding vector.
- *
- * @return An NTSTATUS error code.
- */
-NTSTATUS dcerpc_binding_vector_new(TALLOC_CTX *mem_ctx,
- struct dcerpc_binding_vector **pbvec);
-
-/**
- * @brief Add default named pipes to the binding vector.
- *
- * @param[in] iface The rpc interface to add.
- *
- * @param[in] bvec The binding vector to add the interface.
- *
- * @return An NTSTATUS error code.
- */
-NTSTATUS dcerpc_binding_vector_add_np_default(const struct ndr_interface_table *iface,
- struct dcerpc_binding_vector *bvec);
-
-/**
- * @brief Add a tcpip port to a binding vector.
- *
- * @param[in] iface The rpc interface to add.
- *
- * @param[in] bvec The binding vector to add the interface, host and port.
- *
- * @param[in] host The ip address of the network interface bound.
- *
- * @param[in] port The port bound.
- *
- * @return An NTSTATUS error code.
- */
-NTSTATUS dcerpc_binding_vector_add_port(const struct ndr_interface_table *iface,
- struct dcerpc_binding_vector *bvec,
- const char *host,
- uint16_t port);
-
-/**
- * @brief Add a unix socket (ncalrpc) to a binding vector.
- *
- * @param[in] iface The rpc interface to add.
- *
- * @param[in] bvec The binding vector to add the interface, host and port.
- *
- * @param[in] name The name of the unix socket.
- *
- * @return An NTSTATUS error code.
- */
-NTSTATUS dcerpc_binding_vector_add_unix(const struct ndr_interface_table *iface,
- struct dcerpc_binding_vector *bvec,
- const char *name);
-
-/**
- * @brief Duplicate a dcerpc_binding_vector.
- *
- * @param[in] mem_ctx The memory context to create the duplicate on.
- *
- * @param[in] bvec The binding vector to duplicate.
- *
- * @return The duplicated binding vector or NULL on error.
- */
-struct dcerpc_binding_vector *dcerpc_binding_vector_dup(TALLOC_CTX *mem_ctx,
- const struct dcerpc_binding_vector *bvec);
-
-/**
- * @brief Replace the interface of the bindings in the vector.
- *
- * @param[in] iface The new interface identifier to use.
- *
- * @param[in] v The binding vector to change.
- *
- * @return An NTSTATUS error code.
- */
-NTSTATUS dcerpc_binding_vector_replace_iface(const struct ndr_interface_table *iface,
- struct dcerpc_binding_vector *v);
+struct dcesrv_context;
+struct dcesrv_interface;
/**
* @brief Adds server address information in the local endpoint map.
*
* @param[in] mem_ctx The memory context to use for the binding handle.
*
- * @param[in] iface The interface specification to register with the local
- * endpoint map.
+ * @param[in] dce_ctx The dcerpc server context
*
- * @param[in] binding The server binding handles over which the server can
- * receive remote procedure calls.
+ * @param[in] iface The interface to register in the endpoint mapper
*
* @param[in] object_guid The object GUID that the server offers. The server
* application constructs this vector.
*/
NTSTATUS dcerpc_ep_register(TALLOC_CTX *mem_ctx,
struct messaging_context *msg_ctx,
- const struct ndr_interface_table *iface,
- const struct dcerpc_binding_vector *bind_vec,
+ struct dcesrv_context *dce_ctx,
+ const struct dcesrv_interface *iface,
const struct GUID *object_guid,
const char *annotation,
struct dcerpc_binding_handle **ph);
NTSTATUS dcerpc_ep_register_noreplace(TALLOC_CTX *mem_ctx,
struct messaging_context *msg_ctx,
- const struct ndr_interface_table *iface,
- const struct dcerpc_binding_vector *bind_vec,
+ struct dcesrv_context *dce_ctx,
+ const struct dcesrv_interface *iface,
const struct GUID *object_guid,
const char *annotation,
struct dcerpc_binding_handle **ph);
NTSTATUS dcerpc_ep_unregister(struct messaging_context *msg_ctx,
- const struct ndr_interface_table *iface,
- const struct dcerpc_binding_vector *bind_vec,
+ struct dcesrv_context *dce_ctx,
+ const struct dcesrv_interface *iface,
const struct GUID *object_guid);
#endif /* _DCERPC_EP_H_ */
struct pf_listen_fd *listen_fd,
int *listen_fd_size)
{
- struct dcerpc_binding_vector *v = NULL;
- TALLOC_CTX *tmp_ctx;
NTSTATUS status;
int fd = -1;
int rc;
uint32_t i;
struct dcesrv_endpoint *e = NULL;
- tmp_ctx = talloc_stackframe();
- if (tmp_ctx == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
-
- status = dcerpc_binding_vector_new(tmp_ctx, &v);
- if (!NT_STATUS_IS_OK(status)) {
- DBG_ERR("Failed to create binding vector (%s)\n",
- nt_errstr(status));
- goto done;
- }
-
DBG_INFO("Initializing DCE/RPC connection endpoints\n");
for (e = dce_ctx->endpoint_list; e; e = e->next) {
msg_ctx,
dce_ctx,
e,
- v,
listen_fd,
listen_fd_size);
if (!NT_STATUS_IS_OK(status)) {
if (epm_mode != RPC_SERVICE_MODE_DISABLED &&
(lp_parm_bool(-1, "rpc_server", "register_embedded_np", false))) {
- status = dcerpc_binding_vector_add_np_default(&ndr_table_spoolss, v);
- if (!NT_STATUS_IS_OK(status)) {
- DBG_ERR("Failed to add np to binding vector (%s)\n",
- nt_errstr(status));
- goto done;
- }
-
- status = rpc_ep_register(ev_ctx, msg_ctx, &ndr_table_spoolss, v);
- if (!NT_STATUS_IS_OK(status)) {
- DBG_ERR("Failed to register spoolss endpoint! (%s)\n",
- nt_errstr(status));
- goto done;
+ for (e = dce_ctx->endpoint_list; e; e = e->next) {
+ struct dcesrv_if_list *ifl = NULL;
+ for (ifl = e->interface_list; ifl; ifl = ifl->next) {
+ status = rpc_ep_register(ev_ctx,
+ msg_ctx,
+ dce_ctx,
+ ifl->iface);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_ERR("Failed to register interface"
+ " in endpoint mapper: %s\n",
+ nt_errstr(status));
+ goto done;
+ }
+ }
}
}
close(fd);
}
- talloc_free(tmp_ctx);
return status;
}
msg_ctx,
dce_ctx,
e,
- NULL, /* binding vector */
term_fn,
NULL); /* termination_data */
if (!NT_STATUS_IS_OK(status)) {
msg_ctx,
dce_ctx,
e,
- NULL, /* binding vector */
NULL, /* termination function */
NULL); /* termination data */
if (!NT_STATUS_IS_OK(status)) {
struct pf_listen_fd *listen_fd,
int *listen_fd_size)
{
- struct dcerpc_binding_vector *v, *v_orig;
- TALLOC_CTX *tmp_ctx;
NTSTATUS status;
int i;
int fd = -1;
int rc;
struct dcesrv_endpoint *e = NULL;
- tmp_ctx = talloc_stackframe();
- if (tmp_ctx == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
-
- status = dcerpc_binding_vector_new(tmp_ctx, &v_orig);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
DBG_INFO("Initializing DCE/RPC connection endpoints\n");
for (e = dce_ctx->endpoint_list; e; e = e->next) {
msg_ctx,
dce_ctx,
e,
- v_orig,
listen_fd,
listen_fd_size);
if (!NT_STATUS_IS_OK(status)) {
}
}
- /* LSARPC */
- v = dcerpc_binding_vector_dup(tmp_ctx, v_orig);
- if (v == NULL) {
- goto done;
- }
-
- status = dcerpc_binding_vector_replace_iface(&ndr_table_lsarpc, v);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- status = dcerpc_binding_vector_add_np_default(&ndr_table_lsarpc, v);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- status = dcerpc_binding_vector_add_unix(&ndr_table_lsarpc, v, "lsarpc");
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- status = rpc_ep_register(ev_ctx, msg_ctx, &ndr_table_lsarpc, v);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- /* SAMR */
- v = dcerpc_binding_vector_dup(tmp_ctx, v_orig);
- if (v == NULL) {
- goto done;
- }
-
- status = dcerpc_binding_vector_replace_iface(&ndr_table_samr, v);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- status = dcerpc_binding_vector_add_np_default(&ndr_table_samr, v);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- status = dcerpc_binding_vector_add_unix(&ndr_table_lsarpc, v, "samr");
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- status = rpc_ep_register(ev_ctx, msg_ctx, &ndr_table_samr, v);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- /* NETLOGON */
- v = dcerpc_binding_vector_dup(tmp_ctx, v_orig);
- if (v == NULL) {
- goto done;
- }
-
- status = dcerpc_binding_vector_replace_iface(&ndr_table_netlogon, v);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- status = dcerpc_binding_vector_add_np_default(&ndr_table_netlogon, v);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- status = dcerpc_binding_vector_add_unix(&ndr_table_lsarpc, v, "netlogon");
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- status = rpc_ep_register(ev_ctx, msg_ctx, &ndr_table_netlogon, v);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
+ for (e = dce_ctx->endpoint_list; e; e = e->next) {
+ struct dcesrv_if_list *ifl = NULL;
+ for (ifl = e->interface_list; ifl; ifl = ifl->next) {
+ status = rpc_ep_register(ev_ctx,
+ msg_ctx,
+ dce_ctx,
+ ifl->iface);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_ERR("Failed to register interface in "
+ "endpoint mapper: %s",
+ nt_errstr(status));
+ goto done;
+ }
+ }
}
status = NT_STATUS_OK;
if (fd != -1) {
close(fd);
}
- talloc_free(tmp_ctx);
return status;
}
struct pf_listen_fd *listen_fd,
int *listen_fd_size)
{
- struct dcerpc_binding_vector *v, *v_orig;
- TALLOC_CTX *tmp_ctx;
NTSTATUS status;
int fd = -1;
int rc;
uint32_t i;
struct dcesrv_endpoint *e = NULL;
- tmp_ctx = talloc_stackframe();
- if (tmp_ctx == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
-
- status = dcerpc_binding_vector_new(tmp_ctx, &v_orig);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
DBG_INFO("Initializing DCE/RPC connection endpoints\n");
for (e = dce_ctx->endpoint_list; e; e = e->next) {
msg_ctx,
dce_ctx,
e,
- v_orig,
listen_fd,
listen_fd_size);
if (!NT_STATUS_IS_OK(status)) {
}
}
- /* mdssvc */
- v = dcerpc_binding_vector_dup(tmp_ctx, v_orig);
- if (v == NULL) {
- goto done;
- }
-
- status = dcerpc_binding_vector_replace_iface(&ndr_table_mdssvc, v);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- status = dcerpc_binding_vector_add_np_default(&ndr_table_mdssvc, v);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
-
- status = dcerpc_binding_vector_add_unix(&ndr_table_mdssvc, v, "mdssvc");
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
+ for (e = dce_ctx->endpoint_list; e; e = e->next) {
+ struct dcesrv_if_list *ifl = NULL;
+ for (ifl = e->interface_list; ifl; ifl = ifl->next) {
+ status = rpc_ep_register(ev_ctx,
+ msg_ctx,
+ dce_ctx,
+ ifl->iface);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_ERR("Failed to register interface in "
+ "endpoint mapper: %s",
+ nt_errstr(status));
+ goto done;
+ }
+ }
}
status = NT_STATUS_OK;
if (fd != -1) {
close(fd);
}
- talloc_free(tmp_ctx);
return status;
}
struct messaging_context *msg_ctx)
{
const struct ndr_interface_table *t = &ndr_table_mdssvc;
- const char *pipe_name = "mdssvc";
NTSTATUS status;
enum rpc_service_mode_e service_mode = rpc_service_mode(t->name);
enum rpc_daemon_type_e mdssvc_type = rpc_mdssd_daemon();
return false;
}
- if (external) {
- return true;
- }
-
- status = rpc_setup_embedded(ev_ctx, msg_ctx, t, pipe_name);
- if (!NT_STATUS_IS_OK(status)) {
- return false;
- }
-
return true;
}
#include "../librpc/gen_ndr/ndr_epmapper_c.h"
#include "librpc/rpc/dcerpc_ep.h"
+#include "librpc/rpc/dcesrv_core.h"
#include "rpc_server/rpc_ep_register.h"
#undef DBGC_CLASS
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 struct dcerpc_binding_vector *v,
+ struct dcesrv_context *dce_ctx,
+ const struct dcesrv_interface *iface,
struct dcerpc_binding_handle **pbh);
struct rpc_ep_register_state {
struct tevent_context *ev_ctx;
struct messaging_context *msg_ctx;
+ struct dcesrv_context *dce_ctx;
- const struct ndr_interface_table *iface;
- const struct dcerpc_binding_vector *vector;
+ const struct dcesrv_interface *iface;
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 struct dcerpc_binding_vector *v)
+ struct dcesrv_context *dce_ctx,
+ const struct dcesrv_interface *iface)
{
struct rpc_ep_register_state *state;
struct tevent_req *req;
- state = talloc(ev_ctx, struct rpc_ep_register_state);
+ /* Allocate under iface to stop the loop if the interface is
+ * removed from server */
+ state = talloc_zero(iface, struct rpc_ep_register_state);
if (state == NULL) {
return NT_STATUS_NO_MEMORY;
}
state->wait_time = 1;
state->ev_ctx = ev_ctx;
state->msg_ctx = msg_ctx;
+ state->dce_ctx = dce_ctx;
state->iface = iface;
- state->vector = dcerpc_binding_vector_dup(state, v);
- if (state->vector == NULL) {
- talloc_free(state);
- return NT_STATUS_NO_MEMORY;
- }
req = tevent_wakeup_send(state,
state->ev_ctx,
status = rpc_ep_try_register(state,
state->ev_ctx,
state->msg_ctx,
+ state->dce_ctx,
state->iface,
- state->vector,
&state->h);
if (NT_STATUS_IS_OK(status)) {
/* endpoint registered, monitor the connnection. */
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 struct dcerpc_binding_vector *v,
+ struct dcesrv_context *dce_ctx,
+ const struct dcesrv_interface *iface,
struct dcerpc_binding_handle **pbh)
{
NTSTATUS status;
status = dcerpc_ep_register(mem_ctx,
msg_ctx,
+ dce_ctx,
iface,
- v,
&iface->syntax_id.uuid,
iface->name,
pbh);
#ifndef _RPC_EP_REGISTER_H
#define _RPC_EP_REGISTER_H
-struct dcerpc_binding_vector;
+struct dcesrv_context;
+struct dcesrv_interface;
/**
* @brief Register an endpoint at the endpoint mapper.
*/
NTSTATUS rpc_ep_register(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx,
- const struct ndr_interface_table *iface,
- const struct dcerpc_binding_vector *v);
+ struct dcesrv_context *dce_ctx,
+ const struct dcesrv_interface *iface);
#endif /* _RPC_EP_REGISTER_H */
#include "includes.h"
#include "ntdomain.h"
-#include "../librpc/gen_ndr/ndr_epmapper_c.h"
-#include "../librpc/gen_ndr/srv_epmapper.h"
-#include "../librpc/gen_ndr/srv_srvsvc.h"
-#include "../librpc/gen_ndr/srv_winreg.h"
-#include "../librpc/gen_ndr/srv_dfs.h"
-#include "../librpc/gen_ndr/srv_dssetup.h"
-#include "../librpc/gen_ndr/srv_echo.h"
-#include "../librpc/gen_ndr/srv_eventlog.h"
-#include "../librpc/gen_ndr/srv_initshutdown.h"
-#include "../librpc/gen_ndr/srv_lsa.h"
-#include "../librpc/gen_ndr/srv_netlogon.h"
-#include "../librpc/gen_ndr/srv_ntsvcs.h"
-#include "../librpc/gen_ndr/srv_samr.h"
-#include "../librpc/gen_ndr/srv_spoolss.h"
-#include "../librpc/gen_ndr/srv_svcctl.h"
-#include "../librpc/gen_ndr/srv_wkssvc.h"
-
#include "librpc/gen_ndr/ndr_winreg_scompat.h"
#include "librpc/gen_ndr/ndr_srvsvc_scompat.h"
#include "librpc/gen_ndr/ndr_lsa_scompat.h"
/* Common routine for embedded RPC servers */
NTSTATUS rpc_setup_embedded(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx,
- const struct ndr_interface_table *t,
- const char *pipe_name)
+ struct dcesrv_context *dce_ctx,
+ const struct dcesrv_interface *iface)
{
- struct dcerpc_binding_vector *v;
enum rpc_service_mode_e epm_mode = rpc_epmapper_mode();
NTSTATUS status;
* they will all attempt to re-register. But we want to test
* the code for now, so it is enabled in on environment in
* make test */
- if (epm_mode != RPC_SERVICE_MODE_DISABLED &&
+ if (epm_mode != RPC_SERVICE_MODE_DISABLED &&
(lp_parm_bool(-1, "rpc_server", "register_embedded_np", false))) {
- status = dcerpc_binding_vector_new(talloc_tos(), &v);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
- status = dcerpc_binding_vector_add_np_default(t, v);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
- status = rpc_ep_register(ev_ctx,
- msg_ctx,
- t,
- v);
+ status = rpc_ep_register(ev_ctx, msg_ctx, dce_ctx, iface);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
struct messaging_context *msg_ctx,
struct dcesrv_context *dce_ctx,
struct dcesrv_endpoint *e,
- struct dcerpc_binding_vector *bvec,
struct pf_listen_fd *listen_fds,
int *listen_fds_size)
{
case NCACN_IP_TCP:
status = dcesrv_create_ncacn_ip_tcp_sockets(e,
- bvec,
listen_fds,
listen_fds_size);
break;
struct messaging_context *msg_ctx,
struct dcesrv_context *dce_ctx,
struct dcesrv_endpoint *e,
- struct dcerpc_binding_vector *bvec,
dcerpc_ncacn_termination_fn term_fn,
void *term_data)
{
msg_ctx,
dce_ctx,
e,
- bvec,
term_fn,
term_data);
break;
dce_ctx,
e,
NULL,
- NULL,
NULL);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- /* TODO If NCACN_NP register in endpoint mapper */
+ /* Register only NCACN_NP for embedded services */
+ if (transport == NCACN_NP) {
+ struct dcesrv_if_list *ifl = NULL;
+ for (ifl = e->interface_list; ifl; ifl = ifl->next) {
+ status = rpc_setup_embedded(ev_ctx,
+ msg_ctx,
+ dce_ctx,
+ ifl->iface);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_ERR("Failed to register embedded "
+ "interface in endpoint mapper "
+ ": %s", nt_errstr(status));
+ return status;
+ }
+ }
+ }
}
return NT_STATUS_OK;
static NTSTATUS rpc_setup_winreg(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
- const struct ndr_interface_table *t = &ndr_table_winreg;
- const char *pipe_name = "winreg";
NTSTATUS status;
enum rpc_service_mode_e service_mode;
const struct dcesrv_endpoint_server *ep_server = NULL;
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 NTSTATUS rpc_setup_srvsvc(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
- const struct ndr_interface_table *t = &ndr_table_srvsvc;
- const char *pipe_name = "srvsvc";
NTSTATUS status;
enum rpc_service_mode_e service_mode;
const struct dcesrv_endpoint_server *ep_server = NULL;
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 NTSTATUS rpc_setup_lsarpc(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
- const struct ndr_interface_table *t = &ndr_table_lsarpc;
- const char *pipe_name = "lsarpc";
enum rpc_daemon_type_e lsasd_type = rpc_lsasd_daemon();
NTSTATUS status;
enum rpc_service_mode_e service_mode;
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 NTSTATUS rpc_setup_samr(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
- const struct ndr_interface_table *t = &ndr_table_samr;
- const char *pipe_name = "samr";
enum rpc_daemon_type_e lsasd_type = rpc_lsasd_daemon();
NTSTATUS status;
enum rpc_service_mode_e service_mode;
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 NTSTATUS rpc_setup_netlogon(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
- const struct ndr_interface_table *t = &ndr_table_netlogon;
- const char *pipe_name = "netlogon";
enum rpc_daemon_type_e lsasd_type = rpc_lsasd_daemon();
NTSTATUS status;
enum rpc_service_mode_e service_mode;
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 NTSTATUS rpc_setup_netdfs(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
- const struct ndr_interface_table *t = &ndr_table_netdfs;
- const char *pipe_name = "netdfs";
NTSTATUS status;
enum rpc_service_mode_e service_mode;
const struct dcesrv_endpoint_server *ep_server = NULL;
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 NTSTATUS rpc_setup_rpcecho(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
- const struct ndr_interface_table *t = &ndr_table_rpcecho;
- const char *pipe_name = "rpcecho";
NTSTATUS status;
enum rpc_service_mode_e service_mode;
const struct dcesrv_endpoint_server *ep_server = NULL;
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;
}
#endif
static NTSTATUS rpc_setup_dssetup(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
- const struct ndr_interface_table *t = &ndr_table_dssetup;
- const char *pipe_name = "dssetup";
NTSTATUS status;
enum rpc_service_mode_e service_mode;
const struct dcesrv_endpoint_server *ep_server = NULL;
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 NTSTATUS rpc_setup_wkssvc(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
- const struct ndr_interface_table *t = &ndr_table_wkssvc;
- const char *pipe_name = "wkssvc";
NTSTATUS status;
enum rpc_service_mode_e service_mode;
const struct dcesrv_endpoint_server *ep_server = NULL;
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 NTSTATUS rpc_setup_spoolss(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
- const struct ndr_interface_table *t = &ndr_table_spoolss;
enum rpc_daemon_type_e spoolss_type = rpc_spoolss_daemon();
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
enum rpc_service_mode_e service_mode;
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 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";
NTSTATUS status;
enum rpc_service_mode_e service_mode;
const struct dcesrv_endpoint_server *ep_server = NULL;
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 NTSTATUS rpc_setup_ntsvcs(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
- const struct ndr_interface_table *t = &ndr_table_ntsvcs;
NTSTATUS status;
enum rpc_service_mode_e service_mode;
const struct dcesrv_endpoint_server *ep_server = NULL;
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 NTSTATUS rpc_setup_eventlog(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
- const struct ndr_interface_table *t = &ndr_table_eventlog;
NTSTATUS status;
enum rpc_service_mode_e service_mode;
const struct dcesrv_endpoint_server *ep_server = NULL;
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 NTSTATUS rpc_setup_initshutdown(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
- const struct ndr_interface_table *t = &ndr_table_initshutdown;
NTSTATUS status;
enum rpc_service_mode_e service_mode;
const struct dcesrv_endpoint_server *ep_server = NULL;
return status;
}
- status = rpc_setup_embedded(ev_ctx, msg_ctx, t, NULL);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
return NT_STATUS_OK;
}
#include "rpc_server/rpc_server.h"
struct pf_listen_fd;
-struct dcerpc_binding_vector;
NTSTATUS dcesrv_init(TALLOC_CTX *mem_ctx,
struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx,
struct dcesrv_context *dce_ctx,
struct dcesrv_endpoint *e,
- struct dcerpc_binding_vector *bvec,
dcerpc_ncacn_termination_fn term_fn,
void *term_data);
struct messaging_context *msg_ctx,
struct dcesrv_context *dce_ctx,
struct dcesrv_endpoint *e,
- struct dcerpc_binding_vector *bvec,
struct pf_listen_fd *listen_fds,
int *listen_fds_size);
NTSTATUS rpc_setup_embedded(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx,
- const struct ndr_interface_table *t,
- const char *pipe_name);
+ struct dcesrv_context *dce_ctx,
+ const struct dcesrv_interface *iface);
#endif /* _RPC_EP_SETUP_H */
#define DBGC_CLASS DBGC_RPC_SRV
NTSTATUS dcesrv_create_ncacn_ip_tcp_sockets(struct dcesrv_endpoint *e,
- struct dcerpc_binding_vector *bvec,
struct pf_listen_fd *listen_fd,
int *listen_fd_size)
{
TALLOC_CTX *tmp_ctx;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
- int rc;
uint16_t port = 0;
char port_str[6];
const char *endpoint = NULL;
for (i = 0; i < num_ifs; i++) {
const struct sockaddr_storage *ifss =
iface_n_sockaddr_storage(i);
- struct tsocket_address *bind_addr;
- const char *addr;
int fd = -1;
status = dcesrv_create_ncacn_ip_tcp_socket(ifss,
listen_fd[*listen_fd_size].fd = fd;
listen_fd[*listen_fd_size].fd_data = e;
(*listen_fd_size)++;
-
- if (bvec != NULL) {
- struct dcesrv_if_list *if_list = NULL;
-
- rc = tsocket_address_bsd_from_sockaddr(tmp_ctx,
- (const struct sockaddr *)ifss,
- sizeof(struct sockaddr_storage),
- &bind_addr);
- if (rc < 0) {
- close(fd);
- status = NT_STATUS_NO_MEMORY;
- goto done;
- }
-
- addr = tsocket_address_inet_addr_string(bind_addr,
- tmp_ctx);
- if (addr == NULL) {
- close(fd);
- status = NT_STATUS_NO_MEMORY;
- goto done;
- }
-
- for (if_list = e->interface_list; if_list; if_list = if_list->next) {
- const struct ndr_interface_table *iface = NULL;
- iface = ndr_table_by_syntax(&if_list->iface->syntax_id);
- if (iface != NULL) {
- status = dcerpc_binding_vector_add_port(iface,
- bvec,
- addr,
- port);
- if (!NT_STATUS_IS_OK(status)) {
- close(fd);
- goto done;
- }
- }
- }
- }
}
} else {
const char *sock_addr;
listen_fd[*listen_fd_size].fd = fd;
listen_fd[*listen_fd_size].fd_data = e;
(*listen_fd_size)++;
-
- if (bvec != NULL) {
- struct dcesrv_if_list *if_list = NULL;
-
- for (if_list = e->interface_list; if_list; if_list = if_list->next) {
- const struct ndr_interface_table *iface = NULL;
- iface = ndr_table_by_syntax(&if_list->iface->syntax_id);
- if (iface != NULL) {
- status = dcerpc_binding_vector_add_port(iface,
- bvec,
- sock_tok,
- port);
- if (!NT_STATUS_IS_OK(status)) {
- close(fd);
- goto done;
- }
- }
- }
- }
}
}
struct messaging_context *msg_ctx,
struct dcesrv_context *dce_ctx,
struct dcesrv_endpoint *e,
- struct dcerpc_binding_vector *bvec,
dcerpc_ncacn_termination_fn t_fn,
void *t_data)
{
TALLOC_CTX *tmp_ctx;
NTSTATUS status;
- int rc;
tmp_ctx = talloc_stackframe();
if (tmp_ctx == NULL) {
for (i = 0; i < num_ifs; i++) {
const struct sockaddr_storage *ifss =
iface_n_sockaddr_storage(i);
- struct tsocket_address *bind_addr;
- const char *addr;
- const char *endpoint;
- uint16_t port = 0;
status = dcesrv_setup_ncacn_ip_tcp_socket(ev_ctx,
msg_ctx,
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
-
- if (bvec != NULL) {
- struct dcesrv_if_list *if_list = NULL;
-
- rc = tsocket_address_bsd_from_sockaddr(tmp_ctx,
- (const struct sockaddr*)ifss,
- sizeof(struct sockaddr_storage),
- &bind_addr);
- if (rc < 0) {
- status = NT_STATUS_NO_MEMORY;
- goto done;
- }
-
- addr = tsocket_address_inet_addr_string(bind_addr,
- tmp_ctx);
- if (addr == NULL) {
- status = NT_STATUS_NO_MEMORY;
- goto done;
- }
-
- endpoint = dcerpc_binding_get_string_option(e->ep_description,
- "endpoint");
- if (endpoint != NULL) {
- port = atoi(endpoint);
- }
-
- for (if_list = e->interface_list; if_list; if_list = if_list->next) {
- const struct ndr_interface_table *iface = NULL;
- iface = ndr_table_by_syntax(&if_list->iface->syntax_id);
- if (iface != NULL) {
- status = dcerpc_binding_vector_add_port(iface,
- bvec,
- addr,
- port);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
- }
- }
- }
}
} else {
const char *sock_addr;
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
-
- if (bvec != NULL) {
- struct dcesrv_if_list *if_list = NULL;
- const char *endpoint;
- uint16_t port = 0;
-
- endpoint = dcerpc_binding_get_string_option(e->ep_description,
- "endpoint");
- if (endpoint != NULL) {
- port = atoi(endpoint);
- }
-
- for (if_list = e->interface_list; if_list; if_list = if_list->next) {
- const struct ndr_interface_table *iface = NULL;
- iface = ndr_table_by_syntax(&if_list->iface->syntax_id);
- if (iface != NULL) {
- status = dcerpc_binding_vector_add_port(iface,
- bvec,
- sock_tok,
- port);
- if (!NT_STATUS_IS_OK(status)) {
- goto done;
- }
- }
- }
- }
}
}
struct pf_listen_fd;
NTSTATUS dcesrv_create_ncacn_ip_tcp_sockets(struct dcesrv_endpoint *e,
- struct dcerpc_binding_vector *bvec,
struct pf_listen_fd *listen_fd,
int *listen_fd_size);
struct messaging_context *msg_ctx,
struct dcesrv_context *dce_ctx,
struct dcesrv_endpoint *e,
- struct dcerpc_binding_vector *bvec,
dcerpc_ncacn_termination_fn t_fn,
void *t_data);