The row's recipient has to be the address Postfix writes in to=<..> or orig_to=<..>, or the delivery line finds no row and the sweep closes it as bounced. Postfix 3.7.11 hands the milter the RCPT argument as the client wrote it (smtpd.c, milter_argv(); extract_addr() leaves it), go-milter v0.4.1 trims "<>" and drops the ESMTP parameters (session.go, case CodeRcpt) - so cleanAddress's cut at the first blank broke a quoted local part (B-G5). Postfix keeps the address in internal form (tok822: quotes off, backslash escapes taken) and logs it external (info_log_addr_form.c, quote_822_local(): quoted again only when not a dot-string); recipientAsLogged does the same, "ab"@x -> ab@x, "a b"@x stays. A recipient given twice in any case is one row: cleanup drops the duplicate, comparing folded (cleanup_out_recipient.c, been_here(), BH_FLAG_FOLD; A-31). A rewritten recipient is matched by orig_to=, which log_adhoc() writes only when it differs (A-9). The store's case-insensitive match stays, now with its reason from the source (D-S20). Stand (2026-10-14, make e2e, exit 0): new recipients_as_postfix_logs_them - RCPT TO "x y"@, "ab"@ and "X Y"@ sink.e2e.test give two rows, "x y"@sink.e2e.test and ab@sink.e2e.test, both sent. go vet and go test ./... pass on the server; a unit test drives the milter through go-milter's own client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -85,8 +85,10 @@ func inboundSessionFor(t *testing.T, rec InboundStore, filter bool) *inboundSess
|
||||
func TestInboundRecordsAcceptedMessage(t *testing.T) {
|
||||
rec := &fakeInbound{domains: map[string]bool{"in.example.com": true}}
|
||||
s := inboundSessionFor(t, rec, false)
|
||||
resp := message(t, s, "<sender@example.net> SIZE=1200",
|
||||
[]string{"<a@in.example.com>", "b@IN.example.com"},
|
||||
// As go-milter hands them: brackets trimmed, ESMTP parameters left out
|
||||
// (go-milter v0.4.1, session.go, case CodeMail/CodeRcpt).
|
||||
resp := message(t, s, "sender@example.net",
|
||||
[]string{"a@in.example.com", "b@IN.example.com"},
|
||||
[][2]string{{"Subject", "=?utf-8?Q?Sch=C3=B6n?="}})
|
||||
if resp != milter.RespContinue {
|
||||
t.Errorf("end-of-message response = %v, want continue", resp)
|
||||
|
||||
Reference in New Issue
Block a user