Skip to content

Commit

Permalink
If AUTH=<> parameter is used in MAIL FROM command, hMailServer reject…
Browse files Browse the repository at this point in the history
…ed the message. #164
  • Loading branch information
martinknafve committed Apr 28, 2016
1 parent 000131a commit 1c9c33e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hmailserver/source/Server/SMTP/SMTPConnection.cpp
Expand Up @@ -470,7 +470,7 @@ namespace HM
String parameter = (*iterParam);
if (parameter.Left(4).CompareNoCase(_T("SIZE")) == 0)
iEstimatedMessageSize = _ttoi(parameter.Mid(5));
else if (parameter.Left(5).CompareNoCase(_T("AUTH")) == 0)
else if (parameter.Left(4).CompareNoCase(_T("AUTH")) == 0)
sAuthParam = parameter.Mid(5);
else
{
Expand Down
21 changes: 21 additions & 0 deletions hmailserver/test/RegressionTests/SMTP/Basics.cs
Expand Up @@ -609,6 +609,27 @@ public void TestPostmasterToPostmasterOnOtherDomain()
Pop3ClientSimulator.AssertMessageCount(account.Address, "test", 1);
}


[Test]
[Category("SMTP")]
public void MailFromWithAuthParameterShouldBeAccepted()
{
Account account1 = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "test@test.com", "test");

var smtpClientSimulator = new TcpConnection();
smtpClientSimulator.Connect(25);

Assert.IsTrue(smtpClientSimulator.Receive().StartsWith("220"));
smtpClientSimulator.Send("HELO test\r\n");
Assert.IsTrue(smtpClientSimulator.Receive().StartsWith("250"));

// A few tests of invalid syntax.
Assert.IsTrue(smtpClientSimulator.SendAndReceive("MAIL FROM: <test@test.com> AUTH=<>\r\n").StartsWith("250"));

smtpClientSimulator.Disconnect();
}


[Test]
[Category("SMTP")]
[Description("Confirm that it's OK to send MAIL FROM without the < and >")]
Expand Down

0 comments on commit 1c9c33e

Please sign in to comment.