mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
ftp: EPSV-disable fix over SOCKS
Bug: http://curl.haxx.se/bug/view.cgi?id=3586338
This commit is contained in:
parent
cd5261ea6d
commit
076e1fa348
38
lib/ftp.c
38
lib/ftp.c
@ -1800,6 +1800,23 @@ static CURLcode ftp_state_quote(struct connectdata *conn,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* called from ftp_state_pasv_resp to switch to PASV in case of EPSV
|
||||||
|
problems */
|
||||||
|
static CURLcode ftp_epsv_disable(struct connectdata *conn)
|
||||||
|
{
|
||||||
|
CURLcode result = CURLE_OK;
|
||||||
|
infof(conn->data, "got positive EPSV response, but can't connect. "
|
||||||
|
"Disabling EPSV\n");
|
||||||
|
/* disable it for next transfer */
|
||||||
|
conn->bits.ftp_use_epsv = FALSE;
|
||||||
|
conn->data->state.errorbuf = FALSE; /* allow error message to get
|
||||||
|
rewritten */
|
||||||
|
PPSENDF(&conn->proto.ftpc.pp, "PASV", NULL);
|
||||||
|
conn->proto.ftpc.count1++;
|
||||||
|
/* remain in the FTP_PASV state */
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
|
static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
|
||||||
int ftpcode)
|
int ftpcode)
|
||||||
{
|
{
|
||||||
@ -1982,20 +1999,12 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
|
|||||||
|
|
||||||
Curl_resolv_unlock(data, addr); /* we're done using this address */
|
Curl_resolv_unlock(data, addr); /* we're done using this address */
|
||||||
|
|
||||||
if(result && ftpc->count1 == 0 && ftpcode == 229) {
|
if(result) {
|
||||||
infof(data, "got positive EPSV response, but can't connect. "
|
if(ftpc->count1 == 0 && ftpcode == 229)
|
||||||
"Disabling EPSV\n");
|
return ftp_epsv_disable(conn);
|
||||||
/* disable it for next transfer */
|
|
||||||
conn->bits.ftp_use_epsv = FALSE;
|
|
||||||
data->state.errorbuf = FALSE; /* allow error message to get rewritten */
|
|
||||||
PPSENDF(&ftpc->pp, "PASV", NULL);
|
|
||||||
ftpc->count1++;
|
|
||||||
/* remain in the FTP_PASV state */
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(result)
|
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
conn->bits.tcpconnect[SECONDARYSOCKET] = connected;
|
conn->bits.tcpconnect[SECONDARYSOCKET] = connected;
|
||||||
|
|
||||||
@ -2035,8 +2044,11 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(result)
|
if(result) {
|
||||||
|
if(ftpc->count1 == 0 && ftpcode == 229)
|
||||||
|
return ftp_epsv_disable(conn);
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
|
if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
|
||||||
/* FIX: this MUST wait for a proper connect first if 'connected' is
|
/* FIX: this MUST wait for a proper connect first if 'connected' is
|
||||||
|
Loading…
Reference in New Issue
Block a user