Fix BypassGuestPassword

Was bypassing all users passwords and not only Guest
This commit is contained in:
2019-07-22 11:19:42 +02:00
parent 594e7eb1dd
commit a28bff79fb

View File

@@ -16,10 +16,10 @@ namespace DearFTP.Connection.Commands
{ {
var configuration = FtpServer.Instance.Configuration; var configuration = FtpServer.Instance.Configuration;
var user = configuration.Users.FirstOrDefault(x => x.Name == argument); var user = configuration.Users.FirstOrDefault(x => x.Name == argument);
string guest = configuration.Server.Guest;
if (user == null) if (user == null)
{ {
string guest = configuration.Server.Guest;
if (string.IsNullOrWhiteSpace(guest)) if (string.IsNullOrWhiteSpace(guest))
{ {
@@ -31,7 +31,7 @@ namespace DearFTP.Connection.Commands
user = configuration.Users.First(x => x.Name == guest); user = configuration.Users.First(x => x.Name == guest);
} }
if (!string.IsNullOrWhiteSpace(user.Password) && !(session.RemoteIP.IsInternal() && configuration.Server.BypassGuestPassword)) if (!string.IsNullOrWhiteSpace(user.Password) && !(session.RemoteIP.IsInternal() && configuration.Server.BypassGuestPassword && user.Name == guest))
{ {
stream.Send(ResponseCode.NeedPassword, "Please specify the password."); stream.Send(ResponseCode.NeedPassword, "Please specify the password.");