Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-445

Enforcement for HELO/EHLO commands before MAIL

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.0, 2.3.0
    • Fix Version/s: 2.3.0
    • Component/s: SMTPServer
    • Labels:
      None

      Description

      From Norman Maurer:

      Hi,

      this is my first Patch so i hope its correct posted and made.. It patch
      the MailCmdHandler to check if a HELO was provided..

      So HELO should be provided as first command.. this is wrote down in the
      RFC. So before accept MAIL FROM the HELO must provided..

      Comments are welcome

      bye
      Norman

      -----------------------------------------------

      — MailCmdHandlerOLD.java 2006-02-17 12:23:26.000000000 +0100
      +++ MailCmdHandler.java 2006-02-17 12:25:34.000000000 +0100
      @@ -29,6 +29,8 @@
      public class MailCmdHandler
      extends AbstractLogEnabled
      implements CommandHandler {
      +
      + private final static String CURRENT_HELO_MODE = "CURRENT_HELO_MODE"; // HELO or EHLO

      private final static String MAIL_OPTION_SIZE = "SIZE";

      @@ -70,6 +72,9 @@

      sender == null) { responseString = "501 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.DELIVERY_INVALID_ARG)+" Usage: MAIL FROM:<sender>"; session.writeResponse(responseString); + }

      else if (session.getState().containsKey(CURRENT_HELO_MODE) == false )

      { + responseString = "501 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.DELIVERY_INVALID_ARG)+" HELO needed first"; + session.writeResponse(responseString); }

      else {
      sender = sender.trim();
      // the next gt after the first lt ... AUTH may add more <>

        Activity

        Hide
        bago Stefano Bagnara added a comment -

        The provided patch does not work.
        If you try to send multiple mails in the same connection the second "MAIL FROM" fails because there is no HELO/EHLO.
        I'm adding tests for this scenario and an hopefully complete patch.

        Show
        bago Stefano Bagnara added a comment - The provided patch does not work. If you try to send multiple mails in the same connection the second "MAIL FROM" fails because there is no HELO/EHLO. I'm adding tests for this scenario and an hopefully complete patch.
        Hide
        norman Norman Maurer added a comment -

        I was not know that this should be possible.. I thought a new smtp connection is made for each message.

        I will have a lokk and fix it soon..

        Show
        norman Norman Maurer added a comment - I was not know that this should be possible.. I thought a new smtp connection is made for each message. I will have a lokk and fix it soon..
        Hide
        bago Stefano Bagnara added a comment -

        Updated to correctly support the state reset to allow multiple mails to be sent in the same connection.

        Show
        bago Stefano Bagnara added a comment - Updated to correctly support the state reset to allow multiple mails to be sent in the same connection.
        Hide
        danny@apache.org Danny Angus added a comment -

        Closing issue fixed in released version.

        Show
        danny@apache.org Danny Angus added a comment - Closing issue fixed in released version.

          People

          • Assignee:
            bago Stefano Bagnara
            Reporter:
            bago Stefano Bagnara
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development