summaryrefslogtreecommitdiff
path: root/source4/librpc/rpc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-12-15 03:41:08 +0000
committerAndrew Tridgell <tridge@samba.org>2003-12-15 03:41:08 +0000
commit8431335ec5dd163cb0c2836165f470c25250491e (patch)
treec7f3900e541bfd5ae04176c4bfbef43c0fde8153 /source4/librpc/rpc
parent8e61af23e2b9529c80a00b700236814f467c0db6 (diff)
downloadsamba-8431335ec5dd163cb0c2836165f470c25250491e.tar.gz
samba-8431335ec5dd163cb0c2836165f470c25250491e.tar.bz2
samba-8431335ec5dd163cb0c2836165f470c25250491e.zip
more flexible handling of [] in binding strings
(This used to be commit edc67fffeaee5fe4bbbc6fbd76345d0a9d5b2093)
Diffstat (limited to 'source4/librpc/rpc')
-rw-r--r--source4/librpc/rpc/dcerpc_util.c16
1 files changed, 14 insertions, 2 deletions
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;
}