Skip to content

Commit

Permalink
rpcclient: Fix ncacn_ip_tcp:<ip-address>
Browse files Browse the repository at this point in the history
inet_pton expects "struct in_addr" or "struct in6_addr" as destination
pointer. It does not fill in a struct
sockaddr_storage. interpret_string_addr() takes care of this.

Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>

Autobuild-User(master): Volker Lendecke <[email protected]>
Autobuild-Date(master): Mon Jan 10 11:47:34 UTC 2022 on sn-devel-184
  • Loading branch information
vlendec committed Jan 10, 2022
1 parent 03734be commit b5e56a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
1 change: 0 additions & 1 deletion selftest/knownfail.d/rpcclient_ncacn_ip_tcp

This file was deleted.

21 changes: 4 additions & 17 deletions source3/rpcclient/rpcclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,23 +897,10 @@ static NTSTATUS do_cmd(struct cli_state *cli,
binding, "target_hostname");

if (remote_host != NULL) {
int af = AF_UNSPEC;

if (remote_name == NULL) {
remote_name = dcerpc_binding_get_string_option(
binding, "host");
}

if (is_ipaddress_v4(remote_host)) {
af = AF_INET;
} else if (is_ipaddress_v6(remote_host)) {
af = AF_INET6;
}
if (af != AF_UNSPEC) {
int ok = inet_pton(af, remote_host, &remote_ss);
if (ok) {
remote_sockaddr = &remote_ss;
}
bool ok = interpret_string_addr(
&remote_ss, remote_host, 0);
if (ok) {
remote_sockaddr = &remote_ss;
}
}
}
Expand Down

0 comments on commit b5e56a3

Please sign in to comment.