From: Volker Lendecke Date: Wed, 27 Jan 2021 13:00:06 +0000 (+0100) Subject: librpc: Simplify find_interface_by_binding() X-Git-Tag: tevent-0.11.0~1867 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e14fc159a2fab69612c6922406a9614a7c2d55ee;p=thirdparty%2Fsamba.git librpc: Simplify find_interface_by_binding() Use find_interface_by_syntax_id() instead of duplicating the loop. Signed-off-by: Volker Lendecke Reviewed-by: Samuel Cabrero Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Thu Jan 28 18:03:53 UTC 2021 on sn-devel-184 --- diff --git a/librpc/rpc/dcesrv_core.c b/librpc/rpc/dcesrv_core.c index 5db37ca6716..a51467c87c0 100644 --- a/librpc/rpc/dcesrv_core.c +++ b/librpc/rpc/dcesrv_core.c @@ -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; } } }