curl-users
curl command line tool ftp ssl control only
Date: Fri, 22 Sep 2006 13:11:35 +0100
Hi,
I have a requirement to use ftp-ssl on the control channel only using the curl command line tool. This is to allow encrypted logon and certificate support, but using plain text transfers for performance reasons.
I have chosen a new parameter -ftp-ssl-control to impliment this, and I would be grateful if this can be considered for inclusion in a later release. I have tried to conform to the existing coding conventions.
Patch:
=====================
diff -c /tmp/curl-7.15.5/src/main.c /data/tmp/main.c
*** /tmp/curl-7.15.5/src/main.c Thu Jul 27 00:20:48 2006
--- /data/tmp/main.c Fri Sep 22 13:01:07 2006
***************
*** 339,344 ****
--- 339,345 ----
size_t lastrecvsize;
bool ftp_ssl;
bool ftp_ssl_reqd;
+ bool ftp_ssl_control;
char *socksproxy; /* set to server string */
int socksver; /* set to CURLPROXY_SOCKS* define */
***************
*** 1345,1350 ****
--- 1346,1352 ----
{"$t", "socks4", TRUE},
{"$u", "ftp-alternative-to-user", TRUE},
{"$v", "ftp-ssl-reqd", FALSE},
+ {"$w", "ftp-ssl-control", FALSE},
{"0", "http1.0", FALSE},
{"1", "tlsv1", FALSE},
***************
*** 1787,1792 ****
--- 1789,1797 ----
case 'v': /* --ftp-ssl-reqd */
config->ftp_ssl_reqd ^= TRUE;
break;
+ case 'w': /* --ftp-ssl-control */
+ config->ftp_ssl_control ^= TRUE;
+ break;
}
break;
case '#': /* --progress-bar */
***************
*** 3985,3990 ****
--- 3990,3999 ----
if(config->ftp_ssl_reqd)
curl_easy_setopt(curl, CURLOPT_FTP_SSL, CURLFTPSSL_ALL);
+ /* new in curl 7.15.? */
+ if(config->ftp_ssl_control)
+ curl_easy_setopt(curl, CURLOPT_FTP_SSL, CURLFTPSSL_CONTROL);
+
/* new in curl 7.11.1, modified in 7.15.2 */
if(config->socksproxy) {
curl_easy_setopt(curl, CURLOPT_PROXY, config->socksproxy);
=====================
I have tested this on Solaris Sparc 9 & 10 with a vsftpd server on Linux. I will be testing further and on more platforms, but I would like to know if this fits in with plans, and to ensure the effort is not duplicated.
Please let me know if I can help further.
-- Regards Mike Protts Senior Technical Consultant Pro:Atria Ltd +44(0)870 765 6453Received on 2006-09-22