Markus Koetter provided a patch to avoid getnameinfo() usage which broke a couple of both IPv4 and IPv6 autobuilds.

This commit is contained in:
Gunter Knauf 2009-07-04 01:04:23 +00:00
parent 3050f10676
commit 83fb285d40
2 changed files with 15 additions and 10 deletions

View File

@ -6,6 +6,10 @@
Changelog Changelog
Guenter Knauf (4 Jul 2009)
- Markus Koetter provided a patch to avoid getnameinfo() usage which broke a
couple of both IPv4 and IPv6 autobuilds.
Daniel Stenberg (29 Jun 2009) Daniel Stenberg (29 Jun 2009)
- Markus Koetter made CURLOPT_FTPPORT (and curl's -P/--ftpport) support a port - Markus Koetter made CURLOPT_FTPPORT (and curl's -P/--ftpport) support a port
range if given colon-separated after the host name/address part. Like range if given colon-separated after the host name/address part. Like

View File

@ -1000,22 +1000,23 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
the IP from the control connection */ the IP from the control connection */
sslen = sizeof(ss); sslen = sizeof(ss);
if(getsockname(conn->sock[FIRSTSOCKET], (struct sockaddr *)&ss, &sslen)) { if(getsockname(conn->sock[FIRSTSOCKET], sa, &sslen)) {
failf(data, "getsockname() failed: %s", failf(data, "getsockname() failed: %s",
Curl_strerror(conn, SOCKERRNO) ); Curl_strerror(conn, SOCKERRNO) );
if (addr) if (addr)
free(addr); free(addr);
return CURLE_FTP_PORT_FAILED; return CURLE_FTP_PORT_FAILED;
} }
switch(sa->sa_family)
sslen = sizeof(ss); {
rc = getnameinfo((struct sockaddr *)&ss, sslen, hbuf, sizeof(hbuf), NULL, #ifdef ENABLE_IPV6
0, NIFLAGS); case AF_INET6:
if(rc) { Curl_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, sizeof(hbuf));
failf(data, "getnameinfo() returned %d", rc); break;
if (addr) #endif
free(addr); default:
return CURLE_FTP_PORT_FAILED; Curl_inet_ntop(sa->sa_family, &sa4->sin_addr, hbuf, sizeof(hbuf));
break;
} }
host = hbuf; /* use this host name */ host = hbuf; /* use this host name */
} }