troglobit / uftpd

FTP/TFTP server for Linux that just works™
https://troglobit.com/projects/uftpd/
ISC License
182 stars 32 forks source link

MLST issues #36

Closed unxed closed 2 years ago

unxed commented 3 years ago

Looks like uftpd's MLST support is buggy. Details: https://github.com/elfmz/far2l/issues/1067#issuecomment-907857145

troglobit commented 3 years ago

Thanks for letting me know, and sorry for the late reply! I'm entering a new release cycle with uftpd and I'll have a look at it.

troglobit commented 2 years ago

Reproduced with tnftp in Linux Mint. Seems to be localized to MLST, MLSD works ... at least with ncftp. Will continue testing and see if I can get this fix into the v2.14 release, which I've planned for this coming weekend.

troglobit commented 2 years ago

Fixed in https://github.com/troglobit/uftpd/releases/tag/v2.14

unxed commented 2 years ago

Can't test on Ubuntu 18.04:

curl -sS https://deb.troglobit.com/pubkey.gpg | sudo apt-key add -
echo "deb [arch=amd64] https://deb.troglobit.com/debian stable main" | sudo tee /etc/apt/sources.list.d/troglobit.list
sudo apt-get update && sudo apt-get install uftpd                                                                      ↑
...
The following packages have unmet dependencies:
 uftpd : Depends: libc6 (>= 2.28) but 2.27-3ubuntu1.4 is to be installed
E: Unable to correct problems, you have held broken packages.
troglobit commented 2 years ago

Source is available. I have no means to support all possible deb targets.

elfmz commented 2 years ago

i tried recent master and seems it fixed now, however another (new) issue appeared: each file is listed twice in LIST command. Server ran by ./uftpd -n -o ftp=2222 /home/user on machine 192.168.1.X, connecting with netcat from another machine to it:

$nc 192.168.1.X 2222
220 uftpd (2.14) ready.
user anonymous
230 Guest login OK, access restrictions apply.
PASV 192,168,1,X
227 Entering Passive Mode (192,168,1,X,215,169)
LIST
125 Data connection already open; transfer starting.
226 Transfer complete.

.. and another netcat connected just after PASV command responce:

$ nc 192.168.1.X 55209
-rw------- 1     0     0         6211 Sep 28 01:03 .bash_history
-rw-r--r-- 1     0     0          220 May  8 00:44 .bash_logout
-rw-r--r-- 1     0     0         3771 May  8 00:44 .bashrc
drwx------ 1     0     0         4096 Aug 18 18:18 .cache
drwxr-xr-x 1     0     0         4096 Sep 29 10:39 .config
-rw-rw-r-- 1     0     0          230 Jun 14 15:38 .gitconfig
drwx------ 1     0     0         4096 Jun 27 12:56 .gnupg
drwxr-xr-x 1     0     0         4096 Jun 17 20:36 .local
drwx------ 1     0     0         4096 Nov  2 13:27 .mozilla
-rw-r--r-- 1     0     0          354 Oct  6 21:42 .pam_environment
-rw-r--r-- 1     0     0          807 May  8 00:44 .profile
-rw------- 1     0     0           30 Jul 22 00:57 .python_history
-rw-rw-r-- 1     0     0           72 Oct 25 23:09 .selected_editor
drwx------ 1     0     0         4096 Jun 28 01:47 .ssh
-rw-r--r-- 1     0     0            0 May  8 01:18 .sudo_as_admin_successful
drwx------ 1     0     0         4096 Jun  1 00:06 .thunderbird
-rw-rw-r-- 1     0     0          993 Sep 26 02:10 .wget-hsts
drwxr-xr-x 1     0     0         4096 May  8 01:17 Desktop
drwxr-xr-x 1     0     0         4096 May  8 01:17 Documents
drwxr-xr-x 1     0     0         4096 May  8 01:17 Downloads
drwxr-xr-x 1     0     0         4096 May  8 01:17 Music
drwxr-xr-x 1     0     0         4096 Oct  9 12:01 Pictures
drwxr-xr-x 1     0     0         4096 May  8 01:17 Public
drwxr-xr-x 1     0     0         4096 May  8 01:17 Templates
drwxr-xr-x 1     0     0         4096 May  8 01:17 Videos
drwxrwxr-x 1     0     0         4096 Mar 16 17:27 mnt
drwx------ 1     0     0         4096 Jun 17 20:33 snap
drwxrwxr-x 1     0     0         4096 Dec 11 23:01 test
-rw------- 1     0     0         6211 Sep 28 01:03 .bash_history
-rw-r--r-- 1     0     0          220 May  8 00:44 .bash_logout
-rw-r--r-- 1     0     0         3771 May  8 00:44 .bashrc
drwx------ 1     0     0         4096 Aug 18 18:18 .cache
drwxr-xr-x 1     0     0         4096 Sep 29 10:39 .config
-rw-rw-r-- 1     0     0          230 Jun 14 15:38 .gitconfig
drwx------ 1     0     0         4096 Jun 27 12:56 .gnupg
drwxr-xr-x 1     0     0         4096 Jun 17 20:36 .local
drwx------ 1     0     0         4096 Nov  2 13:27 .mozilla
-rw-r--r-- 1     0     0          354 Oct  6 21:42 .pam_environment
-rw-r--r-- 1     0     0          807 May  8 00:44 .profile
-rw------- 1     0     0           30 Jul 22 00:57 .python_history
-rw-rw-r-- 1     0     0           72 Oct 25 23:09 .selected_editor
drwx------ 1     0     0         4096 Jun 28 01:47 .ssh
-rw-r--r-- 1     0     0            0 May  8 01:18 .sudo_as_admin_successful
drwx------ 1     0     0         4096 Jun  1 00:06 .thunderbird
-rw-rw-r-- 1     0     0          993 Sep 26 02:10 .wget-hsts
drwxr-xr-x 1     0     0         4096 May  8 01:17 Desktop
drwxr-xr-x 1     0     0         4096 May  8 01:17 Documents
drwxr-xr-x 1     0     0         4096 May  8 01:17 Downloads
drwxr-xr-x 1     0     0         4096 May  8 01:17 Music
drwxr-xr-x 1     0     0         4096 Oct  9 12:01 Pictures
drwxr-xr-x 1     0     0         4096 May  8 01:17 Public
drwxr-xr-x 1     0     0         4096 May  8 01:17 Templates
drwxr-xr-x 1     0     0         4096 May  8 01:17 Videos
drwxrwxr-x 1     0     0         4096 Mar 16 17:27 mnt
drwx------ 1     0     0         4096 Jun 17 20:33 snap
drwxrwxr-x 1     0     0         4096 Dec 11 23:01 test

