mtheall / ftpd

FTP Server for 3DS/Switch
GNU General Public License v3.0
1.34k stars 131 forks source link

switch: invalid argument error while attempting to connect to client in active mode #116

Open wmedlar opened 3 years ago

wmedlar commented 3 years ago

Describe the bug Attempting to connect to a client in active mode will throw an "invalid argument" error, using v3.0.0 of ftpd on the Nintendo Switch.

To Reproduce Steps to reproduce the behavior:

  1. spawn a netcat server to listen for incoming requests
    $ (nc -l 2560) &
  2. attempt to list a directory in active mode
    $ nc "$SWITCH_IP" 5000 << EOF
    USER anonymous
    PORT $(ipconfig getifaddr en0 | tr . ,),10,0
    MLSD /
    EOF
    220 Hello!
    230 OK
    200 OK
    425 Can't open data connection
  3. the UI will display (classic mode shows similar)
    [ERROR] connect: Invalid argument
    [RESPONSE] 425 Can't open data connection

Expected behavior The server connects to the client on the specified port and prints the directory listing.

Platform (please complete the following information):

mtheall commented 3 years ago

Can you give more history from the log? Ideally starting with the received PORT command to the point of error.

emannotava commented 8 months ago

Sad that the op never replied because transfering files using passive mode is pretty annoying when you have a decently sized handful of files regardless of filesize.

sasdallas commented 5 months ago

Reopening this because it's happening to me. Here's the full log file.

[INFO] Started server at [XXX.XXX.X.XX]:5000
[INFO] Accepted connection from [XXX.XXX.X.XX]:59114
[RESPONSE] 220 Hello!
[COMMAND] USER ******
[RESPONSE] 230 OK
[COMMAND] SYST
[RESPONSE] 215 Unix Type: L8
[COMMAND] PORT XXX,XXX,X,XX,182,149
[RESPONSE] 200 OK
[COMMAND] LIST
[ERROR] connect: Invalid argument
[RESPONSE] 425 Can't open data connection
[COMMAND] PORT XXX,XXX,X,XX,133,83
[ERROR] connect: Invalid argument
[RESPONSE] 425 Can't open data connection