From 8431335ec5dd163cb0c2836165f470c25250491e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 Dec 2003 03:41:08 +0000 Subject: more flexible handling of [] in binding strings (This used to be commit edc67fffeaee5fe4bbbc6fbd76345d0a9d5b2093) --- source4/librpc/rpc/dcerpc_util.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'source4/librpc/rpc') diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index 68623982e1..02e224a26f 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -293,8 +293,18 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_ p = strchr(s, ':'); if (!p) { - part2 = talloc_strdup(mem_ctx, s); - part3 = NULL; + p = strchr(s, '['); + if (p) { + part2 = talloc_strndup(mem_ctx, s, PTR_DIFF(p, s)); + part3 = talloc_strdup(mem_ctx, p+1); + if (part3[strlen(part3)-1] != ']') { + return NT_STATUS_INVALID_PARAMETER; + } + part3[strlen(part3)-1] = 0; + } else { + part2 = talloc_strdup(mem_ctx, s); + part3 = NULL; + } } else { part2 = talloc_strndup(mem_ctx, s, PTR_DIFF(p, s)); part3 = talloc_strdup(mem_ctx, p+1); @@ -458,6 +468,7 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_ip_tcp(struct dcerpc_pipe **p, status = dcerpc_pipe_open_tcp(p, binding->host, port); if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("Failed to connect to %s:%d\n", binding->host, port)); return status; } @@ -531,6 +542,7 @@ NTSTATUS dcerpc_pipe_connect(struct dcerpc_pipe **p, status = dcerpc_parse_binding(mem_ctx, binding, &b); if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("Failed to parse dcerpc binding '%s'\n", binding)); talloc_destroy(mem_ctx); return status; } -- cgit