mirror of
https://github.com/samba-team/samba.git
synced 2025-02-09 09:57:48 +03:00
s4:lib/com/dcom: use dcerpc_parse_binding() to create the binding
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
This commit is contained in:
parent
549001fb73
commit
9632f92cc1
@ -36,34 +36,28 @@
|
|||||||
|
|
||||||
static NTSTATUS dcerpc_binding_from_STRINGBINDING(TALLOC_CTX *mem_ctx, struct dcerpc_binding **b_out, struct STRINGBINDING *bd)
|
static NTSTATUS dcerpc_binding_from_STRINGBINDING(TALLOC_CTX *mem_ctx, struct dcerpc_binding **b_out, struct STRINGBINDING *bd)
|
||||||
{
|
{
|
||||||
char *host, *endpoint;
|
char *tstr;
|
||||||
|
char *bstr;
|
||||||
|
enum dcerpc_transport_t transport;
|
||||||
struct dcerpc_binding *b;
|
struct dcerpc_binding *b;
|
||||||
|
|
||||||
b = talloc_zero(mem_ctx, struct dcerpc_binding);
|
transport = dcerpc_transport_by_endpoint_protocol(bd->wTowerId);
|
||||||
if (!b) {
|
if (transport == NCA_UNKNOWN) {
|
||||||
return NT_STATUS_NO_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
b->transport = dcerpc_transport_by_endpoint_protocol(bd->wTowerId);
|
|
||||||
|
|
||||||
if (b->transport == -1) {
|
|
||||||
DEBUG(1, ("Can't find transport match endpoint protocol %d\n", bd->wTowerId));
|
DEBUG(1, ("Can't find transport match endpoint protocol %d\n", bd->wTowerId));
|
||||||
talloc_free(b);
|
|
||||||
return NT_STATUS_NOT_SUPPORTED;
|
return NT_STATUS_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
host = talloc_strdup(b, bd->NetworkAddr);
|
tstr = derpc_transport_string_by_transport(transport);
|
||||||
endpoint = strchr(host, '[');
|
bstr = talloc_asprintf(mem_ctx, "%s:%s", tstr, bd->NetworkAddr);
|
||||||
|
if (bstr == NULL) {
|
||||||
if (endpoint) {
|
return NT_STATUS_NO_MEMORY;
|
||||||
*endpoint = '\0';
|
|
||||||
endpoint++;
|
|
||||||
|
|
||||||
endpoint[strlen(endpoint)-1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
b->host = host;
|
status = dcerpc_parse_binding(mem_ctx, bstr, &b);
|
||||||
b->endpoint = talloc_strdup(b, endpoint);
|
TALLOC_FREE(bstr);
|
||||||
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
*b_out = b;
|
*b_out = b;
|
||||||
return NT_STATUS_OK;
|
return NT_STATUS_OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user