summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--librpc/rpc/binding.c20
-rw-r--r--source3/include/proto.h3
-rw-r--r--source4/librpc/rpc/dcerpc.h3
3 files changed, 18 insertions, 8 deletions
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c
index dff2426b48..ba992399cd 100644
--- a/librpc/rpc/binding.c
+++ b/librpc/rpc/binding.c
@@ -176,11 +176,7 @@ _PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_bi
const char *t_name = NULL;
if (b->transport != NCA_UNKNOWN) {
- for (i=0;i<ARRAY_SIZE(transports);i++) {
- if (transports[i].transport == b->transport) {
- t_name = transports[i].name;
- }
- }
+ t_name = derpc_transport_string_by_transport(b->transport);
if (!t_name) {
return NULL;
}
@@ -572,7 +568,7 @@ enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot)
return (unsigned int)-1;
}
-_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(struct epm_tower *tower)
+_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(const struct epm_tower *tower)
{
int i;
@@ -598,6 +594,18 @@ _PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(struct epm_tower *tow
return (unsigned int)-1;
}
+_PUBLIC_ const char *derpc_transport_string_by_transport(enum dcerpc_transport_t t)
+{
+ int i;
+
+ for (i=0; i<ARRAY_SIZE(transports); i++) {
+ if (t == transports[i].transport) {
+ return transports[i].name;
+ }
+ }
+ return NULL;
+}
+
_PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
struct epm_tower *tower,
struct dcerpc_binding **b_out)
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 2a7547334c..e65369e421 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2292,7 +2292,8 @@ _PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(const struct epm_floor *epm_floor,
struct ndr_syntax_id *syntax);
const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot);
-_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(struct epm_tower *tower);
+_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(const struct epm_tower *tower);
+_PUBLIC_ const char *derpc_transport_string_by_transport(enum dcerpc_transport_t t);
_PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
struct epm_tower *tower,
struct dcerpc_binding **b_out);
diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h
index 248b4f91be..b2e3a8ce69 100644
--- a/source4/librpc/rpc/dcerpc.h
+++ b/source4/librpc/rpc/dcerpc.h
@@ -359,7 +359,8 @@ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx,
NTSTATUS dcerpc_floor_get_lhs_data(const struct epm_floor *epm_floor, struct ndr_syntax_id *syntax);
-enum dcerpc_transport_t dcerpc_transport_by_tower(struct epm_tower *tower);
+enum dcerpc_transport_t dcerpc_transport_by_tower(const struct epm_tower *tower);
+const char *derpc_transport_string_by_transport(enum dcerpc_transport_t t);
NTSTATUS dcerpc_ndr_request(struct dcerpc_pipe *p,
const struct GUID *object,