From 6a06667cc0a6915510a7f3d789a0bcf470a9b7d8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 16 Sep 2004 21:45:16 +0000 Subject: Added CURLOPT_FTPSSLAUTH --- lib/ftp.c | 21 ++++++++++++++++++++- lib/url.c | 7 +++++++ lib/urldata.h | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) (limited to 'lib') 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 */ -- cgit v1.2.3