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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to