diff --git a/docs/libcurl/opts/CURLOPT_FTP_SSL_CCC.md b/docs/libcurl/opts/CURLOPT_FTP_SSL_CCC.md index 12058b6826..db62918335 100644 --- a/docs/libcurl/opts/CURLOPT_FTP_SSL_CCC.md +++ b/docs/libcurl/opts/CURLOPT_FTP_SSL_CCC.md @@ -63,7 +63,7 @@ int main(void) curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/file.txt"); curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_CONTROL); /* go back to clear-text FTP after authenticating */ - curl_easy_setopt(curl, CURLOPT_FTP_SSL_CCC, (long)CURLFTPSSL_CCC_ACTIVE); + curl_easy_setopt(curl, CURLOPT_FTP_SSL_CCC, CURLFTPSSL_CCC_ACTIVE); res = curl_easy_perform(curl); curl_easy_cleanup(curl); } diff --git a/include/curl/curl.h b/include/curl/curl.h index ac4e0c1e47..9af7d6433a 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -979,11 +979,12 @@ typedef enum { #endif /* !CURL_NO_OLDIES */ /* parameter for the CURLOPT_FTP_SSL_CCC option */ +#define CURLFTPSSL_CCC_NONE 0L /* do not send CCC */ +#define CURLFTPSSL_CCC_PASSIVE 1L /* Let the server initiate the shutdown */ +#define CURLFTPSSL_CCC_ACTIVE 2L /* Initiate the shutdown */ + typedef enum { - CURLFTPSSL_CCC_NONE, /* do not send CCC */ - CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */ - CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */ - CURLFTPSSL_CCC_LAST /* not an option, never use */ + CURLFTPSSL_CCC_LAST = 3 /* not an option, never use */ } curl_ftpccc; /* parameter for the CURLOPT_FTPSSLAUTH option */ diff --git a/src/config2setopts.c b/src/config2setopts.c index 10c7b9a703..7c2963a19b 100644 --- a/src/config2setopts.c +++ b/src/config2setopts.c @@ -653,7 +653,7 @@ static CURLcode ftp_setopts(struct OperationConfig *config, CURL *curl) /* new in curl 7.16.1 */ if(config->ftp_ssl_ccc) - my_setopt_enum(curl, CURLOPT_FTP_SSL_CCC, (long)config->ftp_ssl_ccc_mode); + my_setopt_enum(curl, CURLOPT_FTP_SSL_CCC, config->ftp_ssl_ccc_mode); my_setopt_str(curl, CURLOPT_FTP_ACCOUNT, config->ftp_account); diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h index bd32ab2d42..c52f09d1f5 100644 --- a/src/tool_cfgable.h +++ b/src/tool_cfgable.h @@ -226,7 +226,7 @@ struct OperationConfig { unsigned long timecond; HttpReq httpreq; long proxyver; /* set to CURLPROXY_HTTP* define */ - int ftp_ssl_ccc_mode; + long ftp_ssl_ccc_mode; int ftp_filemethod; enum { CLOBBER_DEFAULT, /* Provides compatibility with previous versions of curl, diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c index c037189610..546f18775a 100644 --- a/src/tool_paramhlp.c +++ b/src/tool_paramhlp.c @@ -635,7 +635,7 @@ int ftpfilemethod(struct OperationConfig *config, const char *str) return CURLFTPMETHOD_MULTICWD; } -int ftpcccmethod(struct OperationConfig *config, const char *str) +long ftpcccmethod(struct OperationConfig *config, const char *str) { if(curl_strequal("passive", str)) return CURLFTPSSL_CCC_PASSIVE; diff --git a/src/tool_paramhlp.h b/src/tool_paramhlp.h index 0be9c8968c..6b201d6f48 100644 --- a/src/tool_paramhlp.h +++ b/src/tool_paramhlp.h @@ -60,7 +60,7 @@ ParameterError add2list(struct curl_slist **list, const char *ptr); int ftpfilemethod(struct OperationConfig *config, const char *str); -int ftpcccmethod(struct OperationConfig *config, const char *str); +long ftpcccmethod(struct OperationConfig *config, const char *str); long delegation(struct OperationConfig *config, const char *str);