diff options
author | itojun <itojun@pkgsrc.org> | 2000-08-16 00:31:32 +0000 |
---|---|---|
committer | itojun <itojun@pkgsrc.org> | 2000-08-16 00:31:32 +0000 |
commit | 0591c3fad874ce48c1c4a1eeff8f24e6dbb883ed (patch) | |
tree | 0dccea007f3add7d5c2717e598789f4091205491 /www/w3m | |
parent | df0901849de272aa60bc2c944dc114a66e659cd6 (diff) | |
download | pkgsrc-0591c3fad874ce48c1c4a1eeff8f24e6dbb883ed.tar.gz |
repair IPv6 FTP. (patch sent to the original author)
Diffstat (limited to 'www/w3m')
-rw-r--r-- | www/w3m/files/patch-sum | 3 | ||||
-rw-r--r-- | www/w3m/patches/patch-ae | 132 |
2 files changed, 134 insertions, 1 deletions
diff --git a/www/w3m/files/patch-sum b/www/w3m/files/patch-sum index 8ec93350126..d21ce0a6939 100644 --- a/www/w3m/files/patch-sum +++ b/www/w3m/files/patch-sum @@ -1,6 +1,7 @@ -$NetBSD: patch-sum,v 1.12 2000/08/15 05:01:22 itojun Exp $ +$NetBSD: patch-sum,v 1.13 2000/08/16 00:31:32 itojun Exp $ MD5 (patch-aa) = 233ec21f2f46d880ae75b782d228c4ad MD5 (patch-ab) = d88798980e1985d3e3f71669d57d9a4a MD5 (patch-ac) = ff0f95231d7f2d894b629f07465fb715 MD5 (patch-ad) = 3d07f5d56a7655cc636b1c9823181e5a +MD5 (patch-ae) = 4a7157011c6876b5fb70809fe3efbd83 diff --git a/www/w3m/patches/patch-ae b/www/w3m/patches/patch-ae new file mode 100644 index 00000000000..343fdb98693 --- /dev/null +++ b/www/w3m/patches/patch-ae @@ -0,0 +1,132 @@ +$NetBSD: patch-ae,v 1.3 2000/08/16 00:31:34 itojun Exp $ +Index: ftp.c +=================================================================== +RCS file: /cvsroot/apps/w3m/ftp.c,v +retrieving revision 1.1 +retrieving revision 1.2 +diff -u -1 -r1.1 -r1.2 +--- ftp.c 2000/08/15 23:53:35 1.1 ++++ ftp.c 2000/08/16 00:28:03 1.2 +@@ -15,4 +15,5 @@ + +-#ifdef FTPPASS_HOSTNAMEGEN + #include <sys/socket.h> ++ ++#ifdef FTPPASS_HOSTNAMEGEN + #include <netinet/in.h> +@@ -22,3 +23,8 @@ + ++#ifdef INET6 ++#include <netdb.h> ++#endif ++ + typedef struct _FTP { ++ int family; + FILE *rcontrol; +@@ -105,2 +111,8 @@ + Str tmp; ++#ifdef INET6 ++ struct sockaddr_storage ss; ++#else ++ struct sockaddr ss; ++#endif ++ int sslen; + FTP ftp = New(struct _FTP); +@@ -116,3 +128,7 @@ + if (n > 0 && pass[n - 1] == '@') { ++#ifdef INET6 ++ struct sockaddr_storage sockname; ++#else + struct sockaddr_in sockname; ++#endif + int socknamelen = sizeof(sockname); +@@ -120,5 +136,19 @@ + if (!getsockname(fd, (struct sockaddr *) &sockname, &socknamelen)) { ++#ifdef INET6 ++ char hbuf[NI_MAXHOST]; ++#else + struct hostent *sockent; ++#endif + Str tmp2 = Strnew_charp(pass); + ++#ifdef INET6 ++ if (getnameinfo((struct sockaddr *)&sockname, socknamelen, ++ hbuf, sizeof(hbuf), NULL, 0, NI_NAMEREQD) == 0) { ++ Strcat_charp(tmp2, hbuf); ++ } else if (getnameinfo((struct sockaddr *)&sockname, socknamelen, ++ hbuf, sizeof(hbuf), NULL, 0, 0) == 0) { ++ Strcat_m_charp(tmp2, "[", hbuf, "]", NULL); ++ } else ++ Strcat_charp(tmp2, "invalid"); ++#else + if (sockent = gethostbyaddr((char *) &sockname.sin_addr, +@@ -129,2 +159,3 @@ + Strcat_m_charp(tmp2, "[", inet_ntoa(sockname.sin_addr), "]", NULL); ++#endif + +@@ -135,2 +166,8 @@ + #endif ++ sslen = sizeof(ss); ++ if (getsockname(fd, (struct sockaddr *)&ss, &sslen) < 0) { ++ close(fd); ++ return -1; ++ } ++ ftp->family = ((struct sockaddr *)&ss)->sa_family; + ftp->rcontrol = fdopen(fd, "rb"); +@@ -176,3 +213,46 @@ + ++#ifdef INET6 + int ++ftp_epsv(FTP ftp) ++{ ++ int port; ++ int data_s; ++ char *p; ++ Str tmp; ++ char hbuf[NI_MAXHOST]; ++ struct sockaddr_storage ss; ++ int sslen; ++ ++ sslen = sizeof(ss); ++ if (getpeername(fileno(ftp->wcontrol), (struct sockaddr *)&ss, &sslen) < 0) ++ return -1; ++ if (getnameinfo((struct sockaddr *)&ss, ((struct sockaddr *)&ss)->sa_len, ++ hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0) { ++ return -1; ++ } ++ ++ fwrite("EPSV\r\n", 6, sizeof(char), ftp->wcontrol); ++ fflush(ftp->wcontrol); ++ tmp = read_response(ftp); ++ if (atoi(tmp->ptr) != 229) ++ return -1; ++ for (p = tmp->ptr + 4; *p && *p != '('; p++); /*)*/ ++ if (*p == '\0') ++ return -1; ++ p++; ++ /* find "|||port|" */ ++ if (p[0] && p[0] == p[1] && p[0] == p[2]) ++ p += 3; ++ else ++ return -1; ++ sscanf(p, "%d", &port); ++ data_s = openSocket(hbuf, "", port); ++ if (data_s < 0) ++ return -1; ++ ftp->data = fdopen(data_s, "rb"); ++ return 0; ++} ++#endif ++ ++int + ftp_pasv(FTP ftp) +@@ -183,2 +263,9 @@ + Str tmp; ++ ++#ifdef INET6 ++ if (ftp->family == AF_INET6 || ftp->family == AF_INET) { ++ if (ftp_epsv(ftp) == 0) ++ return 0; ++ } ++#endif + |