FluentFTP: GetReply(Sync+Async)Internal enters an infinite loop
FTP Server OS: Unix / Windows
FTP Server Type: FTPS
Client Computer OS: Windows
FluentFTP Version: 44.0.1.0
Framework: .NET 6
The method GetReplyAsyncInternal enters an infinite loop.
if (!exhaustNoop || elapsedMilliseconds <= (long) timeOut)
{
if (!exhaustNoop)
{
if (timeOut >= 0)
{
client.m_stream.ReadTimeout = __nonvirtual (client.Config).ReadTimeout;
text = await client.m_stream.ReadLineAsync(__nonvirtual (client.Encoding), token);
}
await client.m_stream.ReadLineAsync(__nonvirtual (client.Encoding), token); always returns null.
Logs :
# Connect(False)
Status: FluentFTP 44.0.1.0
Status: Connecting to IP #1= ***:990
Warning: SSL Buffering force disabled, is .NET 5.0 and later
Status: FTPS authentication successful, protocol = Tls12
Status: Time to activate encryption: 0h 0m 0s. Total Seconds: 0.0248618.
Status: SslStream: Tls12 (Aes256, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, 44550, 256)
Status: Waiting for a response
Response: 220-== Virtual Benefits Administrator SFTP Server -============================
Response: 220-== This is a private network.
Response: 220-== Unauthorized access and/or actions will result iin prosecution.
Response: 220 == For assistance, contact 262-946-1200. =============================== [738539.427d]
Command: USER ***
Status: Waiting for response to: USER ***
Response: 331 User ***, password please [23ms]
Command: PASS ***
Status: Waiting for response to: PASS ***
Response: 530 Not logged in. Username/password incorrect, user disabled, or user logged in too many times [3.02s]
# Dispose()
Status: Disposing FtpClient object...
Status: Closing/Disposing FtpSocketStream(control connection)
# Connect(False)
Status: FluentFTP 44.0.1.0
Status: Connecting to IP #1= ***:990
Warning: SSL Buffering force disabled, is .NET 5.0 and later
Status: FTPS authentication successful, protocol = Tls12
Status: Time to activate encryption: 0h 0m 0s. Total Seconds: 0.0268872.
Status: SslStream: Tls12 (Aes256, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, 44550, 256)
Status: Waiting for a response
Response: 220-== Virtual Benefits Administrator SFTP Server -============================
Response: 220-== This is a private network.
Response: 220-== Unauthorized access and/or actions will result iin prosecution.
Response: 220 == For assistance, contact 262-946-1200. =============================== [738539.431d]
Command: USER ***
Status: Waiting for response to: USER ***
Response: 331 User ***, password please [25ms]
Command: PASS ***
Status: Waiting for response to: PASS ***
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 43 (12 by maintainers)
Commits related to this issue
- Tests for SFTP work, waiting for nuget fix on FluentFTP to test FTPS https://github.com/robinrodricks/FluentFTP/issues/1156 — committed to maxrunsoftware/DotNet-MaxRunSoftware.Utilities by Steven-D-Foster a year ago
Released! V45.0.3
And now I would like to get back to work…
I will defer that decision to @robinrodricks
fixed
I dunno, maybe the company is called “Virtual Benefits”, and the welcome message has been customized (sure looks like it) and the geek that did it can’t spell FTPS (used SFTP instead).
Doesn’t change anything, @robinrodricks
I can reproduce an infinite loop in GetReply, when:
While waiting for a response and not reached the socket.timeout, using ReadLine, and then if socket is closed due to external reasons. In this case we don’t get the timeout and return a null. Which then causes the loop.
I can see a potential for an infinite loop when stream read returns null, which can happen if the socket is no longer connected and the timeout does not fire. I tested it just now on sync, so the issue is on both, I think.
I confirm.