1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-22 05:57:43 +03:00

s4:libnet: use helper functions to access dcerpc_binding->target_hostname

If possible also specify the already known address as dcerpc_binding->host.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
This commit is contained in:
Stefan Metzmacher 2014-02-04 09:59:54 +01:00 committed by Günther Deschner
parent ab5f89bc72
commit 776f5c65bf
4 changed files with 10 additions and 13 deletions

View File

@ -1573,9 +1573,10 @@ static void becomeDC_drsuapi_connect_send(struct libnet_BecomeDC_state *s,
{
print_str = "print,";
}
binding_str = talloc_asprintf(s, "ncacn_ip_tcp:%s[%s%sseal]",
s->source_dsa.dns_name,
krb5_str, print_str);
binding_str = talloc_asprintf(s, "ncacn_ip_tcp:%s[%s%sseal,target_hostname=%s]",
s->source_dsa.address,
krb5_str, print_str,
s->source_dsa.dns_name);
if (composite_nomem(binding_str, c)) return;
c->status = dcerpc_parse_binding(s, binding_str, &drsuapi->binding);
talloc_free(binding_str);

View File

@ -243,7 +243,7 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J
/* Now we know the user's DN, open with LDAP, read and modify a few things */
remote_ldb_url = talloc_asprintf(tmp_ctx, "ldap://%s",
drsuapi_binding->target_hostname);
dcerpc_binding_get_string_option(drsuapi_binding, "target_hostname"));
if (!remote_ldb_url) {
r->out.error_string = NULL;
talloc_free(tmp_ctx);

View File

@ -79,7 +79,8 @@ static struct composite_context* libnet_RpcConnectSrv_send(struct libnet_context
s->binding = talloc_asprintf(s, "ncacn_np:%s", r->in.name);
break;
case LIBNET_RPC_CONNECT_SERVER_ADDRESS:
s->binding = talloc_asprintf(s, "ncacn_np:%s", r->in.address);
s->binding = talloc_asprintf(s, "ncacn_np:%s[target_hostname=%s]",
r->in.address, r->in.name);
break;
case LIBNET_RPC_CONNECT_BINDING:
@ -121,13 +122,6 @@ static struct composite_context* libnet_RpcConnectSrv_send(struct libnet_context
if (!composite_is_ok(c)) return c;
}
if (r->level == LIBNET_RPC_CONNECT_SERVER_ADDRESS) {
b->target_hostname = talloc_strdup(b, r->in.name);
if (composite_nomem(b->target_hostname, c)) {
return c;
}
}
/* connect to remote dcerpc pipe */
pipe_connect_req = dcerpc_pipe_connect_b_send(c, b, r->in.dcerpc_iface,
ctx->cred, c->event_ctx,

View File

@ -543,7 +543,9 @@ static void unbecomeDC_drsuapi_connect_send(struct libnet_UnbecomeDC_state *s)
struct composite_context *creq;
char *binding_str;
binding_str = talloc_asprintf(s, "ncacn_ip_tcp:%s[seal]", s->source_dsa.dns_name);
binding_str = talloc_asprintf(s, "ncacn_ip_tcp:%s[seal,target_hostname=%s]",
s->source_dsa.address,
s->source_dsa.dns_name);
if (composite_nomem(binding_str, c)) return;
c->status = dcerpc_parse_binding(s, binding_str, &s->drsuapi.binding);