PDA

View Full Version : Issues with FTP server and client features



Ynn
March 31st, 2018, 01:20 PM
Hi there,

I am surprised as I cant use FTP to connect to/from foobar2000 mobile app (beta 1.1.10 on Android 7.0 Galaxy A3 2017).

* From foobar2000 mobile app to my NAS
I entered the address as ftp://user:password@host:port, but I get following error:
cannot be accessed, reason:
FTP: 503, bad sequence of command

However, using another FTP client app (ES explorer), everything works fine.

* From my Linux PC (Debian 9.4 amd64) to foobar200 mobile (FTP server on):
If run from a terminal:
$ ftp IP_ADDRESS:PORT
I get:
ftp: IP_ADDRESS:PORT: Name or service not known
ftp>

Are there still some bugs with FTP server/client in Android version?
Does anybody succeed with such tasks?

Thank you

Ynn

Ynn
April 5th, 2018, 11:13 AM
Some clarifications about my post (because of unexpected emojis) :
* From foobar2000 mobile app to my NAS
I entered the address as
ftp://user:password@host:port/but I get following error:

cannot be accessed, reason:
FTP: 503, bad sequence of command

Peter
April 6th, 2018, 07:29 AM
Thanks for the bug report. What exact NAS model is this and what FTP software is it running? Do you know of a public server that I can test this against?


As for connecting from Linux ftp command, it does not take address in IP_ADDRESS:PORT format, the syntax (according to man ftp) is:
ftp -46pinegvd [host [port]]
So the command will typically look like:
ftp 192.168.0.NN 2100

( We don't use the standard FTP port 21 as Android system doesn't let us, as far as I know )

Ynn
April 7th, 2018, 06:55 AM
Thanks for your answer.

I could finally get access to the FTP server running by foobar2000 mobile on my Smartphone. Using the proper command helped! :p Problem fixed.

About the access to my NAS, it is the one provided by my french Internet Access Provider (Free). It is integrated in the modem. The model is Freebox Server (v6) and here is an incomplete list of the softwares (opensource) with patches running on it: https://floss.freebox.fr/freebox_server/3.2.0/index.html. I could make some screenshots of the full list of software
259
260
261
I could not manage to find which one is used for FTP.

I can configure a temporary password to let you make some tests, but with distant access it is ftpes address/protocol (which is not supported in foobar2000 mobile I guess).
Should I send you the FTP address, login and password by PM ?

Peter
April 7th, 2018, 03:04 PM
About the NAS-
If you connect to it using Linux "ftp" command, what lines does it print before asking for login? It should report exact FTP server software and version there.
Example from my own NAS:

[~] * ftp localhost
Connected to localhost.
220 NASFTPD Turbo station 1.3.5a Server (ProFTPD)

Ynn
April 9th, 2018, 02:48 AM
Here is what is printed once I am connecting to the NAS, it does not provide much...

$ ftp -nv mafreebox.freebox.fr
Connected to mafreebox.freebox.fr.
220 Welcome to Freebox FTP Server.
ftp>
I will try to find more info about the hardware and software.

Peter
April 9th, 2018, 07:54 AM
I made a test program with standalone version of my FTP code-
https://www.foobar2000.org/temp/pp-ftp-test.exe
It's a Windows commandline program, it takes ftp:// URL as an argument, connects and retrieves the file or folder listing, printing every step that it performed. The output should contain all the necessary info about why it fails. No files are read or written on your computer.
Note that the output will contain your FTP password, you might want to sanitize the PASS line.

Ynn
April 10th, 2018, 02:59 AM
Thank you for this program.
here is the results (note that it did not work with my VirtualBox Win7 guest, but seems ok with wine under linux) :

$ wine pp-ftp-test.exe ftp://freebox:**********************@mafreebox.freebox.f r/MEDIA_CY-YG
>> 220 Welcome to Freebox FTP Server.
<< USER freebox
>> 331 User name okay, need password.
<< PASS *******************
>> 230 User logged in, proceed.
<< OPTS UTF8 ON
>> 200 Command Okay.
<< TYPE I
>> 200 Command Okay.
<< MLST /MEDIA_CY-YG
>> 500 Syntax error, command unrecognized.
<< CWD /
>> 250 directory changed to /
<< PASV
>> 227 PASV OK (212,27,38,253,7,228)
<< LIST
>> 150 File Status OK.
>> 226 Closing data connection.

With a specific directory :

$ wine pp-ftp-test.exe ftp://freebox:*****************@mafreebox.freebox.fr/MEDIA_CY-YG
>> 220 Welcome to Freebox FTP Server.
<< USER freebox
>> 331 User name okay, need password.
<< PASS *************
>> 230 User logged in, proceed.
<< OPTS UTF8 ON
>> 200 Command Okay.
<< TYPE I
>> 200 Command Okay.
<< MLST /MEDIA_CY-YG
>> 500 Syntax error, command unrecognized.
<< CWD /
>> 250 directory changed to /
<< PASV
>> 227 PASV OK (212,27,38,253,7,228)
<< LIST
>> 150 File Status OK.
>> 226 Closing data connection.

