noel        2003/06/04 16:20:36

  Modified:    src/java/org/apache/james/smtpserver SMTPHandler.java
  Log:
  Use CRLFTerminatedReader.  Respond with a detailed 501 to explain a syntax error.
  
  Revision  Changes    Path
  1.51      +10 -5     
jakarta-james/src/java/org/apache/james/smtpserver/SMTPHandler.java
  
  Index: SMTPHandler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-james/src/java/org/apache/james/smtpserver/SMTPHandler.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- SMTPHandler.java  27 May 2003 08:47:44 -0000      1.50
  +++ SMTPHandler.java  4 Jun 2003 23:20:35 -0000       1.51
  @@ -91,6 +91,7 @@
   import org.apache.james.core.MailHeaders;
   import org.apache.james.core.MailImpl;
   import org.apache.james.util.Base64;
  +import org.apache.james.util.CRLFTerminatedReader;
   import org.apache.james.util.CharTerminatedInputStream;
   import org.apache.james.util.DotStuffingInputStream;
   import org.apache.james.util.InternetPrintWriter;
  @@ -559,11 +560,15 @@
        * @throws IOException if an exception is generated reading in the input 
characters
        */
       final String readCommandLine() throws IOException {
  -        String commandLine = inReader.readLine();
  -        if (commandLine != null) {
  -            commandLine = commandLine.trim();
  +        for (;;) try {
  +            String commandLine = inReader.readLine();
  +            if (commandLine != null) {
  +                commandLine = commandLine.trim();
  +            }
  +            return commandLine;
  +        } catch (CRLFTerminatedReader.TerminationException te) {
  +            writeLoggedFlushedResponse("501 Syntax error at character position " + 
te.position() + ". CR and LF must be CRLF paired.  See RFC 2821 #2.7.1.");
           }
  -        return commandLine;
       }
   
       /**
  
  
  

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

Reply via email to