aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-02-05 23:35:44 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-02-05 23:35:44 +0000
commitdb70cd28b34e73fc38617176cd8b1306a129abe5 (patch)
tree0bbbc996ce2313f59165318072e008d2e95a67a0 /lib/ftp.c
parentf6e2bfd464a7ffd7ec24194da2a9a1e285387560 (diff)
adjusted the IPv6 stuff to compile and build on Linux as well
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 069b9d100..123f8dfcd 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -711,6 +711,7 @@ CURLcode _ftp(struct connectdata *conn)
int sslen;
char hbuf[NI_MAXHOST];
char *localaddr;
+ struct sockaddr *sa=(struct sockaddr *)&ss;
#ifdef NI_WITHSCOPEID
const int niflags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
#else
@@ -737,7 +738,10 @@ CURLcode _ftp(struct connectdata *conn)
return CURLE_FTP_PORT_FAILED;
memset(&hints, 0, sizeof(hints));
- hints.ai_family = ss.ss_family;
+ hints.ai_family = sa->sa_family;
+ /*hints.ai_family = ss.ss_family;
+ this way can be used if sockaddr_storage is properly defined, as glibc
+ 2.1.X doesn't do*/
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE;
if (getaddrinfo(hbuf, "0", &hints, &res))
@@ -770,7 +774,7 @@ CURLcode _ftp(struct connectdata *conn)
}
sslen = sizeof(ss);
- if (getsockname(portsock, (struct sockaddr *)&ss, &sslen) < 0) {
+ if (getsockname(portsock, sa, &sslen) < 0) {
failf(data, strerror(errno));
freeaddrinfo(res);
return CURLE_FTP_PORT_FAILED;
@@ -779,7 +783,7 @@ CURLcode _ftp(struct connectdata *conn)
for (modep = mode; modep && *modep; modep++) {
int lprtaf, eprtaf;
- switch (ss.ss_family) {
+ switch (sa->sa_family) {
case AF_INET:
ap = (char *)&((struct sockaddr_in *)&ss)->sin_addr;
alen = sizeof(((struct sockaddr_in *)&ss)->sin_addr);
@@ -809,7 +813,7 @@ CURLcode _ftp(struct connectdata *conn)
portmsgbuf, sizeof(portmsgbuf), tmp, sizeof(tmp), niflags))
continue;
/* do not transmit IPv6 scope identifier to the wire */
- if (ss.ss_family == AF_INET6) {
+ if (sa->sa_family == AF_INET6) {
char *q = strchr(portmsgbuf, '%');
if (q)
*q = '\0';
@@ -821,7 +825,7 @@ CURLcode _ftp(struct connectdata *conn)
if (strcmp(*modep, "LPRT") == 0 && lprtaf < 0)
continue;
- if (strcmp(*modep, "PORT") == 0 && ss.ss_family != AF_INET)
+ if (strcmp(*modep, "PORT") == 0 && sa->sa_family != AF_INET)
continue;
portmsgbuf[0] = '\0';