Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.4k views
in .NET FTP by (800 points)
I am using the SecureFTPConnection and want to investigate if files exist in a particular directory on the server. When I call the GetFiles() method I get a ".: Permission denied (code=450)" error. The oSecureFTPConnection.DefaultPermissions = "0777". the UMask is "0022". What's even more weird is that I can call GetFileInfos() and have no problem looping through the list of Files and Directories. This is a bug that needs to be resolved or am I missing something?

8 Answers

0 votes
by (162k points)
Can you post the log file set to debug? The 450 is coming back from the server so it may be that the server is preventing you from issuing this command.
0 votes
by (800 points)
Here is the ErrorLog from trying to use the GetFiles() method. This makes no sense that you can't enum the files with the GetFiles() but you can with the GetFileInfos(). Also, I'm using the free EDT FTP Server for testing which in and of itself has problems with domains, user accounts and permissions.... Any help would be appriciated. TIA

INFO [LicenseProperties] 4 May 2007 08:36:24.067 : Licence expiry date: 6/23/2007
INFO [LicenseProperties] 4 May 2007 08:36:24.067 : Trial license
INFO [LicenseProperties] 4 May 2007 08:36:24.067 : Licence expiry date: 6/23/2007
INFO [LicenseProperties] 4 May 2007 08:36:24.082 : Trial license
DEBUG [SSLFTPClient] 4 May 2007 08:36:24.082 : Connecting to 137.107.195.19:21
DEBUG [HostNameResolver] 4 May 2007 08:36:24.082 : 137.107.195.19 resolved to 137.107.195.19
DEBUG [ExFTPControlSocket] 4 May 2007 08:36:24.098 : Connecting directly to ftp-server 137.107.195.19:21
DEBUG [ExFTPControlSocket] 4 May 2007 08:36:24.113 : Created control-socket: SocksContext=, RemoteHost=137.107.195.19, controlPort=21, timeout=0
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.607 : 220-You are accessing an edtFTPD server.
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.607 :
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.607 : You are accessing an edtFTPD server
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.607 : edtFTPD is a free component of the edt Platform
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.607 : Enterprise Distributed Technologies
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.607 : http://www.enterprisedt.com
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.607 :
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.607 : 220 ProFTPD 1.2.9 Server (ServerAuthCert) [DEV1.cs.myBox.net]
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.639 : ---> AUTH TLS
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.639 : 234 AUTH TLS successful
DEBUG [SSLFTPControlSocket] 4 May 2007 08:36:29.639 : Beginning Tls1 handshake.
DEBUG [SSLFTPControlSocket] 4 May 2007 08:36:29.795 : Tls1 handshake complete.
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.795 : ---> PBSZ 0
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.810 : 200 PBSZ 0 successful
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.810 : ---> PROT P
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.810 : 200 Protection set to Private
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.826 : ---> USER TestUser
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.826 : 331 Password required for TestUser.
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.826 : ---> PASS ********
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.935 : 230 User TestUser logged in.
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.951 : ---> TYPE I
DEBUG [EnterpriseDT.Net.Ftp.ExFTPConnection] 4 May 2007 08:36:29.951 : Starting KeepAlive thread with period 30s
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.951 : 200 Type set to I
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.951 : ---> PWD
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.951 : 257 "/" is current directory.
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.966 : ---> CWD /
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.966 : 250 CWD command successful.
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.966 : ---> PWD
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.982 : 257 "/" is current directory.
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.982 : ---> CWD /Testing
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.982 : 250 CWD command successful.
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.982 : ---> PWD
DEBUG [FTPControlSocket] 4 May 2007 08:36:29.998 : 257 "/Testing" is current directory.
DEBUG [FTPControlSocket] 4 May 2007 08:36:32.370 : ---> PASV
DEBUG [FTPControlSocket] 4 May 2007 08:36:32.386 : 227 Entering Passive Mode (137,237,165,19,19,41).
DEBUG [FTPControlSocket] 4 May 2007 08:36:32.386 : Server supplied address=137.107.195.19
DEBUG [FTPControlSocket] 4 May 2007 08:36:32.386 : Server supplied port=4905
DEBUG [FTPControlSocket] 4 May 2007 08:36:32.386 : Substituting server supplied IP (137.107.195.19) with remote host IP (137.107.195.19)
DEBUG [ExFTPControlSocket] 4 May 2007 08:36:32.386 : Connecting directly to ftp-server 137.107.195.19:4905
DEBUG [ExFTPPassiveDataSocket] 4 May 2007 08:36:32.401 : Created passive data-socket: SocksConnector=
DEBUG [SSLFTPPassiveDataSocket] 4 May 2007 08:36:32.401 : Created passive data-socket: Protocol=Tls1, CompatibilityFlags=Standard, UseSSLClosure=True, WaitOnClose=True
DEBUG [FTPControlSocket] 4 May 2007 08:36:32.401 : ---> NLST .
DEBUG [FTPControlSocket] 4 May 2007 08:36:32.401 : 450 .: Permission denied
DEBUG [SSLFTPPassiveDataSocket] 4 May 2007 08:36:32.417 : Closing passive data-channel.
DEBUG [SSLFTPPassiveDataSocket] 4 May 2007 08:36:32.417 : Beginning SSL closure exchange on passive data-channel.
DEBUG [SSLFTPPassiveDataSocket] 4 May 2007 08:36:32.417 : SSL closure exchange
DEBUG [SSLFTPPassiveDataSocket] 4 May 2007 08:36:32.417 : Passive data-channel closed
DEBUG [AsyncProcessor] 4 May 2007 08:36:37.568 : Stopping FTP task processor.
DEBUG [AsyncProcessor] 4 May 2007 08:36:37.568 : FTP task processor stopped.
DEBUG [FTPControlSocket] 4 May 2007 08:36:37.568 : ---> QUIT
DEBUG [FTPControlSocket] 4 May 2007 08:36:37.583 : 221 Goodbye.
DEBUG [SecureSocket] 4 May 2007 08:36:37.583 : Shutdown(Both)
ERROR [SocketController] 4 May 2007 08:36:37.646 : ResumeSending - caught exception - closing : System.Net.Sockets.SocketException: A request to send or receive data was disallowed because the socket had already been shut down in that direction with a previous shutdown call
System.Net.Sockets.SocketException: A request to send or receive data was disallowed because the socket had already been shut down in that direction with a previous shutdown call
at System.Net.Sockets.Socket.BeginSend(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)
at w.e()
DEBUG [TransferBuffer] 4 May 2007 08:36:37.708 : Close() called when open
DEBUG [EnterpriseDT.Net.Ftp.ExFTPConnection] 4 May 2007 08:36:37.927 : KeepAlive thread finished.
0 votes
by (162k points)
Here's a post that explains the problem

