1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

librpc: Simplify find_interface_by_binding()

Use find_interface_by_syntax_id() instead of duplicating the loop.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jan 28 18:03:53 UTC 2021 on sn-devel-184
This commit is contained in:
Volker Lendecke 2021-01-27 14:00:06 +01:00
parent ecd95fc55e
commit e14fc159a2

View File

@ -105,16 +105,6 @@ static struct dcesrv_connection_context *dcesrv_find_context(struct dcesrv_conne
return NULL;
}
/*
see if a uuid and if_version match to an interface
*/
static bool interface_match(const struct dcesrv_interface *if1,
const struct dcesrv_interface *if2)
{
return (if1->syntax_id.if_version == if2->syntax_id.if_version &&
GUID_equal(&if1->syntax_id.uuid, &if2->syntax_id.uuid));
}
/*
find the interface operations on any endpoint with this binding
*/
@ -125,11 +115,12 @@ static const struct dcesrv_interface *find_interface_by_binding(struct dcesrv_co
struct dcesrv_endpoint *ep;
for (ep=dce_ctx->endpoint_list; ep; ep=ep->next) {
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;
}
const struct dcesrv_interface *ret = NULL;
ret = find_interface_by_syntax_id(
ep, &iface->syntax_id);
if (ret != NULL) {
return ret;
}
}
}