From: Volker Lendecke Date: Sun, 9 Jan 2022 12:38:37 +0000 (+0100) Subject: rpcclient: Fix ncacn_ip_tcp: X-Git-Tag: tdb-1.4.6~182 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5e56a30dfd33e89cfb602b1e7480e210434d600;p=thirdparty%2Fsamba.git rpcclient: Fix ncacn_ip_tcp: 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 Reviewed-by: Andreas Schneider Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Mon Jan 10 11:47:34 UTC 2022 on sn-devel-184 --- diff --git a/selftest/knownfail.d/rpcclient_ncacn_ip_tcp b/selftest/knownfail.d/rpcclient_ncacn_ip_tcp deleted file mode 100644 index 42aecda08b6..00000000000 --- a/selftest/knownfail.d/rpcclient_ncacn_ip_tcp +++ /dev/null @@ -1 +0,0 @@ -.*samba3.blackbox.rpcclient.*ncacn_ip_tcp.* diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index b89534f2225..4042d0d60be 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -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; } } }