diff options
author | Günther Deschner <gd@samba.org> | 2013-09-18 10:59:14 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2013-09-20 13:07:30 +0200 |
commit | b73e2d927b2221cb3fde8776789c8ca085cf2b8f (patch) | |
tree | c82074a3f7ef0b8b669d7d0b466d4c672adacef7 | |
parent | 40ee3d8a5f7439b90f1ebf5e40535fad51038fe6 (diff) | |
download | samba-b73e2d927b2221cb3fde8776789c8ca085cf2b8f.tar.gz samba-b73e2d927b2221cb3fde8776789c8ca085cf2b8f.tar.bz2 samba-b73e2d927b2221cb3fde8776789c8ca085cf2b8f.zip |
s3-rpc: use dcerpc_default_transport_endpoint function.
Guenther
Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r-- | source3/rpc_client/rpc_transport_np.c | 3 | ||||
-rw-r--r-- | source3/rpc_server/rpc_ncacn_np.c | 12 | ||||
-rw-r--r-- | source3/rpc_server/srv_pipe.c | 28 |
3 files changed, 33 insertions, 10 deletions
diff --git a/source3/rpc_client/rpc_transport_np.c b/source3/rpc_client/rpc_transport_np.c index 804db580b1..961749436c 100644 --- a/source3/rpc_client/rpc_transport_np.c +++ b/source3/rpc_client/rpc_transport_np.c @@ -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); } diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c index 60f72a59c1..9c1599ecf4 100644 --- a/source3/rpc_server/rpc_ncacn_np.c +++ b/source3/rpc_server/rpc_ncacn_np.c @@ -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; diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 0807405743..f92de3b594 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -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); |