mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-18 14:47:03 +00:00
aliases: Support '*' as the destination user
This patch implements support for aliases that contain '*' as the destination user. In that case, we replace it with the original user. For example, `*: *@pond` will redirect `lilly@domain` to `lilly@pond`. This is experimental for now, and marked as such in the documentation. The semantics can be subtle, so we may need to adjust them later.
This commit is contained in:
@@ -286,6 +286,16 @@ func (v *Resolver) resolve(rcount int, addr string, tr *trace.Trace) ([]Recipien
|
||||
continue
|
||||
}
|
||||
|
||||
// If the user of the destination is "*", then we replace it with the
|
||||
// original user.
|
||||
// This allows for catch-all aliases that forward using the original
|
||||
// user, like "*: *@otherdomain".
|
||||
if envelope.UserOf(r.Addr) == "*" {
|
||||
newAddr := user + "@" + envelope.DomainOf(r.Addr)
|
||||
tr.Debugf("%d| replacing %q with %q", rcount, r.Addr, newAddr)
|
||||
r.Addr = newAddr
|
||||
}
|
||||
|
||||
ar, err := v.resolve(rcount+1, r.Addr, tr)
|
||||
if err != nil {
|
||||
tr.Debugf("%d| resolve(%q) returned error: %v", rcount, r.Addr, err)
|
||||
|
||||
Reference in New Issue
Block a user