http://www.mail-archive.com/cygwin@cygwin.com/msg78790.html

A directory ownership problem by the looks.
0 votes
by (800 points)
OK, so if this appears to be the problem, would you mind enlightening me as to what is required to resolve it? When using your GUI to create a User Account, the user's root directory is created. Ever directory under that account should in theory have access granted to that user. The OS doesn't have these directories locked down and from what I can tell the Server's UI doesn't have this functionality either. From what I can tell their is no valid reason the directories and files should not be enum'd upon request. Other servers like Filezilla have no problems running the same exact edt client code against the same exact directories. unless cgywin is making up permissions somewhere that I'm missing then I'm not sure what your resolution explaination is.
0 votes
by (162k points)
What I would try is deleting the user's root directory and recreate it while logged in as that user. Some weird cygwin thing going on it seems.

Hope that helps ...
0 votes
by (800 points)
Continuing along this same vein of discussion. If I have a file which is in a subfolder of a user account's root directory but the user account does not have access to this file, the oSecureFTPConnection.DownloadFile() method has a bug. What happens is the connection is accepted and the file is enumerated via the GetFileInfos() method, but when trying to call the DownloadFile, it appears that the connections is closed (probably due to timing out). The DownloadFile() method never actually returns control back to the .NET application. It doesn't throw an Exception, it just dies and apparently closes the connection. Since this file happens to be the first file in the list of files to be processed, none of the other files will ever get processed because of this bug. I have try/catch blocks built in for exactly this purpose so I can continue processing if need be and inform users that a problem is occuring. Any suggestions or better yet plans to handle this method's return in a better fashion?

