This commit is contained in:
mdecimus 2024-01-02 11:28:15 +01:00
parent 572ae9b44b
commit f301721465
15 changed files with 64 additions and 22 deletions

View file

@ -2,7 +2,7 @@
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
## [0.5.1] - 2024-01-xx
## [0.5.1] - 2024-01-02
## Added
- SMTP smuggling protection: Sanitization of outgoing messages that do not use `CRLF` as line endings.
@ -13,8 +13,9 @@ All notable changes to this project will be documented in this file. This projec
### Fixed
- Invalid DKIM signatures for empty message bodies.
- IMAP command `SEARCH BEFORE` is not properly parsed.
- IMAP response to `ENABLE` command misses enabled capabilities list.
- IMAP command `FETCH` fails to parse single arguments without parentheses.
- IMAP command `ENABLE QRESYNC` should also enable `CONDSTORE` extension.
- IMAP response to `ENABLE` command does not include enabled capabilities list.
- IMAP response to `FETCH ENVELOPE` should not return `NIL` when the `From` header is missing.
## [0.5.0] - 2023-12-27

18
Cargo.lock generated
View file

@ -2545,7 +2545,7 @@ checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284"
[[package]]
name = "imap"
version = "0.5.0"
version = "0.5.1"
dependencies = [
"ahash 0.8.7",
"dashmap",
@ -2722,7 +2722,7 @@ dependencies = [
[[package]]
name = "jmap"
version = "0.5.0"
version = "0.5.1"
dependencies = [
"aes",
"aes-gcm",
@ -3132,7 +3132,7 @@ dependencies = [
[[package]]
name = "mail-server"
version = "0.5.0"
version = "0.5.1"
dependencies = [
"directory",
"imap",
@ -3149,7 +3149,7 @@ dependencies = [
[[package]]
name = "managesieve"
version = "0.5.0"
version = "0.5.1"
dependencies = [
"ahash 0.8.7",
"bincode",
@ -3416,7 +3416,7 @@ dependencies = [
[[package]]
name = "nlp"
version = "0.5.0"
version = "0.5.1"
dependencies = [
"ahash 0.8.7",
"bincode",
@ -5357,7 +5357,7 @@ checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
[[package]]
name = "smtp"
version = "0.5.0"
version = "0.5.1"
dependencies = [
"ahash 0.8.7",
"bincode",
@ -5479,7 +5479,7 @@ dependencies = [
[[package]]
name = "stalwart-cli"
version = "0.5.0"
version = "0.5.1"
dependencies = [
"clap",
"console",
@ -5503,7 +5503,7 @@ dependencies = [
[[package]]
name = "stalwart-install"
version = "0.5.0"
version = "0.5.1"
dependencies = [
"base64 0.21.5",
"clap",
@ -6385,7 +6385,7 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "utils"
version = "0.5.0"
version = "0.5.1"
dependencies = [
"ahash 0.8.7",
"chrono",

View file

@ -5,7 +5,7 @@ authors = ["Stalwart Labs Ltd. <hello@stalw.art>"]
license = "AGPL-3.0-only"
repository = "https://github.com/stalwartlabs/cli"
homepage = "https://github.com/stalwartlabs/cli"
version = "0.5.0"
version = "0.5.1"
edition = "2021"
readme = "README.md"
resolver = "2"

View file

@ -343,6 +343,10 @@ impl Request<Command> {
)
.into());
}
if !in_parentheses {
break;
}
}
Token::ParenthesisOpen => {
if !in_parentheses {
@ -778,6 +782,16 @@ mod tests {
include_vanished: true,
},
),
(
"9 UID FETCH 1:* UID (VANISHED CHANGEDSINCE 1)\r\n",
fetch::Arguments {
tag: "9".to_string(),
sequence_set: Sequence::range(1.into(), None),
attributes: vec![Attribute::Uid],
changed_since: 1.into(),
include_vanished: true,
},
),
] {
assert_eq!(
receiver

View file

@ -1300,7 +1300,7 @@ mod tests {
concat!(
"BODYSTRUCTURE (((\"text\" \"PLAIN\" (\"CHARSET\" \"UTF-8\") ",
"\"<111@domain.com>\" \"Text part\" \"7BIT\" 1152 23 \"8o3456\" ",
"(\"inline\" ()) \"en-US\" \"right here\")",
"(\"inline\" NIL) \"en-US\" \"right here\")",
"(\"text\" \"HTML\" (\"CHARSET\" \"UTF-8\") ",
"\"<54535@domain.com>\" \"HTML part\" \"8BIT\" 45345 994 \"53454\" ",
"(\"attachment\" (\"filename\" \"myfile.txt\")) ",

View file

@ -1,6 +1,6 @@
[package]
name = "imap"
version = "0.5.0"
version = "0.5.1"
edition = "2021"
resolver = "2"

View file

@ -5,7 +5,7 @@ authors = ["Stalwart Labs Ltd. <hello@stalw.art>"]
license = "AGPL-3.0-only"
repository = "https://github.com/stalwartlabs/mail-server"
homepage = "https://github.com/stalwartlabs/mail-server"
version = "0.5.0"
version = "0.5.1"
edition = "2021"
readme = "README.md"
resolver = "2"

View file

@ -1,6 +1,6 @@
[package]
name = "jmap"
version = "0.5.0"
version = "0.5.1"
edition = "2021"
resolver = "2"

View file

@ -7,7 +7,7 @@ homepage = "https://stalw.art"
keywords = ["imap", "jmap", "smtp", "email", "mail", "server"]
categories = ["email"]
license = "AGPL-3.0-only"
version = "0.5.0"
version = "0.5.1"
edition = "2021"
resolver = "2"

View file

@ -1,6 +1,6 @@
[package]
name = "managesieve"
version = "0.5.0"
version = "0.5.1"
edition = "2021"
resolver = "2"

View file

@ -1,6 +1,6 @@
[package]
name = "nlp"
version = "0.5.0"
version = "0.5.1"
edition = "2021"
resolver = "2"

View file

@ -7,7 +7,7 @@ homepage = "https://stalw.art/smtp"
keywords = ["smtp", "email", "mail", "server"]
categories = ["email"]
license = "AGPL-3.0-only"
version = "0.5.0"
version = "0.5.1"
edition = "2021"
resolver = "2"

View file

@ -1,6 +1,6 @@
[package]
name = "utils"
version = "0.5.0"
version = "0.5.1"
edition = "2021"
resolver = "2"

View file

@ -13,4 +13,4 @@ cargo run -p stalwart-cli -- -u https://127.0.0.1:8080 -c admin:secret account c
#cargo run -p stalwart-cli -- -u https://127.0.0.1:8080 -c admin:secret list add-members everyone jane john bill
#cargo run -p stalwart-cli -- -u https://127.0.0.1:8080 -c admin:secret account list
#cargo run -p stalwart-cli -- -u https://127.0.0.1:8080 -c admin:secret import messages --format mbox john _ignore/dovecot-crlf
#cargo run -p stalwart-cli -- -u https://127.0.0.1:8080 -c admin:secret import messages --format maildir john /var/mail/john

View file

@ -0,0 +1,27 @@
import imaplib
import socket
import time
from email.message import Message
from email.utils import formatdate
from datetime import datetime, timedelta
conn = imaplib.IMAP4('localhost')
conn.login('john', '12345')
conn.socket().setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
current_date = datetime.now()
timestamp = current_date.timestamp()
msg = Message()
msg['From'] = 'somebody@some.where'
msg['To'] = 'john@example.org'
msg['Message-Id'] = f'unique.message.id.{current_date}@nowhere'
msg['Date'] = formatdate(time.mktime(current_date.timetuple()), localtime=False, usegmt=True)
msg['Subject'] = f"This is message #{timestamp}"
msg.set_payload('...nothing...')
response_code, response_details = conn.append('INBOX', '', imaplib.Time2Internaldate(time.mktime(current_date.timetuple())), str(msg).encode('utf-8'))
if response_code != 'OK':
print(f'Error while appending message: {response_code} {response_details}')
print("Message appended.")
conn.logout()