Relayed inbound mail follows the settings in force now (#366) #367

Merged
jcoffey-dev merged 1 commits from fix/366-relay-link-fresh-settings into main 2026-11-11 01:34:29 +00:00
Owner

Fixes #366.

The relay link service built its Server once per connection, and Server holds a core snapshot, so every relayed message was judged with the settings from when the link connected. A reload after a registry write (directory/mailbox filter, stage rules, spam filter, sender auth, ...) didn't reach relayed mail until the link reconnected, usually a restart. Reported in forum t/259.

  • Taker::take: each Job gets self.server.inner.build_server().
  • session(): the loop builds a fresh Server each pass, so sync, events and outbound statuses see current settings too.

Test: relay_link_tests lowers maxReceivedHeaders to 3 with the link up, then a relayed message with five Received headers must get 450 4.4.6; set back to 50, the same message is delivered. Run against main's link service the first assertion fails (250 2.0.0 Accepted), with the fix it passes.

Local: relay_link_tests and relay_tests each pass (run alone; run back to back in one process, relay_tests fails at keysWrapped because the link test leaves the relay key file set process-wide at relay.rs:1670, an existing test-ordering issue, not this change). cargo fmt --all --check, clippy on services, fork checks clean.

Fixes #366. The relay link service built its `Server` once per connection, and `Server` holds a core snapshot, so every relayed message was judged with the settings from when the link connected. A reload after a registry write (directory/mailbox filter, stage rules, spam filter, sender auth, ...) didn't reach relayed mail until the link reconnected, usually a restart. Reported in forum t/259. - `Taker::take`: each `Job` gets `self.server.inner.build_server()`. - `session()`: the loop builds a fresh `Server` each pass, so sync, events and outbound statuses see current settings too. **Test:** `relay_link_tests` lowers `maxReceivedHeaders` to 3 with the link up, then a relayed message with five Received headers must get `450 4.4.6`; set back to 50, the same message is delivered. Run against main's link service the first assertion fails (`250 2.0.0 Accepted`), with the fix it passes. **Local:** `relay_link_tests` and `relay_tests` each pass (run alone; run back to back in one process, `relay_tests` fails at `keysWrapped` because the link test leaves the relay key file set process-wide at relay.rs:1670, an existing test-ordering issue, not this change). `cargo fmt --all --check`, clippy on services, fork checks clean.
jcoffey-dev added 1 commit 2026-11-11 01:18:40 +00:00
Relayed inbound mail follows the settings in force now (#366)
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 10m26s
b242398f41
The relay link service built its Server once per connection, and a
Server holds a snapshot of the core. Every relayed message was judged
through that snapshot, so a reload after a registry write (a domain's
directory and its mailbox filter, RCPT/DATA stage rules, the spam
filter, sender authentication) didn't reach mail arriving through a relay
until the link reconnected, usually at a restart. Mail on port 25 used
the new settings at once, so the two paths disagreed.

Each relayed message is now judged with a Server built from the shared
core when it's taken, and the link loop refreshes its Server on every
pass, so sync, events and outbound statuses see current settings too.

Test: relay_link_tests lowers maxReceivedHeaders to 3 with the link up,
and the next relayed message with five Received headers is refused with
450 4.4.6; set back to 50, the same message is delivered. Without the
fix the first one was accepted (250).

Fixes #366
jcoffey-dev merged commit 983f3783a5 into main 2026-11-11 01:34:29 +00:00
jcoffey-dev deleted branch fix/366-relay-link-fresh-settings 2026-11-11 01:34:29 +00:00
jcoffey-dev referenced this issue from a commit 2026-11-11 06:46:21 +00:00
Sign in to join this conversation.