aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 1cea72c7a..710dbf701 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -540,8 +540,27 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
if(data->set.ftp_ssl && !conn->ssl[FIRSTSOCKET].use) {
/* we don't have a SSL/TLS connection, try a FTPS connection now */
+ int start;
+ int trynext;
+ int count=0;
+
+ switch(data->set.ftpsslauth) {
+ case CURLFTPAUTH_DEFAULT:
+ case CURLFTPAUTH_SSL:
+ start = 0;
+ trynext = 1;
+ break;
+ case CURLFTPAUTH_TLS:
+ start = 1;
+ trynext = 0;
+ break;
+ default:
+ failf(data, "unsupported parameter to CURLOPT_FTPSSLAUTH: %d\n",
+ data->set.ftpsslauth);
+ return CURLE_FAILED_INIT; /* we don't know what to do */
+ }
- for (try = 0; ftpauth[try]; try++) {
+ for (try = start; ftpauth[count]; try=trynext, count++) {
FTPSENDF(conn, "AUTH %s", ftpauth[try]);