Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compateble with KDE dolphin ftp client #18

Closed
garywill opened this issue Mar 14, 2019 · 7 comments
Closed

Not compateble with KDE dolphin ftp client #18

garywill opened this issue Mar 14, 2019 · 7 comments

Comments

@garywill
Copy link

Filzilla works fine as client. But when I use KDE dolphin as ftp client, I can't list files.

$ ./uftpd -l debug -n -o ftp=2121 -o writable /
30668> Initializing ...
30668> Serving files as PID 30668 ...
30668> Starting services ...
30668> Opened socket for port 2121
30668> Starting FTP server on port 2121 ...
30668> Not allowed to start TFTP service.  Privileged port.
30668> Serving files from / ...
30668> Created new client session as PID 30669
30669> Client connection from 127.0.0.1
30669> Sent: 220 uftpd (2.7) ready.

30669> Recv: USER user
30669> Sent: 331 Login OK, please enter password.

30669> Recv: PASS 1
30669> User user login from 127.0.0.1
30669> Sent: 230 Guest login OK, access restrictions apply.

30669> Recv: SYST 
30669> Sent: 215 UNIX Type: L8

30669> Recv: PWD 
30669> Sent: 257 "/"

30669> Recv: PASV 
30669> Data server port estabished.  Waiting for client connnect ...
30669> Sent: 227 Entering Passive Mode (127,0,0,1,207,83)

30669> Event on data_listen_sd ...
30669> Client PASV data connection from 127.0.0.1:35518
30669> No pending command, waiting ...
30669> Recv: list -la
30669> Sent: 500 command 'list' not recognized by server.

30669> Recv: TYPE I
30669> Sent: 200 Type set to I.

30669> Recv: PASV 
30669> Data server port estabished.  Waiting for client connnect ...
30669> Sent: 227 Entering Passive Mode (127,0,0,1,175,129)

30669> Event on data_listen_sd ...
30669> Client PASV data connection from 127.0.0.1:34142
30669> No pending command, waiting ...
30669> Recv: list 
30669> Sent: 500 command 'list' not recognized by server.

30669> Recv: SIZE /
30669> Compose path from cwd: , arg: /
30669> Server path from CWD: /
30669> Resulting non-chroot path: /
30669> Sent: 550 No such file, or argument is a directory.

@troglobit
Copy link
Owner

OK, I see two bugs here:

  1. The client sends all commands in CAPS except for 'list', or 'list -la' -- the client should send LIST, but admittedly uftpd should handle mixed caps as well
  2. Absolute path argument to uftpd seems to have stopped working

Thanks for the report, I'll look into it!

troglobit added a commit that referenced this issue Mar 15, 2019
@troglobit
Copy link
Owner

Should be fixed now. If you have chance, I'd be grateful if you could verify the fix. Hopefully I can get a fully-tested release out during the weekend.

@garywill
Copy link
Author

Thank you for the work!
If you upload a linux x64 binary to somewhere so I can get it run easily , I will be able to verify soon

@troglobit
Copy link
Owner

troglobit commented Mar 15, 2019

Uh, I'm not really comfortable distributing binaries to end-users ... but here goes. It's statically linked and packed with upx: http://ftp.troglobit.com/uftpd/uftpd

@garywill
Copy link
Author

I tested it.
I can connect with dolphin. There's always an "a" in the path

$ ./uftpd -l debug -n -o ftp=2121 -o writable .
17469> Initializing ...
17469> Serving files as PID 17469 ...
17469> Starting services ...
17469> Opened socket for port 2121
17469> Starting FTP server on port 2121 ...
17469> Not allowed to start TFTP service.  Privileged port.
17469> Serving files from /dev/shm/mem ...
17469> Created new client session as PID 17470
17470> Client connection from 127.0.0.1
17470> Sent: 220 uftpd (2.7) ready.

17470> Recv: USER anonymous
17470> Guest logged in from 127.0.0.1
17470> Sent: 230 Guest login OK, access restrictions apply.

17470> Recv: SYST 
17470> Sent: 215 UNIX Type: L8

17470> Recv: PWD 
17470> Sent: 257 "/"

17470> Recv: PASV 
17470> Data server port estabished.  Waiting for client connnect ...
17470> Sent: 227 Entering Passive Mode (127,0,0,1,139,211)

17470> Event on data_listen_sd ...
17470> Client PASV data connection from 127.0.0.1:54130
17470> No pending command, waiting ...
17470> Recv: LIST -la
17470> Compose path from cwd: /, arg: a
17470> Server path from CWD: /a
17470> Resulting non-chroot path: /dev/shm/mem/a
17470> Reading directory /dev/shm/mem/a ... 4 number of entries
17470> Sent: 125 Data connection already open; transfer starting.

17470> Sending LIST entry 0 of 4 to 127.0.0.1 ...
17470> Found directory entry .
17470> Found directory entry ..
17470> Found directory entry 888
17470> Compose path from cwd: /, arg: a/888
17470> Server path from CWD: /a/888
17470> Resulting non-chroot path: /dev/shm/mem/a/888
17470> LIST drwxr-xr-x 1     0     0           60 Mar 15 22:28 888

17470> Found directory entry t
17470> Compose path from cwd: /, arg: a/t
17470> Server path from CWD: /a/t
17470> Resulting non-chroot path: /dev/shm/mem/a/t
17470> Found directory entry .
17470> Found directory entry ..
17470> Found directory entry 888
17470> Compose path from cwd: /, arg: a/888
17470> Server path from CWD: /a/888
17470> Resulting non-chroot path: /dev/shm/mem/a/888
17470> Found directory entry t
17470> Compose path from cwd: /, arg: a/t
17470> Server path from CWD: /a/t
17470> Resulting non-chroot path: /dev/shm/mem/a/t
17470> LIST -rw-r--r-- 1     0     0            9 Mar 15 22:27 t

However if I manually create a folder "a" in the path, it can list the files inside "a".

@troglobit
Copy link
Owner

troglobit commented Mar 15, 2019

Thank you for taking the time to test! Interesting behavior ... your cwd was /dev/shm/mem/ when you started uftpd, right?

Reopening

@troglobit troglobit reopened this Mar 15, 2019
@troglobit
Copy link
Owner

Found it, uftpd only read "-l" and "a" became the argument to LIST. I've tested with Dolphin and it seems to work properly now, finally. There's a new binary uploaded as well, if you'd like to verify.

troglobit added a commit that referenced this issue Jul 28, 2019
This patch reverts a part of 12c6e1f, which supposedly fixed 2/2 of
issue #18, but actually introduced issue #23 -- 'CWD /' while chrooted.

Signed-off-by: Joachim Nilsson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants