Fixed non-RFC-compliant handling of lines starting with dots
authorMegaBrutal <code+git@megabrutal.com>
Sat, 7 Feb 2015 12:32:24 +0000 (13:32 +0100)
committerMegaBrutal <code+git@megabrutal.com>
Sat, 7 Feb 2015 12:32:24 +0000 (13:32 +0100)
MgSMTP is now compliant with the transparency guidelines
suggested in RFC 5321, section 4.5.2.

modified:   Listener.pas
modified:   MgSMTP.pas
modified:   Relay.pas
modified:   todo.txt

Listener.pas
MgSMTP.pas
Relay.pas
todo.txt

index a4d94f0516b36344c8ea6b80b89a235a5fdede93..b37662b15302704304dfaa0ad059ea99ab4337ec 100644 (file)
@@ -507,8 +507,11 @@ begin
       Done:= false;
       repeat
          ReadOK:= TCP.ReadLn(Line);
       Done:= false;
       repeat
          ReadOK:= TCP.ReadLn(Line);
-         if Line <> '.' then
-            SpoolObject.DeliverMessagePart(Line)
+         if Line <> '.' then begin
+            { If the line starts with a dot, remove it to comply with RFC. }
+            if (Length(Line) > 1) and (Line[1] = '.') then Delete(Line, 1, 1);
+            SpoolObject.DeliverMessagePart(Line);
+         end
          else
             Done:= true;
       until Done or (not ReadOK);
          else
             Done:= true;
       until Done or (not ReadOK);
index 808a90ddaafe2298f6f22dc280e56f78a742c9f9..3e6ddfb2978f89ca0fd4b3f6b2982a922dec824c 100644 (file)
@@ -49,7 +49,7 @@ const
      document what bugfix/feature are you testing with the actual build.
      This will be logged to help you differentiate outputs of subsequent
      builds in your logs. If left empty, it won't be added to the logs. }
      document what bugfix/feature are you testing with the actual build.
      This will be logged to help you differentiate outputs of subsequent
      builds in your logs. If left empty, it won't be added to the logs. }
-   DEVCOMMENT  =  'New feature to add "Reply-To" to forwarded messages';
+   DEVCOMMENT  =  'Escaping dots';
 
 var
 
 
 var
 
index 4984bc1ea5bf04fb6b427a5bfce48c3c77ee74fb..1e42979d761b9401daa8cbd342b45dc326330b76 100644 (file)
--- a/Relay.pas
+++ b/Relay.pas
@@ -474,7 +474,14 @@ end;
 
 function TRelayer.DeliverMessagePart(Chunk: TStrings): boolean;
 { Sends a chunk of the message. }
 
 function TRelayer.DeliverMessagePart(Chunk: TStrings): boolean;
 { Sends a chunk of the message. }
+var i: integer;
 begin
 begin
+   { Check for lines starting with dots. }
+   for i:= 0 to Chunk.Count - 1 do
+      if (Length(Chunk.Strings[i]) > 0) and (Chunk.Strings[i][1] = '.') then
+         Chunk.Strings[i]:= '.' + Chunk.Strings[i];
+
+   { Send text. }
    Result:= TCP.WriteBuffer(PChar(Chunk.Text), Length(Chunk.Text)) <> -1;
 end;
 
    Result:= TCP.WriteBuffer(PChar(Chunk.Text), Length(Chunk.Text)) <> -1;
 end;
 
index 7a59bc3cc0d2f690a5c7039560cc1bf678df1873..3c871a05121c0fa0eb30e1412685a89bd60184ac 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -26,6 +26,9 @@ v0.9t:
 - IPv6
 - Bind to user-specified IPs
 + Option to add Reply-To header to forwarded e-mails
 - IPv6
 - Bind to user-specified IPs
 + Option to add Reply-To header to forwarded e-mails
++ Fix non-RFC-compliant handling of lines starting with dots
+- Fall back to HELO when remote server doesn't support EHLO
+- Implement CHUNKING extension
 
 v0.9s:
 + Change "Client disconnected, and thread exited successfully." to "Client disconnected."
 
 v0.9s:
 + Change "Client disconnected, and thread exited successfully." to "Client disconnected."