Peter
April 10th, 2018, 03:54 AM
Thanks, we're making progress here.
New version of the test program, will report more info (specifically print what LIST returned):
https://www.foobar2000.org/temp/pp-ftp-test-v2.exe

Please repeat the same procedure with the new exe and post the output.

Ynn
April 11th, 2018, 04:09 AM
Thanks again for you help. Here are the results of 3 commands.
At the root of the ftp:

wine pp-ftp-test-v2.exe ftp://freebox:****************@mafreebox.freebox.fr/
>> 220 Welcome to Freebox FTP Server.
<< USER freebox
>> 331 User name okay, need password.
<< PASS *****************
>> 230 User logged in, proceed.
<< OPTS UTF8 ON
>> 200 Command Okay.
<< TYPE I
>> 200 Command Okay.
Type: dir
<< CWD /
>> 250 directory changed to /
<< PASV
>> 227 PASV OK (212,27,38,253,7,228)
<< MLSD
>> 500 Syntax error, command unrecognized.
<< PASV
>> 503 Bad sequence of command.
Failure: FTP: 503 Bad sequence of command.



For a specific directory:

$ wine pp-ftp-test-v2.exe ftp://freebox:**************@mafreebox.freebox.fr/MEDIA_CG-YG
>> 220 Welcome to Freebox FTP Server.
<< USER freebox
>> 331 User name okay, need password.
<< PASS ***************************
>> 230 User logged in, proceed.
<< OPTS UTF8 ON
>> 200 Command Okay.
<< TYPE I
>> 200 Command Okay.
<< MLST /MEDIA_CG-YG
>> 500 Syntax error, command unrecognized.
<< CWD /
>> 250 directory changed to /
<< PASV
>> 227 PASV OK (212,27,38,253,7,228)
<< LIST
>> 150 File Status OK.
>> drwxr-xr-x 4 freebox freebox 80 Dec 31 2008 ..
>> drwxr-xr-x 11 freebox freebox 131072 Jan 01 1970 MEDIA_CG-YG
>> drwxr-xr-x 8 freebox freebox 4096 Aug 24 2016 Disque dur
>> 226 Closing data connection.
File size: 131072
Last modified: 19700101000000
Type: dir
<< CWD /MEDIA_CG-YG
>> 250 directory changed to /MEDIA_CG-YG/
<< PASV
>> 227 PASV OK (212,27,38,253,7,228)
<< MLSD
>> 500 Syntax error, command unrecognized.
<< PASV
>> 503 Bad sequence of command.
Failure: FTP: 503 Bad sequence of command.



Note that it does not behave the same way if the path end with a slash:

$ wine pp-ftp-test-v2.exe ftp://freebox:**************@mafreebox.freebox.fr/MEDIA_CG-YG/
>> 220 Welcome to Freebox FTP Server.
<< USER freebox
>> 331 User name okay, need password.
<< PASS **************
>> 230 User logged in, proceed.
<< OPTS UTF8 ON
>> 200 Command Okay.
<< TYPE I
>> 200 Command Okay.
<< MLST /MEDIA_CG-YG/
>> 500 Syntax error, command unrecognized.
<< CWD /MEDIA_CG-YG
>> 250 directory changed to /MEDIA_CG-YG/
<< PASV
>> 227 PASV OK (212,27,38,253,7,228)
<< LIST
>> 150 File Status OK.
>> drwxr-xr-x 4 freebox freebox 80 Dec 31 2008 ..
>> drwxr-xr-x 5 freebox freebox 131072 Apr 17 2016 Videos
>> drwxr-xr-x 2 freebox freebox 131072 Sep 09 2009 BUDA
>> -rwxr-xr-x 1 freebox freebox 714600448 Sep 04 2015 buda_vfs.img
>> drwxr-xr-x 8 freebox freebox 131072 Nov 19 2017 Photos
>> drwxr-xr-x 5 freebox freebox 131072 Jan 01 1980 DVR
>> drwxr-xr-x 2 freebox freebox 131072 Jul 31 2016 $RECYCLE.BIN
>> drwxr-xr-x 2 freebox freebox 131072 Aug 12 2016 System Volume Information
>> drwxr-xr-x 8 freebox freebox 131072 Mar 31 13:04 A_trier
>> drwxr-xr-x 2 freebox freebox 131072 Oct 16 2017 Softwares
>> drwxr-xr-x 9 freebox freebox 131072 Jan 19 2014 Musique
>> 226 Closing data connection.
Failure: file not found

Peter
April 11th, 2018, 04:18 AM
Thanks, this explains pretty much everything, expect new update (1.1.13) shortly.

I need to specifically detect supported FTP server features on connect instead of checking return codes, as the server gets confused with repeated PASV when we try to use MLSD for retrieving directory listing.

Ynn
April 12th, 2018, 07:02 AM
Thanks. Problem fixed with version 1.1.13.