diff options
Diffstat (limited to 'librpc')
-rw-r--r-- | librpc/rpc/binding.c | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c index 2b584b57326..6a9a5ea41c3 100644 --- a/librpc/rpc/binding.c +++ b/librpc/rpc/binding.c @@ -198,6 +198,8 @@ _PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_bi char *o = s; int i; const char *t_name = NULL; + bool option_section = false; + const char *target_hostname = NULL; if (b->transport != NCA_UNKNOWN) { t_name = derpc_transport_string_by_transport(b->transport); @@ -235,7 +237,28 @@ _PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_bi } } - if (!b->endpoint && !b->options && !b->flags) { + target_hostname = b->target_hostname; + if (target_hostname != NULL && b->host != NULL) { + if (strcmp(target_hostname, b->host) == 0) { + target_hostname = NULL; + } + } + + if (b->endpoint) { + option_section = true; + } else if (target_hostname) { + option_section = true; + } else if (b->target_principal) { + option_section = true; + } else if (b->assoc_group_id != 0) { + option_section = true; + } else if (b->options) { + option_section = true; + } else if (b->flags) { + option_section = true; + } + + if (!option_section) { return s; } @@ -268,6 +291,36 @@ _PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_bi } } + if (target_hostname) { + o = s; + s = talloc_asprintf_append_buffer(s, ",target_hostname=%s", + b->target_hostname); + if (s == NULL) { + talloc_free(o); + return NULL; + } + } + + if (b->target_principal) { + o = s; + s = talloc_asprintf_append_buffer(s, ",target_principal=%s", + b->target_principal); + if (s == NULL) { + talloc_free(o); + return NULL; + } + } + + if (b->assoc_group_id != 0) { + o = s; + s = talloc_asprintf_append_buffer(s, ",assoc_group_id=0x%08x", + b->assoc_group_id); + if (s == NULL) { + talloc_free(o); + return NULL; + } + } + for (i=0;b->options && b->options[i];i++) { o = s; s = talloc_asprintf_append_buffer(s, ",%s", b->options[i]); |