Skip to content

fix: allow relative aliases after unchanged exact chain lookups - #871

Open
mvanhorn wants to merge 1 commit into
foxcpp:masterfrom
mvanhorn:fix/734-relative-aliases-optional-chain
Open

mvanhorn wants to merge 1 commit into
foxcpp:masterfrom
mvanhorn:fix/734-relative-aliases-optional-chain

Conversation

@mvanhorn

Copy link
Copy Markdown

Why

A relative alias that maps only a local part, such as cat to dog, leaves the recipient unchanged, and the message is rejected because that user does not exist. The same alias works when both sides are full addresses. In the usual rewrite chain, the documented rule that should turn cat@example.net into dog@example.net has no effect.

Exact-address lookup is treated as final as soon as it returns any value, so the local-part lookup is skipped. An optional chain step echoes its lookup key when it has nothing to substitute, and that echo is a single value equal to the normalized address. The rewrite stops on that echo before the relative alias is read.

Summary

When the exact lookup returns one value equal to the normalized address and that address has a domain, the result is cleared and the local-part lookup still runs. Any other exact result is kept and applied once. A domain-less value such as postmaster stays on the exact path, so that echo is not joined with an empty domain. The envelope modifier reference describes this unchanged exact result, and a test expects cat@example.org to become dog@example.org when the full address maps to itself and cat maps to dog.

Testing

Go test ./internal/modify/... passed. Ran go test ./... in a Linux container (golang:1.24) for the maddy change; it passed. The tests in internal/modify/replace_addr_test.go fail without the fix in the maddy change (checked by reverting the source changes).

Fixes #734

When the exact lookup returns one value equal to the normalized address
and that address has a domain, the result is cleared and the local-part
lookup still runs. Any other exact result is kept and applied once. A
domain-less value such as postmaster stays on the exact path, so that
echo is not joined with an empty domain. The envelope modifier reference
describes this unchanged exact result, and a test expects
cat@example.org to become dog@example.org when the full address maps to
itself and cat maps to dog.

Fixes foxcpp#734

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relative aliases dont work

1 participant