diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a2a993..f855056 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,9 @@ (instead of any executable named `spamc` in the search path). To customise this, set the environment variable `SPAMASSASSIN_MILTER_SPAMC` to the desired path when building the application. -* Revise header rewriting logic. Placement of `X-Spam-` headers now more - accurately mirrors that received from SpamAssassin. +* Revise header rewriting logic. Handling and placement of `X-Spam-` headers + now more accurately mirrors that applied by SpamAssassin. +* Include authentication status in information passed on to SpamAssassin. * Update dependencies. ## 0.1.6 (2021-05-17) diff --git a/Cargo.lock b/Cargo.lock index 4beb964..3081c3c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "ansi_term" version = "0.11.0" @@ -77,9 +79,9 @@ checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" [[package]] name = "libc" -version = "0.2.98" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" +checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765" [[package]] name = "milter" diff --git a/Cargo.toml b/Cargo.toml index 8267918..95e4861 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "spamassassin-milter" -version = "0.1.6" # remember to update html_root_url and VERSION +version = "0.1.6" edition = "2018" description = "Milter for spam filtering with SpamAssassin" license = "GPL-3.0-or-later" diff --git a/src/callbacks.rs b/src/callbacks.rs index c63bd16..345013b 100644 --- a/src/callbacks.rs +++ b/src/callbacks.rs @@ -55,10 +55,7 @@ fn handle_negotiate( context.api.request_macros(Stage::Connect, "")?; context.api.request_macros(Stage::Helo, "")?; - context.api.request_macros( - Stage::Mail, - if config::get().auth_untrusted() { "" } else { "{auth_authen}" }, - )?; + context.api.request_macros(Stage::Mail, "{auth_authen}")?; context.api.request_macros(Stage::Rcpt, "")?; context.api.request_macros(Stage::Data, "i j _ {tls_version} v")?; context.api.request_macros(Stage::Eoh, "")?; @@ -157,6 +154,7 @@ fn handle_data(mut context: Context) -> milter::Result { .and_then(|v| v.split_ascii_whitespace().next()) .unwrap_or("Postfix"), context.api.macro_value("{tls_version}")?.is_some(), + context.api.macro_value("{auth_authen}")?.is_some(), id, &Local::now().to_rfc2822(), )?; diff --git a/src/client.rs b/src/client.rs index 497f7b0..068b5a4 100644 --- a/src/client.rs +++ b/src/client.rs @@ -179,19 +179,21 @@ impl Client { my_hostname: &str, mta: &str, tls: bool, + auth: bool, queue_id: &str, date_time: &str, ) -> Result<()> { let buf = format!( "Received: from {helo} ({client})\r\n\ - \tby {hostname} ({mta}) with {proto} id {id};\r\n\ + \tby {hostname} ({mta}) with ESMTP{tls}{auth} id {id};\r\n\ \t{date_time}\r\n\ \t(envelope-from {sender})\r\n", helo = helo_host, client = client_name_addr, hostname = my_hostname, mta = mta, - proto = if tls { "ESMTPS" } else { "ESMTP" }, + tls = if tls { "S" } else { "" }, + auth = if auth { "A" } else { "" }, id = queue_id, date_time = date_time, sender = self.sender diff --git a/src/lib.rs b/src/lib.rs index fd93022..9fe4e6b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,5 @@ //! The SpamAssassin Milter application library. -#![doc(html_root_url = "https://docs.rs/spamassassin-milter/0.1.6")] - macro_rules! verbose { ($config:ident, $($arg:tt)*) => { if $config.verbose() { @@ -30,7 +28,7 @@ use milter::Milter; pub const MILTER_NAME: &str = "SpamAssassin Milter"; /// The current version string of SpamAssassin Milter. -pub const VERSION: &str = "0.1.6"; +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); /// Starts SpamAssassin Milter listening on the given socket using the supplied /// configuration.