EldoS | Feel safer!

Software components for data protection, secure storage and transfer

FTP client problem

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#34051
Posted: 07/16/2015 11:13:01
by Katit (Basic support level)
Joined: 09/19/2013
Posts: 14

Hello!

I've been using my code for a long time and it's been working just fine. Now, I encountered server with a problem. It's a first server that required ACTIVE mode. Fine, I set client to active mode and all is well on writing files to server. However, I can't read files. Here is commands I run:

Code
// Connect to FTP and open in folder:
var client = this.GetFtpClient(connection);
client.Cwd(connection.FtpOutgoingFolder);

// Get list of files:
var fileList = new ArrayList();
client.GetFileList(string.Empty, fileList);
            
// Get files one by one
foreach (var teiFileInfo in fileList.OfType<TElFTPFileInfo>().Where(teiFileInfo => teiFileInfo.FileType == 2))


Connect, set folder (Cwd) and get list of files. If I connect with FileZilla, there is files in there. But GetFileList does not return anything. And there is no exceptions. Basically it behaves like there is nothing in folder.

What can I be missing?
#34052
Posted: 07/16/2015 12:16:45
by Eugene Mayevski (EldoS Corp.)

I’ve noticed there is no license ticket linked to your user account on EldoS site. Support is provided to customers with the linked license tickets. You will find your license ticket together with all the details about how to use it in the registration e-mail that we’ve sent to you upon the purchase.

If you are evaluating the product and don't have a license yet, please let us know and then you can have support according to Basic support level. Basic support level includes answering basic technical questions that appear during product evaluation period.


Sincerely yours
Eugene Mayevski
#34059
Posted: 07/16/2015 16:02:59
by Ivan Demkovitch (Standard support level)
Joined: 11/10/2013
Posts: 23

Hm. I see it linked..

EDIT: I got it, it was probably old account. This is correct account (under which I posted now)
#34061
Posted: 07/16/2015 17:38:36
by Ivan Demkovitch (Standard support level)
Joined: 11/10/2013
Posts: 23

Also, if needed, I can provide FTP credentials via PM
#34065
Posted: 07/17/2015 04:44:07
by Vsevolod Ievgiienko (EldoS Corp.)

Hello.

First of all please try to connect and list files using our sample project. It the same problem occurs, then please post sample log here and we'll ask you for credentials to reproduce the problem.
#34066
Posted: 07/17/2015 11:37:32
by Ivan Demkovitch (Standard support level)
Joined: 11/10/2013
Posts: 23

I did try sample project and it did work. But it doesn't work.. Let me explain... See full log. Connect to server, cwd to folder and list files. If you see - there is 2 LIST commands. First one lists files and second one doesn't. Code below..

Code
<<<220 Cleo VLProxy/3.2.5 FTP server ready.

>>>USER ATURFTP
<<<331 Password required for ATURFTP (30a2b5c7db3b1868).

>>>PASS A$r390sP
<<<230 User ATURFTP logged in on port: 10648 from: 168.218.95.186. There are 10 current logins. SessionID=3938

>>>FEAT
<<<211-Extensions supported:
MDTM
SIZE
REST STREAM
XMKD
XPWD
211 End

>>>CWD fromRyder
<<<250 CWD command successful.

>>>PWD
<<<257 "/fromRyder" is current directory.

>>>TYPE A
<<<200 Type set to A.

>>>PORT 192,168,33,106,41,154
<<<200 PORT command successful.

>>>LIST
<<<150 ASCII data connection (/168.218.95.186,32537).

-rw-rw-rw-  1              generic            265 Jul 07 13:15 RYD997ATUR.20150707131506298.1267174402.txt
-rw-rw-rw-  1              generic            482 Jul 15 18:50 RYD997ATUR.20150715185005591.1273183899.txt
-rw-rw-rw-  1              generic            234 Jul 16 12:10 RYD997ATUR.20150716121005388.1273754210.txt
-rw-rw-rw-  1              generic            234 Jul 16 12:20 RYD997ATUR.20150716122005436.1273760433.txt
-rw-rw-rw-  1              generic            234 Jul 17 11:00 RYD997ATUR.20150717110004184.1274523695.txt
<<<226 ASCII transfer complete.

