v0.3.1
This commit is contained in:
@@ -457,7 +457,7 @@ impl ConfigSession for Config {
|
||||
)?,
|
||||
protocol_version: match self.property_or_static::<u32>(
|
||||
("session.data.milter", id, "options.version"),
|
||||
"2",
|
||||
"6",
|
||||
)? {
|
||||
6 => milter::Version::V6,
|
||||
2 => milter::Version::V2,
|
||||
|
||||
@@ -286,10 +286,25 @@ impl<T: AsyncWrite + AsyncRead + IsTls + Unpin> Session<T> {
|
||||
|
||||
// Run Milter filters
|
||||
let mut edited_message = match self.run_milters(&auth_message).await {
|
||||
Ok(modifications) => self
|
||||
.data
|
||||
.apply_modifications(modifications, &auth_message)
|
||||
.map(Arc::new),
|
||||
Ok(modifications) => {
|
||||
tracing::debug!(
|
||||
parent: &self.span,
|
||||
context = "milter",
|
||||
event = "accept",
|
||||
modifications = modifications.iter().fold(String::new(), |mut s, m| {
|
||||
use std::fmt::Write;
|
||||
if !s.is_empty() {
|
||||
s.push_str(", ");
|
||||
}
|
||||
let _ = write!(s, "{m}");
|
||||
s
|
||||
}),
|
||||
"Milter filter(s) accepted message.");
|
||||
|
||||
self.data
|
||||
.apply_modifications(modifications, &auth_message)
|
||||
.map(Arc::new)
|
||||
}
|
||||
Err(response) => return response,
|
||||
};
|
||||
|
||||
|
||||
@@ -335,10 +335,11 @@ impl SessionData {
|
||||
needs_rewrite = true;
|
||||
}
|
||||
Modification::ChangeHeader { index, name, value } => {
|
||||
if message
|
||||
.raw_parsed_headers()
|
||||
.iter()
|
||||
.any(|(n, _)| n.eq_ignore_ascii_case(name.as_bytes()))
|
||||
if value.is_empty()
|
||||
|| message
|
||||
.raw_parsed_headers()
|
||||
.iter()
|
||||
.any(|(n, _)| n.eq_ignore_ascii_case(name.as_bytes()))
|
||||
{
|
||||
header_changes.push((index, name, value, true));
|
||||
needs_rewrite = true;
|
||||
|
||||
@@ -413,7 +413,7 @@ impl Response {
|
||||
buf
|
||||
}
|
||||
Modification::ReplaceBody { value } => {
|
||||
let mut buf = Command::build(SMFIR_REPLBODY, value.len() as u32 + 1);
|
||||
let mut buf = Command::build(SMFIR_REPLBODY, value.len() as u32);
|
||||
buf.extend(value);
|
||||
buf
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user