The FileZilla server shows the following:
(000152) 5/8/2007 14:28:08 PM - ftpclient (67.152.217.124)> SSL connection for data connection established
(000152) 5/8/2007 14:28:08 PM - ftpclient (67.152.217.124)> 226 Transfer OK
(000152) 5/8/2007 14:28:18 PM - ftpclient (67.152.217.124)> PASV
(000152) 5/8/2007 14:28:18 PM - ftpclient (67.152.217.124)> 227 Entering Passive Mode (10,5,1,31,3,222)
(000152) 5/8/2007 14:28:18 PM - ftpclient (67.152.217.124)> RETR ABC0010001.xml
(000152) 5/8/2007 14:28:18 PM - ftpclient (67.152.217.124)> 150 Connection accepted
(000152) 5/8/2007 14:28:18 PM - ftpclient (67.152.217.124)> 550 can't access file.
(000152) 5/8/2007 14:30:18 PM - ftpclient (67.152.217.124)> 421 Connection timed out.
(000152) 5/8/2007 14:30:18 PM - ftpclient (67.152.217.124)> disconnected.

The debug file show the following
DEBUG [FTPControlSocket] 8 May 2007 13:27:56.851 : 226 Transfer OK
DEBUG [FTPClient] 8 May 2007 13:27:56.851 : Found 1 listing lines
DEBUG [FTPFileFactory] 8 May 2007 13:27:56.867 : Parse() called using culture: Invariant Language (Invariant Country)
DEBUG [FTPControlSocket] 8 May 2007 13:28:06.320 : ---> PASV
DEBUG [FTPControlSocket] 8 May 2007 13:28:06.352 : 227 Entering Passive Mode (10,5,1,31,3,222)
DEBUG [FTPControlSocket] 8 May 2007 13:28:06.352 : Server supplied address=10.5.1.31
DEBUG [FTPControlSocket] 8 May 2007 13:28:06.352 : Server supplied port=990
DEBUG [FTPControlSocket] 8 May 2007 13:28:06.352 : Substituting server supplied IP (10.5.1.31) with remote host IP (142.146.191.241)
DEBUG [ExFTPControlSocket] 8 May 2007 13:28:06.352 : Connecting directly to ftp-server 142.146.191.241:990
DEBUG [ExFTPPassiveDataSocket] 8 May 2007 13:28:06.383 : Created passive data-socket: SocksConnector=
DEBUG [SSLFTPPassiveDataSocket] 8 May 2007 13:28:06.383 : Created passive data-socket: Protocol=Tls1, CompatibilityFlags=Standard, UseSSLClosure=True, WaitOnClose=True
DEBUG [FTPControlSocket] 8 May 2007 13:28:06.383 : ---> RETR ABC0010001.xml
DEBUG [FTPControlSocket] 8 May 2007 13:28:06.430 : 150 Connection accepted
DEBUG [SSLFTPPassiveDataSocket] 8 May 2007 13:28:06.430 : Beginning Tls1 handshake on passive data-channel
DEBUG [SocketController] 8 May 2007 13:28:06.445 : OnReceive - size == 0 - closing
DEBUG [TransferBuffer] 8 May 2007 13:28:06.461 : Close() called when open
DEBUG [SocketController] 8 May 2007 13:30:06.962 : OnReceive - size == 0 - closing
DEBUG [TransferBuffer] 8 May 2007 13:30:06.962 : Close() called when open
0 votes
by (162k points)
It seems that the 550 error isn't being received by the client.

What version of edtFTPnet/PRO are you using? We have made some recent changes to this code in 4.1.1 that may help (if you aren't using this version).
0 votes
by (800 points)
I will download an updated version of this dll. I am currently using version 4.0.5.0

Categories

...