-
Notifications
You must be signed in to change notification settings - Fork 15
Description
If you set ChannelProtection to contain FtpProtection.DataChannel the library never explicitly informs the server of this.
Some servers do not by default use SSL on the data channel even if it is being used on the command channel.
This can result in the server sending unencrypted data which is picked up by System.Net.Security.SslStream.AuthenticateAsClient and causes the exception seen above as the data is not a valid SSL handshake.
FtpSession.CheckProtection should, if State["PROT"] does not equal the desired protection level, issue a PROT command and fail on a non 2xx response code. State["PROT"] should not initially be set on a new connection.
I'm currently using the below as a temporary fix:
if (client.SendSingleCommand("PROT", "P").Code.Code != 200)
throw new Exception("Could not enable data channel encryption.");It appears the library also doesn't issue a PBSZ command which is apparently required by https://tools.ietf.org/html/rfc2228.
Other libraries seem to use PBSZ 0 successfully.
Unrelated to #32, as it turns out.