Add protection only when necessary
This commit is contained in:
@@ -9,14 +9,22 @@
|
|||||||
|
|
||||||
public void Execute(Session session, FtpStream stream, string alias, string argument)
|
public void Execute(Session session, FtpStream stream, string alias, string argument)
|
||||||
{
|
{
|
||||||
|
var dataConnection = session.DataConnection;
|
||||||
|
|
||||||
switch (argument.ToUpper())
|
switch (argument.ToUpper())
|
||||||
{
|
{
|
||||||
case "C":
|
case "C":
|
||||||
session.DataConnection.DesactivateTls();
|
if (dataConnection.IsTlsProtected)
|
||||||
|
{
|
||||||
|
session.DataConnection.DesactivateTls();
|
||||||
|
}
|
||||||
stream.Send(ResponseCode.OK, "Data protection cleared.");
|
stream.Send(ResponseCode.OK, "Data protection cleared.");
|
||||||
break;
|
break;
|
||||||
case "P":
|
case "P":
|
||||||
session.DataConnection.ActivateTls();
|
if (!dataConnection.IsTlsProtected)
|
||||||
|
{
|
||||||
|
session.DataConnection.ActivateTls();
|
||||||
|
}
|
||||||
stream.Send(ResponseCode.OK, "Data protection set.");
|
stream.Send(ResponseCode.OK, "Data protection set.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user