cURL / Mailing Lists / curl-library / Single Mail

curl-library

The client FTP fails to change to the lowest subdirectory when uploading file.

From: Nageeb Khoury <nageeb.khoury_at_gmail.com>
Date: Sat, 28 Oct 2006 19:43:25 +0200

The FTP (.NET) client succeeds to do log on but it generates an error when
trying to change to the specific subdirectory where my files are located.
Researching the cause of the failure shows that the account has access to
the root and the lowest level directory, but not on the directories in
between. Assigning the directories in between READ or LIST permission to
user01 solves the problem, but this is not what want to do.
Traces show that the CURL switches to the lowest directory by doing a
mulitple change directory (CDW ) for each part in the path (directories in
between) and not in one step to entire path. Filezilla client succeeds to
switch without problem.
My .NET client references the LibCurlNet.dll 1.3 with binding 7.13 (
libcurl.dll).

I have tried the following:
1) Run commands prior to the request; like add CWD to the slist. Log shows
that commands succeeds but at the end i get error in the log
(CURLE_FTP_ACCESS_DENIED in the code) which appearantly happens when trying
to execute the request after the command is executed. It could buggy
implementation from my side or a possible bug in the CURL code.
FTP Log throws one of the following errors: (depends on if i do CWD to
/Group/user01 in the code)

CWD Group
550 CWD failed. "/Group/user01/Group": directory not found.

or

CWD Group
550 CWD failed. "/Group": Permission denied.

(Please see detailed log below)

Here a part of my code (Code to upload a file myapp.zip)

            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);
            Easy easy = new Easy();
            easy.SetOpt(CURLoption.CURLOPT_URL, "
ftp://server1:21/Group/user01/myapp.zip<ftp://server1/Group/user01/myapp.zip>
");
            easyCom.SetOpt(CURLoption.CURLOPT_USERPWD,"user01:user01"]);
            easy.SetOpt(CURLoption.CURLOPT_FTP_USE_EPSV, true);

            Easy.DebugFunction df = new Easy.DebugFunction(OnDebug);
            easy.SetOpt(CURLoption.CURLOPT_DEBUGFUNCTION, df);
            easy.SetOpt(CURLoption.CURLOPT_VERBOSE, true);

            slist slist = new Slist();
            slist.Append("CWD /Group/user01");
            easy.SetOpt(CURLoption.CURLOPT_QUOTE, slist);
            //easy.SetOpt(CURLoption.CURLOPT_FTP_FILEMETHOD,
CURLftpmethod.CURLFTPMETHOD_SINGLECWD);

            Easy.ReadFunction rf = new Easy.ReadFunction(OnReadData);
            easy.SetOpt(CURLoption.CURLOPT_UPLOAD,true);
            easy.SetOpt(CURLoption.CURLOPT_READFUNCTION,rf);
            easy.SetOpt(CURLoption.CURLOPT_READDATA,str);
            easy.SetOpt(CURLoption.CURLOPT_ERRORBUFFER,true);
            retVal = easy.Perform();

            slist.FreeAll();
            easy.Cleanup();
            Curl.GlobalCleanup();

2) I set the url = ftp://server1:21/ <ftp://server1/>. added the command
"CWD /Group/user01" prior to the upload. In this case i succeeded to
uploaded but the name set to "nil".

 3) I have tried to do the test 1 by changing the LibCurlNet.dll code by
adding CURLoption.CURLOPT_FTP_FILEMETHOD to the Enums.cs and using curl lib
v7.15 but without success.

=============================================
 My FTP Server Configuration
(I use Filezilla Server for replication)
=============================================

I have assigned user01 the following permissions to each of following
folders

/ c:\FTP Home Directory; LIST, READ
/Group c:\FTP\Group No Permissions for user01
/Group/User01 c:\FTP\Group\user01 Full Permissions for user01

I have set my FTP client application to connect to the FTP Server
/Group/user01

My connection configuration:
=============================
Server Name or IP = server1
Port = 21
Path = /Group/user01
fileName = myapp.zip (file to uploaded)
User = user01
Password = user01
Ftp Mode = Passive
Connection Type = FTP/FTPS
FTP log:
========

220 FTP Server (Server1)
AUTH SSL
502 SSL/TLS authentication not allowed
AUTH TLS
502 SSL/TLS authentication not allowed
USER user01
331 Password required for user01
PASS user01
230 Logged on
We have successfully logged in
PWD
257 "/" is current directory.
Entry path is '/'
CWD /Group/user01/
250 CWD successful. "/Group/user01" is current directory.
CWD Group
550 CWD failed. "/Group/user01/Group": directory not found.
Couldn't CWD to Group
Remembering we are in dir Group/user01/myapp.zip
Connection #0 to host <Server 1 ip> left intact
Received on 2006-10-28