s3-rpc: use dcerpc_default_transport_endpoint function.
authorGünther Deschner <gd@samba.org>
Wed, 18 Sep 2013 08:59:14 +0000 (10:59 +0200)
committerGünther Deschner <gd@samba.org>
Fri, 20 Sep 2013 11:07:30 +0000 (13:07 +0200)
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/rpc_client/rpc_transport_np.c
source3/rpc_server/rpc_ncacn_np.c
source3/rpc_server/srv_pipe.c

index 804db580b14ea61a8005acc05be6ddf17d3c4d02..961749436cbe417818b500e57351512b90c31c51 100644 (file)
@@ -21,6 +21,7 @@
 #include "../lib/util/tevent_ntstatus.h"
 #include "rpc_client/rpc_transport.h"
 #include "libsmb/cli_np_tstream.h"
+#include "librpc/ndr/ndr_table.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_RPC_CLI
@@ -47,7 +48,7 @@ struct tevent_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-       pipe_name = get_pipe_name_from_syntax(state, &table->syntax_id);
+       pipe_name = dcerpc_default_transport_endpoint(mem_ctx, NCACN_NP, table);
        if (tevent_req_nomem(pipe_name, req)) {
                return tevent_req_post(req, ev);
        }
index 60f72a59c1246a2e566d27c3bfe1f0c326a05aa2..9c1599ecf4adf0973aeeee65c0057fe6de88c2d2 100644 (file)
@@ -36,6 +36,7 @@
 #include "../lib/util/tevent_ntstatus.h"
 #include "rpc_contexts.h"
 #include "rpc_server/rpc_config.h"
+#include "librpc/ndr/ndr_table.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_RPC_SRV
@@ -54,8 +55,15 @@ struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
        struct pipe_rpc_fns *context_fns;
        const char *pipe_name;
        int ret;
+       const struct ndr_interface_table *table;
 
-       pipe_name = get_pipe_name_from_syntax(talloc_tos(), syntax);
+       table = ndr_table_by_uuid(&syntax->uuid);
+       if (table == NULL) {
+               DEBUG(0,("unknown interface\n"));
+               return NULL;
+       }
+
+       pipe_name = dcerpc_default_transport_endpoint(mem_ctx, NCACN_NP, table);
 
        DEBUG(4,("Create pipe requested %s\n", pipe_name));
 
@@ -783,7 +791,7 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
-       pipe_name = get_pipe_name_from_syntax(tmp_ctx, &table->syntax_id);
+       pipe_name = dcerpc_default_transport_endpoint(mem_ctx, NCACN_NP, table);
        if (pipe_name == NULL) {
                status = NT_STATUS_INVALID_PARAMETER;
                goto done;
index 08074057432cfbf2fb898b9958f15291b0328b0c..f92de3b594e70f86b9efeee61180b13ab73ade00 100644 (file)
@@ -552,6 +552,7 @@ static bool api_pipe_bind_req(struct pipes_struct *p,
        struct dcerpc_ack_ctx bind_ack_ctx;
        DATA_BLOB auth_resp = data_blob_null;
        DATA_BLOB auth_blob = data_blob_null;
+       const struct ndr_interface_table *table;
 
        /* No rebinds on a bound pipe - use alter context. */
        if (p->pipe_bound) {
@@ -569,15 +570,21 @@ static bool api_pipe_bind_req(struct pipes_struct *p,
         * that this is a pipe name we support.
         */
        id = pkt->u.bind.ctx_list[0].abstract_syntax;
+
+       table = ndr_table_by_uuid(&id.uuid);
+       if (table == NULL) {
+               DEBUG(0,("unknown interface\n"));
+               return false;
+       }
+
        if (rpc_srv_pipe_exists_by_id(&id)) {
                DEBUG(3, ("api_pipe_bind_req: %s -> %s rpc service\n",
                          rpc_srv_get_pipe_cli_name(&id),
                          rpc_srv_get_pipe_srv_name(&id)));
        } else {
                status = smb_probe_module(
-                       "rpc", get_pipe_name_from_syntax(
-                               talloc_tos(),
-                               &id));
+                       "rpc", dcerpc_default_transport_endpoint(pkt,
+                               NCACN_NP, table));
 
                if (NT_STATUS_IS_ERR(status)) {
                        DEBUG(3,("api_pipe_bind_req: Unknown rpc service name "
@@ -589,8 +596,8 @@ static bool api_pipe_bind_req(struct pipes_struct *p,
                }
 
                if (rpc_srv_get_pipe_interface_by_cli_name(
-                               get_pipe_name_from_syntax(talloc_tos(),
-                                                         &id),
+                               dcerpc_default_transport_endpoint(pkt,
+                                       NCACN_NP, table),
                                &id)) {
                        DEBUG(3, ("api_pipe_bind_req: %s -> %s rpc service\n",
                                  rpc_srv_get_pipe_cli_name(&id),
@@ -1240,16 +1247,23 @@ static bool api_rpcTNP(struct pipes_struct *p, struct ncacn_packet *pkt,
 {
        int fn_num;
        uint32_t offset1;
+       const struct ndr_interface_table *table;
 
        /* interpret the command */
        DEBUG(4,("api_rpcTNP: %s op 0x%x - ",
                 ndr_interface_name(&syntax->uuid, syntax->if_version),
                 pkt->u.request.opnum));
 
+       table = ndr_table_by_uuid(&syntax->uuid);
+       if (table == NULL) {
+               DEBUG(0,("unknown interface\n"));
+               return false;
+       }
+
        if (DEBUGLEVEL >= 50) {
                fstring name;
                slprintf(name, sizeof(name)-1, "in_%s",
-                        get_pipe_name_from_syntax(talloc_tos(), syntax));
+                        dcerpc_default_transport_endpoint(pkt, NCACN_NP, table));
                dump_pdu_region(name, pkt->u.request.opnum,
                                &p->in_data.data, 0,
                                p->in_data.data.length);
@@ -1298,7 +1312,7 @@ static bool api_rpcTNP(struct pipes_struct *p, struct ncacn_packet *pkt,
        if (DEBUGLEVEL >= 50) {
                fstring name;
                slprintf(name, sizeof(name)-1, "out_%s",
-                        get_pipe_name_from_syntax(talloc_tos(), syntax));
+                        dcerpc_default_transport_endpoint(pkt, NCACN_NP, table));
                dump_pdu_region(name, pkt->u.request.opnum,
                                &p->out_data.rdata, offset1,
                                p->out_data.rdata.length);