From be1b86905cc9affd825b9932f24bd57b66d9ed66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Mon, 21 Dec 2020 15:31:52 +0100 Subject: [PATCH] Tolerate \r and \n inside retured data-lines --- opensmtpd/src/data_line.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/opensmtpd/src/data_line.rs b/opensmtpd/src/data_line.rs index a9829d4..b235452 100644 --- a/opensmtpd/src/data_line.rs +++ b/opensmtpd/src/data_line.rs @@ -2,7 +2,15 @@ use crate::FilterEntry; use std::io::{self, Write}; pub fn return_data_line(entry: &FilterEntry, data_line: &[u8]) { + let mut data_line = data_line.to_vec(); + data_line.retain(|&c| c != 0x0d && c != 0x0a); print!("filter-dataline|{}|{}|", entry.session_id, entry.token); - io::stdout().write_all(data_line).unwrap(); + io::stdout().write_all(&data_line).unwrap(); println!(); + log::trace!( + "Sent filter-dataline (session:id: {}, token: {}){}", + entry.session_id, + entry.token, + crate::error::get_pretty_hex(&data_line) + ); }