Skip to content

Commit

Permalink
Partially add REQUIRETLS. This doesn't yet handle the errors or sendi…
Browse files Browse the repository at this point in the history
…ng parts. Only announces it
  • Loading branch information
MTRNord committed Nov 4, 2023
1 parent 5590f49 commit 11c731a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions crates/erooster_smtp/src/commands/ehlo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ impl Ehlo<'_> {
}
if self.data.con_state.secure {
lines.feed(String::from("250-AUTH LOGIN PLAIN")).await?;
lines.feed(String::from("250-REQUIRETLS")).await?;
}
lines.feed(String::from("250 SMTPUTF8")).await?;
lines.flush().await?;
Expand Down
4 changes: 3 additions & 1 deletion crates/erooster_smtp/src/commands/mail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ impl Mail<'_> {
bail!("Failed to parse localpart arguments (no arguments)");
}

// FIXME: This is just plain wrong
// TODO: Parse for `REQUIRETLS` as an argument to then set it on the data
match localpart_arguments(command_data.arguments[0]).map(|(_, senders)| senders) {
Ok(args) => {
// Create a resolver using Quad9 DNS
let resolver = Resolver::new_quad9_tls()?;
let resolver = Resolver::new_system_conf()?;
for sender in &args {
// Verify MAIL-FROM identity
let result = resolver
Expand Down
2 changes: 2 additions & 0 deletions crates/erooster_smtp/src/servers/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use erooster_deps::mail_auth::SpfOutput;
pub struct Connection {
pub state: State,
pub secure: bool,
pub require_tls: bool,
pub receipts: Option<Vec<String>>,
pub sender: Option<String>,
pub ehlo: Option<String>,
Expand All @@ -20,6 +21,7 @@ impl Connection {
pub const fn new(secure: bool, peer_addr: String) -> Self {
Connection {
secure,
require_tls: false,
state: State::NotAuthenticated,
receipts: None,
sender: None,
Expand Down

0 comments on commit 11c731a

Please sign in to comment.