cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: SFTP Command Execution

From: Patrik Thunström <patrik.thunstrom_at_bassetglobal.com>
Date: Wed, 07 Jul 2010 10:02:27 +0200

Paul Romero skrev 2010-07-04 20:25:
> Dear Group:
>
> It seem that CURLOPT_QUOTE and CURLOPT_PREQUOTE
> don't work for libcurl 7.21.0 for SFTP. For instance, consider
> the following example:
>
> struct curl_slist *paction = NULL;
> ....
> curl_slist_append(paction, "rm x.c");
> curl_easy_setopt(hnd, CURLOPT_QUOTE, paction);
> ...
> curl_perform(hnd);
>
> The connection to the SFTP server works and the file
> is fetched but the file x.c is not removed. Also, I
> am not sure how to verify that the rm command--or
> any other succeeded, with the API. Does this feature
> work, and if so, is there something important I am
> forgetting ?
>
> Best Regards,
>
> Paul R.
>
>
> --
> Paul Romero
>
> RCOM Communications Software
>
> Phone/Fax: (510)339-2628
> E-Mail: paulr_at_rcom-software.com
>
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

The error I can see from a quick analysis is your
curl_slist_append()-operation.
The return value for this operation is the new list, and hence you
should set your list pointer to the return value;

paction = curl_slist_append(paction, "rm x.c");

Also, as from the snippet you provide, the value of paction would still
be NULL unless you set it to something else along the way, so you set
the QUOTE-command list to NULL.

Can't promise it will solve things for you, but it's something that does
not look quite allright.

Best Regards
Patrik Thunström

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-07-07