cURL / Mailing Lists / curl-library / Single Mail

curl-library

libcurl sftp support and quote

From: Vincent Le Normand <vincent_at_le-normand.net>
Date: Tue, 18 Mar 2008 16:16:41 +0100

Hello,

First of all, thank you for this great library. I use it for FTP, and
it works great.

I am currently trying to add SFTP support for my application. However,
it doesn't work.

My application needs to use both quote to create directory or remove
file. When using this quote command for FTP with libcurl.framework
7.18.0 and libssh2 0.18 on Mac OS X, i have a really strange
behaviour: It looks like that libcurl is stuck in an infinite loop,
trying to send the quote command forever.

I've build a small too reproducing the issue:

#include <curl/curl.h>

int main (int argc, const char * argv[]) {
        CURL * my_curl_easy_handle = curl_easy_init();
        curl_easy_setopt(my_curl_easy_handle,CURLOPT_URL,"sftp://xxx//Volumes/Tests/Test%20SSH/
");
        curl_easy_setopt(my_curl_easy_handle,CURLOPT_USERPWD,"xxx:xxx");
        curl_easy_setopt(my_curl_easy_handle,CURLOPT_VERBOSE,TRUE);
        void *headerlist=NULL;
        headerlist = curl_slist_append(headerlist, "mkd /Volumes/Tests/Test
SSH/Test");
        curl_easy_setopt(my_curl_easy_handle,CURLOPT_QUOTE,headerlist);
        CURLcode error = curl_easy_perform(my_curl_easy_handle);
        curl_slist_free_all (headerlist);
     return error;
}

I got the following output:

* About to connect() to pan.local port 22 (#0)
* Trying fe80::21d:4fff:fe4b:6ffd... * connected
* Connected to pan.local (fe80::21d:4fff:fe4b:6ffd) port 22 (#0)
* SSH authentication methods available: publickey,password,keyboard-
interactive
* Using ssh public key file /Users/vincent/.ssh/id_dsa.pub
* Using ssh private key file /Users/vincent/.ssh/id_dsa
* SSH public key authentication failed: Username/PublicKey combination
invalid
* Initialized password authentication
* Authentication complete
* Sending quote commands

I tried with different servers, it doesn't seems to be due to
authentication problem.

With latest libcurl snapshot, it also fails.

Anyone has an idea?

Thanks,

Vincent
Received on 2008-03-18