This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch 3.8.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 95811d5b02937e9b395634ad01e6d4f8dd406fe7
Author: Benoit TELLIER <btell...@linagora.com>
AuthorDate: Tue Jan 2 09:52:38 2024 +0100

    [FIX] Close connection after DATA errors
---
 .../org/apache/james/smtpserver/DataLineJamesMessageHookHandler.java  | 4 ++++
 1 file changed, 4 insertions(+)

diff --git 
a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/DataLineJamesMessageHookHandler.java
 
b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/DataLineJamesMessageHookHandler.java
index 6793ff91a3..618f59aaba 100644
--- 
a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/DataLineJamesMessageHookHandler.java
+++ 
b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/DataLineJamesMessageHookHandler.java
@@ -146,11 +146,15 @@ public class DataLineJamesMessageHookHandler implements 
DataLineFilter, Extensib
         } catch (IOException e) {
             LifecycleUtil.dispose(mmiss);
             SMTPResponse response = new SMTPResponse(SMTPRetCode.LOCAL_ERROR, 
DSNStatus.getStatus(DSNStatus.TRANSIENT, DSNStatus.UNDEFINED_STATUS) + " Error 
processing message: " + e.getMessage());
+            response.setEndSession(true);
+            session.popLineHandler();
             LOGGER.error("Unknown error occurred while processing DATA.", e);
             return response;
         } catch (CommandInjectionDetectedException e) {
             LifecycleUtil.dispose(mmiss);
             SMTPResponse response = new 
SMTPResponse(SMTPRetCode.SYNTAX_ERROR_COMMAND_UNRECOGNIZED, 
DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.UNDEFINED_STATUS) + " line 
delimiter must be CRLF");
+            response.setEndSession(true);
+            session.popLineHandler();
             LOGGER.info("Use of CRLF, which might indicate SMTP smuggling 
attempt");
             return response;
 


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to