You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Stefano Bagnara (JIRA)" <se...@james.apache.org> on 2006/02/22 21:56:37 UTC

[jira] Created: (JAMES-445) Enforcement for HELO/EHLO commands before MAIL

Enforcement for HELO/EHLO commands before MAIL
----------------------------------------------

         Key: JAMES-445
         URL: http://issues.apache.org/jira/browse/JAMES-445
     Project: James
        Type: Improvement
  Components: SMTPServer  
    Versions: 2.2.0, 2.3.0a1    
    Reporter: Stefano Bagnara
 Assigned to: Stefano Bagnara 
    Priority: Minor


>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 <>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Commented: (JAMES-445) Enforcement for HELO/EHLO commands before MAIL

Posted by "Stefano Bagnara (JIRA)" <se...@james.apache.org>.
    [ http://issues.apache.org/jira/browse/JAMES-445?page=comments#action_12368244 ] 

Stefano Bagnara commented on JAMES-445:
---------------------------------------

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.

> Enforcement for HELO/EHLO commands before MAIL
> ----------------------------------------------
>
>          Key: JAMES-445
>          URL: http://issues.apache.org/jira/browse/JAMES-445
>      Project: James
>         Type: Improvement
>   Components: SMTPServer
>     Versions: 2.3.0a1, 2.2.0
>     Reporter: Stefano Bagnara
>     Assignee: Stefano Bagnara
>     Priority: Minor

>
> 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 <>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Commented: (JAMES-445) Enforcement for HELO/EHLO commands before MAIL

Posted by "Norman Maurer (JIRA)" <se...@james.apache.org>.
    [ http://issues.apache.org/jira/browse/JAMES-445?page=comments#action_12368246 ] 

Norman Maurer commented on JAMES-445:
-------------------------------------

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..



> Enforcement for HELO/EHLO commands before MAIL
> ----------------------------------------------
>
>          Key: JAMES-445
>          URL: http://issues.apache.org/jira/browse/JAMES-445
>      Project: James
>         Type: Improvement
>   Components: SMTPServer
>     Versions: 2.3.0a1, 2.2.0
>     Reporter: Stefano Bagnara
>     Assignee: Stefano Bagnara
>     Priority: Minor

>
> 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 <>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Resolved: (JAMES-445) Enforcement for HELO/EHLO commands before MAIL

Posted by "Stefano Bagnara (JIRA)" <se...@james.apache.org>.
     [ http://issues.apache.org/jira/browse/JAMES-445?page=all ]
     
Stefano Bagnara resolved JAMES-445:
-----------------------------------

    Fix Version: 2.3.0a2
     Resolution: Fixed

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

> Enforcement for HELO/EHLO commands before MAIL
> ----------------------------------------------
>
>          Key: JAMES-445
>          URL: http://issues.apache.org/jira/browse/JAMES-445
>      Project: James
>         Type: Improvement
>   Components: SMTPServer
>     Versions: 2.2.0, 2.3.0a1
>     Reporter: Stefano Bagnara
>     Assignee: Stefano Bagnara
>     Priority: Minor
>      Fix For: 2.3.0a2

>
> 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 <>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org