librpc: Convert find_interface_by_uuid to search by syntax_id
authorVolker Lendecke <vl@samba.org>
Wed, 27 Jan 2021 12:51:33 +0000 (13:51 +0100)
committerVolker Lendecke <vl@samba.org>
Thu, 28 Jan 2021 16:58:35 +0000 (16:58 +0000)
All callers manually dissected the syntax id for this API.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
librpc/rpc/dcesrv_core.c
librpc/rpc/dcesrv_core.h
source3/rpc_server/rpc_ncacn_np.c
source3/winbindd/winbindd_dual_ndr.c

index 0ef85e10df32b87b1cc920e86f735444f5cb4cf0..52008227242bbb904b03a95818f839faa596ea8a 100644 (file)
@@ -149,12 +149,16 @@ static bool interface_match_by_uuid(const struct dcesrv_interface *iface,
 /*
   find the interface operations on an endpoint by uuid
 */
-_PUBLIC_ const struct dcesrv_interface *find_interface_by_uuid(const struct dcesrv_endpoint *endpoint,
-                                                     const struct GUID *uuid, uint32_t if_version)
+_PUBLIC_ const struct dcesrv_interface *find_interface_by_syntax_id(
+       const struct dcesrv_endpoint *endpoint,
+       const struct ndr_syntax_id *interface)
 {
        struct dcesrv_if_list *ifl;
        for (ifl=endpoint->interface_list; ifl; ifl=ifl->next) {
-               if (interface_match_by_uuid(ifl->iface, uuid, if_version)) {
+               if (interface_match_by_uuid(
+                           ifl->iface,
+                           &interface->uuid,
+                           interface->if_version)) {
                        return ifl->iface;
                }
        }
@@ -1318,10 +1322,8 @@ static NTSTATUS dcesrv_check_or_create_context(struct dcesrv_call_state *call,
                                bool validate_only,
                                const struct ndr_syntax_id *supported_transfer)
 {
-       uint32_t if_version;
        struct dcesrv_connection_context *context;
        const struct dcesrv_interface *iface;
-       struct GUID uuid;
        NTSTATUS status;
        const struct ndr_syntax_id *selected_transfer = NULL;
        size_t i;
@@ -1357,10 +1359,8 @@ static NTSTATUS dcesrv_check_or_create_context(struct dcesrv_call_state *call,
        ack->result = DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION;
        ack->reason.value = DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED;
 
-       if_version = ctx->abstract_syntax.if_version;
-       uuid = ctx->abstract_syntax.uuid;
-
-       iface = find_interface_by_uuid(call->conn->endpoint, &uuid, if_version);
+       iface = find_interface_by_syntax_id(
+               call->conn->endpoint, &ctx->abstract_syntax);
        if (iface == NULL) {
                struct ndr_syntax_id_buf buf;
                DBG_NOTICE("Request for unknown dcerpc interface %s\n",
index 41ae622ecfe6974f23a6871c2c0d7ab5fca83a55..333671cc3e3dd7a5817fbd4a301aa2a0fbfb1900 100644 (file)
@@ -626,9 +626,9 @@ _PUBLIC_ NTSTATUS dcesrv_connection_loop_start(struct dcesrv_connection *conn);
 
 _PUBLIC_ NTSTATUS dcesrv_call_dispatch_local(struct dcesrv_call_state *call);
 
-_PUBLIC_ const struct dcesrv_interface *find_interface_by_uuid(
-                               const struct dcesrv_endpoint *endpoint,
-                               const struct GUID *uuid, uint32_t if_version);
+_PUBLIC_ const struct dcesrv_interface *find_interface_by_syntax_id(
+       const struct dcesrv_endpoint *endpoint,
+       const struct ndr_syntax_id *interface);
 
 void _dcesrv_save_ndr_fuzz_seed(DATA_BLOB call_blob,
                                struct dcesrv_call_state *call,
index 9ba271c2479ade6f7f99e204dee57003feb8583b..569304b3467e3338c6fa0ed19424ae2442f00c5b 100644 (file)
@@ -401,9 +401,8 @@ static NTSTATUS make_internal_dcesrv_connection(TALLOC_CTX *mem_ctx,
        context->conn = conn;
        context->context_id = 0;
        context->transfer_syntax = *(conn->preferred_transfer);
-       context->iface = find_interface_by_uuid(conn->endpoint,
-                                       &ndr_table->syntax_id.uuid,
-                                       ndr_table->syntax_id.if_version);
+       context->iface = find_interface_by_syntax_id(
+               conn->endpoint, &ndr_table->syntax_id);
        if (context->iface == NULL) {
                status = NT_STATUS_RPC_INTERFACE_NOT_FOUND;
                goto fail;
index f0b8588f6a01aeaa6eb4de76f18ddc706349b83d..0cc86faeab62ff2e4c3c81b35d3740a56173e2df 100644 (file)
@@ -433,9 +433,8 @@ static NTSTATUS make_internal_dcesrv_connection(TALLOC_CTX *mem_ctx,
        context->conn = conn;
        context->context_id = 0;
        context->transfer_syntax = *(conn->preferred_transfer);
-       context->iface = find_interface_by_uuid(conn->endpoint,
-                                       &ndr_table->syntax_id.uuid,
-                                       ndr_table->syntax_id.if_version);
+       context->iface = find_interface_by_syntax_id(
+               conn->endpoint, &ndr_table->syntax_id);
        if (context->iface == NULL) {
                status = NT_STATUS_RPC_INTERFACE_NOT_FOUND;
                goto fail;