head 1.2; access; symbols pkgsrc-2013Q2:1.2.0.54 pkgsrc-2013Q2-base:1.2 pkgsrc-2012Q4:1.2.0.52 pkgsrc-2012Q4-base:1.2 pkgsrc-2011Q4:1.2.0.50 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q2:1.2.0.48 pkgsrc-2011Q2-base:1.2 pkgsrc-2009Q4:1.2.0.46 pkgsrc-2009Q4-base:1.2 pkgsrc-2008Q4:1.2.0.44 pkgsrc-2008Q4-base:1.2 pkgsrc-2008Q3:1.2.0.42 pkgsrc-2008Q3-base:1.2 cube-native-xorg:1.2.0.40 cube-native-xorg-base:1.2 pkgsrc-2008Q2:1.2.0.38 pkgsrc-2008Q2-base:1.2 pkgsrc-2008Q1:1.2.0.36 pkgsrc-2008Q1-base:1.2 pkgsrc-2007Q4:1.2.0.34 pkgsrc-2007Q4-base:1.2 pkgsrc-2007Q3:1.2.0.32 pkgsrc-2007Q3-base:1.2 pkgsrc-2007Q2:1.2.0.30 pkgsrc-2007Q2-base:1.2 pkgsrc-2007Q1:1.2.0.28 pkgsrc-2007Q1-base:1.2 pkgsrc-2006Q4:1.2.0.26 pkgsrc-2006Q4-base:1.2 pkgsrc-2006Q3:1.2.0.24 pkgsrc-2006Q3-base:1.2 pkgsrc-2006Q2:1.2.0.22 pkgsrc-2006Q2-base:1.2 pkgsrc-2006Q1:1.2.0.20 pkgsrc-2006Q1-base:1.2 pkgsrc-2005Q4:1.2.0.18 pkgsrc-2005Q4-base:1.2 pkgsrc-2005Q3:1.2.0.16 pkgsrc-2005Q3-base:1.2 pkgsrc-2005Q2:1.2.0.14 pkgsrc-2005Q2-base:1.2 pkgsrc-2005Q1:1.2.0.12 pkgsrc-2005Q1-base:1.2 pkgsrc-2004Q4:1.2.0.10 pkgsrc-2004Q4-base:1.2 pkgsrc-2004Q3:1.2.0.8 pkgsrc-2004Q3-base:1.2 pkgsrc-2004Q2:1.2.0.6 pkgsrc-2004Q2-base:1.2 pkgsrc-2004Q1:1.2.0.4 pkgsrc-2004Q1-base:1.2 pkgsrc-2003Q4:1.2.0.2 pkgsrc-2003Q4-base:1.2 buildlink2-base:1.2; locks; strict; comment @# @; 1.2 date 2001.03.26.14.23.05; author simonb; state dead; branches; next 1.1; 1.1 date 2001.02.06.07.07.44; author itojun; state Exp; branches; next ; desc @@ 1.2 log @Update lynx-current to 2.8.4dev.19. The dev.16 distfile is no longer available from the lynx download side. More bugfixes - see http://lynx.isc.org/current/CHANGES for a complete list of changes. @ text @$NetBSD: patch-ad,v 1.1 2001/02/06 07:07:44 itojun Exp $ --- WWW/Library/Implementation/HTFTP.c.orig Fri Sep 22 11:21:59 2000 +++ WWW/Library/Implementation/HTFTP.c Tue Feb 6 15:59:19 2001 @@@@ -2992,15 +2992,18 @@@@ char command[LINE_LENGTH+1]; char *p; int h0, h1, h2, h3, p0, p1; /* Parts of reply */ +#ifdef INET6 + char dst[LINE_LENGTH+1]; +#endif data_soc = status; #ifdef INET6 - status = send_cmd_1("EPSV"); + status = send_cmd_1(p = "EPSV"); if (status < 0) /* retry or Bad return */ continue; else if (status != 2) { - status = send_cmd_1("PASV"); + status = send_cmd_1(p = "PASV"); if (status < 0) /* retry or Bad return */ continue; else if (status != 2) { @@@@ -3008,7 +3011,7 @@@@ } } - if (strncmp(command, "PASV", 4) == 0) { + if (strcmp(p, "PASV") == 0) { for (p = response_text; *p && *p != ','; p++) ; /* null body */ @@@@ -3021,26 +3024,37 @@@@ return -99; } passive_port = (p0<<8) + p1; - } else if (strncmp(command, "EPSV", 4) == 0) { + snprintf(dst, sizeof(dst), "%d.%d.%d.%d", h0, h1, h2, h3); + } else if (strcmp(p, "EPSV") == 0) { unsigned char c0, c1, c2, c3; + struct sockaddr_storage ss; + int sslen; + /* - * EPSV |||port| + * EPSV bla (|||port|) */ for (p = response_text; *p && !isspace(*p); p++) ; /* null body */ - for (p = response_text; *p && isspace(*p); p++) + for (/*nothing*/; *p && *p && *p != '('; p++) /*)*/ ; /* null body */ - status = sscanf(p+1, "%c%c%c%d%c", - &c0, &c1, &c2, &p0, &c3); + status = sscanf(p, "(%c%c%c%d%c)", &c0, &c1, &c2, &p0, &c3); if (status != 5) { fprintf(tfp, "HTFTP: EPSV reply has invalid format!\n"); return -99; } - h0 = c0; - h1 = c1; - h2 = c2; - h3 = c3; passive_port = p0; + + sslen = sizeof(ss); + if (getpeername(control->socket, (struct sockaddr *)&ss, + &sslen) < 0) { + fprintf(tfp, "HTFTP: getpeername(control) failed\n"); + return -99; + } + if (getnameinfo((struct sockaddr *)&ss, sslen, dst, + sizeof(dst), NULL, 0, NI_NUMERICHOST)) { + fprintf(tfp, "HTFTP: getnameinfo failed\n"); + return -99; + } } #else status = send_cmd_1("PASV"); @@@@ -3068,8 +3082,12 @@@@ /* Open connection for data: */ +#ifdef INET6 + sprintf(command, "ftp://%s:%d/", dst, passive_port); +#else sprintf(command, "ftp://%d.%d.%d.%d:%d/", h0, h1, h2, h3, passive_port); +#endif status = HTDoConnect(command, "FTP data", passive_port, &data_soc); if (status < 0) { @ 1.1 log @locally fix passive FTP breakage (patch already submitted to lynx guys). PR 12141. @ text @d1 1 a1 1 $NetBSD$ @