1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-31 17:18:04 +03:00

more flexible handling of [] in binding strings

(This used to be commit edc67fffea)
This commit is contained in:
Andrew Tridgell 2003-12-15 03:41:08 +00:00
parent 8e61af23e2
commit 8431335ec5

View File

@ -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;
}