[exim-dev] [Bug 1246] New: headers_only option doesn't work

Top Page
Delete this message
Reply to this message
Author: Tomasz Kusy
Date:  
To: exim-dev
Subject: [exim-dev] [Bug 1246] New: headers_only option doesn't work
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1246
           Summary: headers_only option doesn't work
           Product: Exim
           Version: 4.72
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Transports
        AssignedTo: nigel@???
        ReportedBy: t.kusy@???
                CC: exim-dev@???



Exim version 4.72
Tested on Debian.

Hello,
There is problem with headers_only transport option (tested with driver =
smtp).
After connection to remote host and start DATA stage, Exim doesn't send final
dot when headers_only is in use.

-- example --

#220 Custom LMTP server ready
LHLO localhost
#250 OK
MAIL FROM:<>
#250 OK
RCPT TO:<my@???>
#250 OK
DATA
#354 Enter message, ending with "." on a line by itself
Received: from Debian-exim by myhost with local (Exim 4.72)
     id 1STHmQ-0003nV-FH
     for my@???; Sat, 12 May 2012 21:15:02 +0200
Date: Sat, 12 May 2012 21:15:02 +0200
Message-Id: <E1STHmQ-0003nV-FH@myhost>
X-Failed-Recipients: sdsds@???
Auto-Submitted: auto-replied
From: Mail Delivery System <Mailer-Daemon@myhost>
To: my@???
Subject: Mail delivery failed: returning message to sender


-- end of example --

Exim hangs until timeout.

After quick look into source code (Exim 4.72 & Exim 4.77) I found possible
problem.
In transport.c on line 902:

--- source code ---
if ((options & topt_no_body) == 0)
  {
  nl_check_length = abs(nl_check_length);
  nl_partial_match = 0;
  lseek(deliver_datafile, SPOOL_DATA_START_OFFSET, SEEK_SET);
  while ((len = read(deliver_datafile, deliver_in_buffer,
           DELIVER_IN_BUFFER_SIZE)) > 0)
    {
    if (!write_chunk(fd, deliver_in_buffer, len, use_crlf)) return FALSE;
    if (size_limit > 0)
      {
      written += len;
      if (written > size_limit)
        {
        len = 0;    /* Pretend EOF */
        break;
        }
      }
    }


/* Finished with the check string */

nl_check_length = nl_escape_length = 0;

/* A read error on the body will have left len == -1 and errno set. */

if (len != 0) return FALSE;

/* If requested, add a terminating "." line (SMTP output). */

  if ((options & topt_end_dot) != 0 && !write_chunk(fd, US".\n", 2, use_crlf))
    return FALSE;
  }


--- end of source code ---

I think this fragment should be unconditional:

  if ((options & topt_end_dot) != 0 && !write_chunk(fd, US".\n", 2, use_crlf))
    return FALSE;


Best regards
Tomasz Kusy


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email