mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
librpc:core: Allocate struct dcesrv_interface with talloc
The S3 implementation needs to reinit the dcesrv_context and free the endpoints list with their registered interfaces. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
52727543b0
commit
6a6546b565
@ -122,8 +122,8 @@ static const struct dcesrv_interface *find_interface_by_binding(struct dcesrv_co
|
||||
if (endpoints_match(ep->ep_description, binding)) {
|
||||
struct dcesrv_if_list *ifl;
|
||||
for (ifl=ep->interface_list; ifl; ifl=ifl->next) {
|
||||
if (interface_match(&(ifl->iface), iface)) {
|
||||
return &(ifl->iface);
|
||||
if (interface_match(ifl->iface, iface)) {
|
||||
return ifl->iface;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -149,8 +149,8 @@ const struct dcesrv_interface *find_interface_by_uuid(const struct dcesrv_endpoi
|
||||
{
|
||||
struct dcesrv_if_list *ifl;
|
||||
for (ifl=endpoint->interface_list; ifl; ifl=ifl->next) {
|
||||
if (interface_match_by_uuid(&(ifl->iface), uuid, if_version)) {
|
||||
return &(ifl->iface);
|
||||
if (interface_match_by_uuid(ifl->iface, uuid, if_version)) {
|
||||
return ifl->iface;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@ -322,7 +322,13 @@ _PUBLIC_ NTSTATUS dcesrv_interface_register(struct dcesrv_context *dce_ctx,
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
ifl->iface = dcesrv_get_mgmt_interface();
|
||||
ifl->iface = talloc_memdup(ifl,
|
||||
dcesrv_get_mgmt_interface(),
|
||||
sizeof(struct dcesrv_interface));
|
||||
if (ifl->iface == NULL) {
|
||||
talloc_free(ep);
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
DLIST_ADD(ep->interface_list, ifl);
|
||||
}
|
||||
@ -346,7 +352,13 @@ _PUBLIC_ NTSTATUS dcesrv_interface_register(struct dcesrv_context *dce_ctx,
|
||||
}
|
||||
|
||||
/* copy the given interface struct to the one on the endpoints interface list */
|
||||
memcpy(&(ifl->iface),iface, sizeof(struct dcesrv_interface));
|
||||
ifl->iface = talloc_memdup(ifl,
|
||||
iface,
|
||||
sizeof(struct dcesrv_interface));
|
||||
if (ifl->iface == NULL) {
|
||||
talloc_free(ep);
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
/* if we have a security descriptor given,
|
||||
* we should see if we can set it up on the endpoint
|
||||
|
@ -404,7 +404,7 @@ struct dcesrv_context {
|
||||
/* the list of interfaces available on this endpoint */
|
||||
struct dcesrv_if_list {
|
||||
struct dcesrv_if_list *next, *prev;
|
||||
struct dcesrv_interface iface;
|
||||
struct dcesrv_interface *iface;
|
||||
} *interface_list;
|
||||
|
||||
/*
|
||||
|
@ -58,7 +58,7 @@ static WERROR dcesrv_mgmt_inq_if_ids(struct dcesrv_call_state *dce_call, TALLOC_
|
||||
for (l = ep->interface_list; l; l = l->next) {
|
||||
vector->count++;
|
||||
vector->if_id = talloc_realloc(mem_ctx, vector->if_id, struct ndr_syntax_id_p, vector->count);
|
||||
vector->if_id[vector->count-1].id = &l->iface.syntax_id;
|
||||
vector->if_id[vector->count-1].id = &l->iface->syntax_id;
|
||||
}
|
||||
return WERR_OK;
|
||||
}
|
||||
@ -119,7 +119,7 @@ static WERROR dcesrv_mgmt_inq_princ_name(struct dcesrv_call_state *dce_call, TAL
|
||||
/* include the generated boilerplate */
|
||||
#include "librpc/gen_ndr/ndr_mgmt_s.c"
|
||||
|
||||
const struct dcesrv_interface dcesrv_get_mgmt_interface(void)
|
||||
const struct dcesrv_interface *dcesrv_get_mgmt_interface(void)
|
||||
{
|
||||
return dcesrv_mgmt_interface;
|
||||
return &dcesrv_mgmt_interface;
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ static NTSTATUS add_socket_rpc_tcp_iface(struct dcesrv_context *dce_ctx,
|
||||
DEBUG(0,("service_setup_stream_socket(address=%s,port=%u) for ",
|
||||
address, port));
|
||||
for (iface = e->interface_list; iface; iface = iface->next) {
|
||||
DEBUGADD(0, ("%s ", iface->iface.name));
|
||||
DEBUGADD(0, ("%s ", iface->iface->name));
|
||||
}
|
||||
DEBUGADD(0, ("failed - %s\n",
|
||||
nt_errstr(status)));
|
||||
@ -528,7 +528,7 @@ static NTSTATUS add_socket_rpc_tcp_iface(struct dcesrv_context *dce_ctx,
|
||||
DEBUG(4,("Successfully listening on ncacn_ip_tcp endpoint [%s]:[%s] for ",
|
||||
address, port_str));
|
||||
for (iface = e->interface_list; iface; iface = iface->next) {
|
||||
DEBUGADD(4, ("%s ", iface->iface.name));
|
||||
DEBUGADD(4, ("%s ", iface->iface->name));
|
||||
}
|
||||
DEBUGADD(4, ("\n"));
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ static uint32_t build_ep_list(TALLOC_CTX *mem_ctx,
|
||||
if (!*eps) {
|
||||
return 0;
|
||||
}
|
||||
(*eps)[total].name = iface->iface.name;
|
||||
(*eps)[total].name = iface->iface->name;
|
||||
|
||||
description = dcerpc_binding_dup(*eps, d->ep_description);
|
||||
if (description == NULL) {
|
||||
@ -77,7 +77,7 @@ static uint32_t build_ep_list(TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
|
||||
status = dcerpc_binding_set_abstract_syntax(description,
|
||||
&iface->iface.syntax_id);
|
||||
&iface->iface->syntax_id);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return 0;
|
||||
}
|
||||
@ -85,8 +85,9 @@ static uint32_t build_ep_list(TALLOC_CTX *mem_ctx,
|
||||
status = dcerpc_binding_build_tower(*eps, description, &(*eps)[total].ep);
|
||||
TALLOC_FREE(description);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(1, ("Unable to build tower for %s - %s\n",
|
||||
iface->iface.name, nt_errstr(status)));
|
||||
DBG_ERR("Unable to build tower for %s - %s\n",
|
||||
iface->iface->name,
|
||||
nt_errstr(status));
|
||||
continue;
|
||||
}
|
||||
total++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user