Skip to content

Commit 0966dda

Browse files
committed
As reported in Mandrake's bug tracker bug 12285
(http://qa.mandrakesoft.com/show_bug.cgi?id=12285), when connecting to an IPv6 host with FTP, --disable-epsv (or --disable-eprt) effectively disables the ability to transfer a file. Now, when connected to an FTP server with IPv6, these FTP commands can't be disabled even if asked to with the available libcurl options.
1 parent c073625 commit 0966dda

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

CHANGES

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66

77
Changelog
88

9+
Daniel (29 November 2004)
10+
- As reported in Mandrake's bug tracker bug 12285
11+
(http://qa.mandrakesoft.com/show_bug.cgi?id=12285), when connecting to an
12+
IPv6 host with FTP, --disable-epsv (or --disable-eprt) effectively disables
13+
the ability to transfer a file. Now, when connected to an FTP server with
14+
IPv6, these FTP commands can't be disabled even if asked to with the
15+
available libcurl options.
16+
917
Daniel (26 November 2004)
1018
- As reported in Mandrake's bug tracker bug 12289
1119
(http://qa.mandrakesoft.com/show_bug.cgi?id=12289), curl would print a

docs/libcurl/curl_easy_setopt.3

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
.\" * $Id$
2222
.\" **************************************************************************
2323
.\"
24-
.TH curl_easy_setopt 3 "21 Nov 2004" "libcurl 7.12.3" "libcurl Manual"
24+
.TH curl_easy_setopt 3 "29 Nov 2004" "libcurl 7.12.3" "libcurl Manual"
2525
.SH NAME
2626
curl_easy_setopt - set options for a curl easy handle
2727
.SH SYNOPSIS
@@ -706,11 +706,15 @@ LPRT) command when doing active FTP downloads (which is enabled by
706706
\fICURLOPT_FTPPORT\fP). Using EPRT means that it will first attempt to use
707707
EPRT and then LPRT before using PORT, but if you pass FALSE (zero) to this
708708
option, it will not try using EPRT or LPRT, only plain PORT. (Added in 7.10.5)
709+
710+
If the server is an IPv6 host, this option will have no effect as of 7.12.3.
709711
.IP CURLOPT_FTP_USE_EPSV
710712
Pass a long. If the value is non-zero, it tells curl to use the EPSV command
711713
when doing passive FTP downloads (which it always does by default). Using EPSV
712714
means that it will first attempt to use EPSV before using PASV, but if you
713715
pass FALSE (zero) to this option, it will not try using EPSV, only plain PASV.
716+
717+
If the server is an IPv6 host, this option will have no effect as of 7.12.3.
714718
.IP CURLOPT_FTP_CREATE_MISSING_DIRS
715719
Pass a long. If the value is non-zero, curl will attempt to create any remote
716720
directory that it fails to CWD into. CWD is the command that changes working

lib/ftp.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,16 @@ CURLcode ftp_use_port(struct connectdata *conn)
11841184
return CURLE_FTP_PORT_FAILED;
11851185
}
11861186

1187+
#ifdef PF_INET6
1188+
if(!conn->bits.ftp_use_eprt &&
1189+
(conn->ip_addr->ai_family == PF_INET6)) {
1190+
/* EPRT is disabled but we are connected to a IPv6 host, so we ignore the
1191+
request! */
1192+
conn->bits.ftp_use_eprt = TRUE;
1193+
}
1194+
#endif
1195+
1196+
11871197
for (fcmd = EPRT; fcmd != DONE; fcmd++) {
11881198
int lprtaf, eprtaf;
11891199
int alen=0, plen=0;
@@ -1512,6 +1522,15 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
15121522
char newhost[48];
15131523
char *newhostp=NULL;
15141524

1525+
#ifdef PF_INET6
1526+
if(!conn->bits.ftp_use_epsv &&
1527+
(conn->ip_addr->ai_family == PF_INET6)) {
1528+
/* EPSV is disabled but we are connected to a IPv6 host, so we ignore the
1529+
request! */
1530+
conn->bits.ftp_use_epsv = TRUE;
1531+
}
1532+
#endif
1533+
15151534
for (modeoff = (conn->bits.ftp_use_epsv?0:1);
15161535
mode[modeoff]; modeoff++) {
15171536
result = Curl_ftpsendf(conn, "%s", mode[modeoff]);

0 commit comments

Comments
 (0)