FubarDevelopment / FtpServer

Portable FTP server written in .NET
http://fubardevelopment.github.io/FtpServer/
MIT License
473 stars 161 forks source link

PASV Intermitent Error on WinScp #110

Open albertoVieiraNeto opened 3 years ago

albertoVieiraNeto commented 3 years ago

Hi, i'm using this library to build a application with a FTP server, its great but i'm facing a strange issue where sometimes, one specific client (winscp) will throw "Syntax Error in parameters or arguments", after adding serilog to the pipeline, one commandhandler is throwing the following error:


[12:50:28 ERR] Failed to process message (PASV )
System.Net.Sockets.SocketException (0x80004005): Foi feita uma tentativa de acesso a um soquete de uma maneira que é proibida pelas permissões de acesso
   em System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   em System.Net.Sockets.Socket.Bind(EndPoint localEP)
   em System.Net.Sockets.TcpListener.Start(Int32 backlog)
   em FubarDev.FtpServer.PasvListener..ctor(IPAddress listenAddress, Int32 port, IPAddress externalAddress)
   em FubarDev.FtpServer.PasvListenerFactory.CreateListenerInRange(IFtpConnection connection, PasvListenerOptions pasvOptions)
   em FubarDev.FtpServer.PasvListenerFactory.<CreateTcpListenerAsync>d__5.MoveNext()
--- Fim do rastreamento de pilha do local anterior onde a exceção foi gerada ---
   em System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   em System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   em FubarDev.FtpServer.DataConnection.PassiveDataConnectionFeatureFactory.<CreateFeatureAsync>d__5.MoveNext()
--- Fim do rastreamento de pilha do local anterior onde a exceção foi gerada ---
   em System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   em System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   em System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   em FubarDev.FtpServer.CommandHandlers.PasvCommandHandler.<Process>d__2.MoveNext()
--- Fim do rastreamento de pilha do local anterior onde a exceção foi gerada ---
   em System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   em System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   em FubarDev.FtpServer.ConnectionExtensions.<ExecuteCommand>d__0.MoveNext()

the funny thing is, if i just "update" the folder, it works, can anyone helpme with this?

fubar-coder commented 3 years ago

You may need to start the application as root/Administrator. If it works, then the problem is the selected passive port. You should use a port range with a number >1024 (IIRC).

albertoVieiraNeto commented 3 years ago

@fubar-coder thanks, i had configured only the FtpServerOptions.ServerAddress, but forgot to configure the SimplePasvOptions.PublicAddress, that was aparently generating the error, strangely enough just on WinScp.