]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
librpc: Simplify find_interface_by_binding()
authorVolker Lendecke <vl@samba.org>
Wed, 27 Jan 2021 13:00:06 +0000 (14:00 +0100)
committerVolker Lendecke <vl@samba.org>
Thu, 28 Jan 2021 18:03:53 +0000 (18:03 +0000)
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

librpc/rpc/dcesrv_core.c

index 5db37ca6716bbfb5e3728891f4b716b048ce7be3..a51467c87c054c341a9562c8117468e277ecd774 100644 (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;
                        }
                }
        }