>>>TYPE A
<<<200 Type set to A.

>>>PORT 192,168,33,106,41,156
<<<200 PORT command successful.

>>>LIST
<<<150 ASCII data connection (/168.218.95.186,1593).

<<<226 ASCII transfer complete.


This is slightly modified sample code. First line is simple List command from your sample, list obtained via callback function _OnTextDataLine. But in our software I use return parameter, this is second command I added and it works for all we did until now.

Code
Log("Listing directory...", false);
Client.GetFileList();

var fileList = new ArrayList();
Client.GetFileList(string.Empty, fileList);

Log("Directory list retrieved", false);
#34089
Posted: 07/22/2015 12:33:25
by Ivan Demkovitch (Standard support level)
Joined: 11/10/2013
Posts: 23

Any help on this issue?
#34090
Posted: 07/22/2015 13:19:11
by Eugene Mayevski (EldoS Corp.)

I am sorry about the delay.

Do I understand it right, that GetFileList method fails while LIST command works?

It looks like the parser doesn't understand the format used by the server and so it can't provide a listing.

The roots of the problem lie in the FTP standard, which does not specify how the directory listing must be provided. Consequently each server uses its own format. There exist over 400 (maybe even more) formats used by different servers.

SecureBlackbox implements the parsers for Unix and Windows formats, two the most popular ones.

There was an extension to the standard defined some time ago, shortly named MLST. This is a command (two commands, MLST and MLSD) which produce the listing in machine-readable format. Not all servers support it though. Yours doesn't (support for MLST is advertised in the response to FEAT command).

When MLSD is supported, SecureBlackbox tries to use it. In your situation, unfortunately the only option is to write your own parser.

This task is not very complicated -- you can use TElStringTokenizer class to split each string into tokens, then take the last token. The only complication can be if file names have spaces in them. In this case your parser would need to find the token that "looks like time" (eg. 13:15) and then use the rest of tokens and concatenate them back to make a file name.

TElStringTokenizer class corresponds to the Java StringTokenizer.


Sincerely yours
Eugene Mayevski
#34091
Posted: 07/22/2015 13:31:04
by Ivan Demkovitch (Standard support level)
Joined: 11/10/2013
Posts: 23

GetFileList() works, it sends output to _OnTextDataLine event

GetFileList(params, out list) does not work. Returned list is empty and _OnTextDataLine event not fired. It doesn't fail, there is no exceptions thrown. It returns empty list.


I'm puzzled as I don't know how to approach it, it's a part of a system, we don't write cleint for each FTP server. So, if X number of connections work just fine, what should I change and how to make this new connection work?

I Understand if I got List back but TElFtpFileInfo objects didn't have fields populated or I got list of not parsed strings - then I can deal with it. But now structure of the code have to be changed.

Any suggestions?
#34092
Posted: 07/22/2015 14:36:17
by Eugene Mayevski (EldoS Corp.)

Quote
Ivan Demkovitch wrote:
GetFileList() works, it sends output to _OnTextDataLine event

GetFileList(params, out list) does not work. Returned list is empty and _OnTextDataLine event not fired. It doesn't fail, there is no exceptions thrown. It returns empty list.


This corresponds to what I have described in the previous message. GetFileList() lets response strings pass to the event handler. The overload which accepts TElList (ArrayList) as a second parameter grabs the list of strings (so they don't go to the event handler) and attempts to parse those strings. Parsing fails due to what I have described above.

Quote
Ivan Demkovitch wrote:
I Understand if I got List back but TElFtpFileInfo objects didn't have fields populated or I got list of not parsed strings - then I can deal with it. But now structure of the code have to be changed.


... or we need to change the implementation of GetFileList, breaking the existing logic. You have suggested a good idea to create a list of TElFtpFileInfo objects and return the unparsed strings in those objects somehow.

This is something we can do in the next version (verison 14, which we preliminary plan for October). We can't do this now, because this can have unexpected effects on other users' code.

As you are using version 11, I don't have any solution for you other than making additions to your code (which needs to be amended to parse the strings anyway).


Sincerely yours
Eugene Mayevski
Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.

Reply

Statistics

Topic viewed 4850 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!