aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-09-16 21:45:16 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-09-16 21:45:16 +0000
commit6a06667cc0a6915510a7f3d789a0bcf470a9b7d8 (patch)
treefa6d0a95714ca164794fcb16ba4d64f1bfcbcfa6 /lib
parent25bf23105d0ae927a9b62a1d4f4f30312481955f (diff)
Added CURLOPT_FTPSSLAUTH
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c21
-rw-r--r--lib/url.c7
-rw-r--r--lib/urldata.h1
3 files changed, 28 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]);
diff --git a/lib/url.c b/lib/url.c
index 8bf89cf01..9e915f4fa 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1338,6 +1338,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
data->set.ftp_ssl = (curl_ftpssl)va_arg(param, long);
break;
+ case CURLOPT_FTPSSLAUTH:
+ /*
+ * Set a specific auth for FTP-SSL transfers.
+ */
+ data->set.ftpsslauth = (curl_ftpauth)va_arg(param, long);
+ break;
+
case CURLOPT_IPRESOLVE:
data->set.ip_version = va_arg(param, long);
break;
diff --git a/lib/urldata.h b/lib/urldata.h
index e50a589ca..f1de21904 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -920,6 +920,7 @@ struct UserDefined {
bool ftp_use_epsv; /* if EPSV is to be attempted or not */
bool ftp_use_eprt; /* if EPRT is to be attempted or not */
curl_ftpssl ftp_ssl; /* if AUTH TLS is to be attempted etc */
+ curl_ftpauth ftpsslauth; /* what AUTH XXX to be attempted */
bool no_signal; /* do not use any signal/alarm handler */
bool global_dns_cache; /* subject for future removal */
bool tcp_nodelay; /* whether to enable TCP_NODELAY or not */