cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: FTP connect failing with error 9

From: Arun venkatesh <arun.madupu_at_gmail.com>
Date: Wed, 14 Sep 2011 15:29:28 +0530

okie..let us see this incrementally.. the code i have for ftp upload is

curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
hd_src = fopen("/home/user01/upload.txt", "rb");
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
curl_easy_setopt(curl,CURLOPT_USERNAME,"user01");
curl_easy_setopt(curl,CURLOPT_PASSWORD,"xyzabc");
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl,CURLOPT_URL,"ftp://192.168.1.3/upload.txt);
curl_easy_setopt(curl, CURLOPT_READDATA, hd_src);
res = curl_easy_perform(curl); *<-- returns 67*
curl_easy_cleanup(curl);
fclose(hd_src);
curl_global_cleanup();

output
=====
< 220-FileZilla Server version 0.9.36 beta
< 220-written by Tim Kosse (Tim.Kosse_at_gmx.de)
< 220 Please visit http://sourceforge.net/projects/filezilla/
> USER anonymous
< 331 Password required for anonymous
> PASS curl_by_daniel_at_haxx.se
< 530 Login or password incorrect!
* Access denied: 530
* Closing connection #0
* FTP: login denied

im not sure why teh USER and PASS commands are going anonymous though i have
set the username and password to a different ones..

the machine where ftp client is running is an Linux 64 Bit. ive updated curl
to 7.21.7.version. the Linux OS has come with default curl installation
which i think is much older version.

i have a similar setup on a fedora 32 Bit system and the above code works
pretty fine.

regards
arun

On Tue, Sep 13, 2011 at 8:34 PM, Dan Fandrich <dan_at_coneharvesters.com>
wrote:
> On Tue, Sep 13, 2011 at 05:36:43PM +0530, Arun venkatesh wrote:
>> correction...i mean to say upload to ftp server is failing with error
>> 9 to machine1, and error 25 to machine2.
>> im confused on this multiple error behaviour..however manually im able
>> to perform uploads
>
> Please don't top post. Two different error codes mean two different
reasons
> for a failed upload. The --ftp-method option might help with the first
> code. The reason for the second code isn't clear to me, given that you
> say an upload works using a different ftp client. Try enabling debugging
> in that client and curl and compare the two do see where the difference
> may be.
>
>>>> Dan
>
>> On Tue, Sep 13, 2011 at 5:16 PM, Arun venkatesh <arun.madupu_at_gmail.com>
wrote:
>> > hi all
>> > im using libcurl to connect to a remote ftp server. but API is failing
>> > with error 9 (ACCESS DENIED). However when i manually connect from
>> > bash shell of the soruce machine, i see ftp request is going through.
>> > can any one suggest the possible cause of this.
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

-- 
Apologizing doesn't mean that you are wrong and the other person is right.
It only means that you value the relationship much more than your EGO

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