cURL / Mailing Lists / curl-library / Single Mail

curl-library

ftp ssl woes

From: Ed Nolan <ednolan_at_applydesigns.com>
Date: Wed, 28 Jan 2004 21:51:54 -0500

Hi guys.

This is the first time I've used the curl program and I must say that I
am quite impressed. I've got a question and I'm hoping somebody can
point me in the right direction...

I've downloaded and installed curl-7.11.0 and it seems to have compiled
and installed just fine on my Linux 2.4 system.

I've got a ftp server running SSL (its ServU Version 5 running on win 2000)
that I can connect to just fine using the curl command line tool this way:

 curl -2k --ftp-ssl ftp://username:password@192.168.0.10/offload/
    (I've verified that encryption is taking place via a packet sniffer)

BUT I need to build this functionality into a c program that I've written.
I'm sure that I'm just missing something (I went through the docs, but
I'm sure I must have missed something...) I cant get it to work. My
program makes the connection, but isn't doing so securely. I know this
cause I have a packet sniffer on the network and I can see everything in
the open (passwords and data). Perhaps I'm missing something in my
program code:

#include "curl/include/curl/curl.h"
#include "curl/include/curl/types.h"
#include "curl/include/curl/easy.h"

CURL *curl;
CURLcode res;

curl = curl_easy_init();
if (curl) {
  res = curl_easy_setopt(curl,CURLOPT_URL, serverstring);
// if (res==0) res = curl_easy_setopt(curl,CURLOPT_ERRORBUFFER,errdata);
  if (res==0) res = curl_easy_setopt(curl,CURLOPT_FTP_SSL,CURLFTPSSL_ALL);
  if (res==0) res = curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,0);
  if (res==0) res = curl_easy_setopt(curl,CURLOPT_SSL_VERIFYHOST,1);
  if (res==0) res = curl_easy_setopt(curl,CURLOPT_SSLVERSION,2);
  if (res==0) res = curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,dirdata);
  if (res==0) res = curl_easy_setopt(curl,CURLOPT_WRITEDATA,(void *)head);
  if (res==0) res = curl_easy_perform(curl);

  curl_easy_cleanup(curl);
  }

Like I said before, I must be missing something (probably quite obvious)
since it works just fine using the curl command line tool which is built
from the same library as my program... My program connects just like
normal but just not using any SSL...

Any help or advice you can give will be greatly appreciated.

Thanks,

Ed Nolan

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Received on 2004-01-31