#endif
#include "strequal.h"
+#include "ssluse.h"
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
return result;
}
+ if(conn->protocol & PROT_FTPS) {
+ /* FTPS is simply ftp with SSL for the control channel */
+ /* now, perform the SSL initialization for this socket */
+ if(Curl_SSLConnect(conn))
+ return CURLE_SSL_CONNECT_ERROR;
+ }
+
+
/* The first thing we do is wait for the "220*" line: */
nread = Curl_GetFTPResponse(conn->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
set a valid level */
sec_request_prot(conn, data->krb4_level);
- data->cmdchannel = fdopen(conn->firstsocket, "w");
-
if(sec_login(conn) != 0)
infof(data, "Logging in with password in cleartext!\n");
else
strcat(s, "\r\n"); /* append a trailing CRLF */
-#ifdef KRB4
- if(conn->sec_complete && conn->data->cmdchannel) {
- bytes_written = sec_fprintf(conn, conn->data->cmdchannel, s);
- fflush(conn->data->cmdchannel);
- }
- else
-#endif /* KRB4 */
- {
- bytes_written = swrite(fd, s, strlen(s));
- }
+ bytes_written=0;
+ Curl_write(conn, fd, s, strlen(s), &bytes_written);
+
return(bytes_written);
}
#ifdef USE_SSLEAY
else if(strnequal(conn->gname, "HTTPS", 5))
strcpy(conn->protostr, "https");
+ else if(strnequal(conn->gname, "FTPS", 4))
+ strcpy(conn->protostr, "ftps");
#endif /* USE_SSLEAY */
else if(strnequal(conn->gname, "TELNET", 6))
strcpy(conn->protostr, "telnet");
conn->curl_done = Curl_http_done;
conn->curl_close = Curl_http_close;
}
- else if(strequal(conn->protostr, "FTP")) {
+ else if(strequal(conn->protostr, "FTP") ||
+ strequal(conn->protostr, "FTPS")) {
char *type;
+
+ if(strequal(conn->protostr, "FTPS")) {
+#ifdef USE_SSLEAY
+ conn->protocol |= PROT_FTPS;
+#else
+ failf(data, "libcurl was built with SSL disabled, ftps: not supported!");
+ return CURLE_UNSUPPORTED_PROTOCOL;
+#endif /* !USE_SSLEAY */
+ }
+
conn->port = (data->use_port && allow_port)?data->use_port:PORT_FTP;
conn->remote_port = PORT_FTP;
conn->protocol |= PROT_FTP;
!data->bits.tunnel_thru_httpproxy) {
/* Unless we have asked to tunnel ftp operations through the proxy, we
switch and use HTTP operations only */
+ if(conn->protocol & PROT_FTPS) {
+ /* FTPS is a hacked protocol and does not work through your
+ ordinary http proxy! */
+ failf(data, "ftps does not work through http proxy!");
+ return CURLE_UNSUPPORTED_PROTOCOL;
+ }
conn->curl_do = Curl_http;
conn->curl_done = Curl_http_done;
conn->curl_close = Curl_http_close;
#define PROT_DICT (1<<6)
#define PROT_LDAP (1<<7)
#define PROT_FILE (1<<8)
+#define PROT_FTPS (1<<9)
#ifdef ENABLE_IPV6
struct addrinfo *hp; /* host info pointer list */
document headers */
#ifdef KRB4
-
enum protection_level command_prot;
enum protection_level data_prot;
enum protection_level request_data_prot;
char proxypasswd[MAX_CURL_PASSWORD_LENGTH];
char *krb4_level; /* what security level */
-#ifdef KRB4
- FILE *cmdchannel;
-#endif
-
struct timeval keeps_speed; /* this should be request-specific */
/* 'connects' will be an allocated array with pointers. If the pointer is