From: Aki Tuomi Date: Wed, 9 Nov 2016 13:18:49 +0000 (+0200) Subject: lib-program-client: Use net_ipport2str X-Git-Tag: 2.3.0.rc1~2641 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1b6f7fc2c404852c0f23ca4a0bf3a4f6186e7d5b;p=thirdparty%2Fdovecot%2Fcore.git lib-program-client: Use net_ipport2str --- diff --git a/src/lib-program-client/program-client-remote.c b/src/lib-program-client/program-client-remote.c index 56530a65f6..96e57906f8 100644 --- a/src/lib-program-client/program-client-remote.c +++ b/src/lib-program-client/program-client-remote.c @@ -341,6 +341,7 @@ void program_client_net_connected(struct program_client *pclient) static void program_client_net_connect_real(struct program_client *pclient) { + const char *str; struct program_client_remote *prclient = (struct program_client_remote *) pclient; @@ -352,12 +353,9 @@ void program_client_net_connect_real(struct program_client *pclient) i_assert(prclient->ips_count > 0); - bool ipv6 = prclient->ips->family == AF_INET6; - pclient->path = p_strdup_printf(pclient->pool, "%s%s%s:%u", - ipv6 ? "[" : "", - net_ip2addr(prclient->ips), - ipv6 ? "]" : "", - prclient->port); + if (net_ipport2str(prclient->ips, prclient->port, &str) < 0) + i_unreached(); + pclient->path = p_strdup(pclient->pool, str); if (pclient->debug) { i_debug("Trying to connect %s (timeout %u msecs)",