Hi i wrote a patch which check first if a helo was provided before
accept MAIL FROM command. The HELO should be the first command like said
in the RFC:

> 
> > 4.1.1.  First command
> > 
> >    RFC 821 states that the first command in an SMTP session must be the
> >    HELO command. This requirement is hereby amended to allow a session
> >    to start with either EHLO or HELO.
> > 
> > So why not check in the mail handle if the HELO was present ? I could 
> > contribute a patch for that .. 
> > Or someone can tell me why this should not be made ?

bye guys..

Ps: Cause its the first patch i hope its correct


Am Freitag, den 17.02.2006, 11:29 +0100 schrieb Stefano Bagnara:
> Norman Maurer wrote:
> > Hi,
> > 
> > i just reread the rfc and it really says that the first command should
> > be the HELO:
> > 
> > 4.1.1.  First command
> > 
> >    RFC 821 states that the first command in an SMTP session must be the
> >    HELO command. This requirement is hereby amended to allow a session
> >    to start with either EHLO or HELO.
> > 
> > So why not check in the mail handle if the HELO was present ? I could 
> > contribute a patch for that .. 
> > Or someone can tell me why this should not be made ?
> 
> Feel free to submit a patch.
> 
> Stefano
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
--- 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