Although command line ftp client shows only single file, likely it 'deduplicates' them internally. FileZilla for Windows however also shows duplicated entries in list.

elfmz commented 2 years ago

Too early assumed that MLST works, it works only for directories, but always fails for files. Here is log from netcat to uftpd:

$ nc 192.168.1.X 2222
220 uftpd (2.14) ready.
user anonymous
230 Guest login OK, access restrictions apply.
CWD test
250 OK
MLST zz
250- Listing zz
modify=20210810115151;perm=lepc;type=dir; zz
250 End.
mlst linux.iso
550 No such file or directory.

Here is netcat session to pure-ftpd running on same machine:

$ nc 192.168.1.X 21
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 00:10. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
user XXX
331 User user OK. Password required
pass XXX
230 OK. Current directory is /home/user
CWD test
250 OK. Current directory is /home/user/test
MLST zz
250-Begin
 type=dir;sizd=4096;modify=20210810085151;UNIX.mode=0775;UNIX.uid=1000;UNIX.gid=1000;unique=805g4207af; zz
250 End.
MLST linux.iso
250-Begin
 type=file;size=69797888;modify=20200623060543;UNIX.mode=0664;UNIX.uid=1000;UNIX.gid=1000;unique=805g4011d3; linux.iso
250 End.
troglobit commented 2 years ago

Dammit, OK reopening :disappointed:

Reproduced both issues, files listed twice, and mlst not working on files. Naturally the new one needs to go in its own bug report as a regression introduced in the latest release. I'll see what I can do over the next couple of days.

Thank you all for testing and reporting back!

troglobit commented 2 years ago

OK @elfmz, I've just pushed a bunch of changes to master which seem to fix the issues you reported. I'll probably do the v2.15 release later tonight, but I can postpone it if you'd like to help verify it first. Which I'd be very grateful for, of course! :smiley:

elfmz commented 2 years ago

Didnt tested really throughfully, but current master looks now OK - both last issues not reproduced.

troglobit commented 2 years ago

Awesome, thank you for testing it out! <3

troglobit commented 2 years ago

Release v2.15 is out now.

Huge thanks to everyone for reporting, testing, and hanging in there! Merry Christmas :santa: