mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
aliases: Implement catch-all
This patch implements support for catch-all aliases, where users can add a `*: destination` alias. Mails sent to unknown users (or other aliases) will not be rejected, but sent to the indicated destination instead. Please see https://github.com/albertito/chasquid/issues/23 and https://github.com/albertito/chasquid/pull/24 for more discussion and background. Thanks to Alex Ellwein (aellwein@github) for the alternative patch and help with testing; and to ThinkChaos (ThinkChaos@github) for help with testing.
This commit is contained in:
@@ -224,7 +224,7 @@ func aliasesResolve() {
|
||||
}
|
||||
_ = os.Chdir(configDir)
|
||||
|
||||
r := aliases.NewResolver()
|
||||
r := aliases.NewResolver(allUsersExist)
|
||||
r.SuffixSep = *conf.SuffixSeparators
|
||||
r.DropChars = *conf.DropCharacters
|
||||
|
||||
@@ -289,6 +289,8 @@ func domaininfoRemove() {
|
||||
}
|
||||
}
|
||||
|
||||
func allUsersExist(user, domain string) (bool, error) { return true, nil }
|
||||
|
||||
// chasquid-util aliases-add <source> <target>
|
||||
func aliasesAdd() {
|
||||
source := args["$2"]
|
||||
@@ -315,7 +317,7 @@ func aliasesAdd() {
|
||||
_ = os.Chdir(configDir)
|
||||
|
||||
// Setup alias resolver.
|
||||
r := aliases.NewResolver()
|
||||
r := aliases.NewResolver(allUsersExist)
|
||||
r.SuffixSep = *conf.SuffixSeparators
|
||||
r.DropChars = *conf.DropCharacters
|
||||
|
||||
|
||||
Reference in New Issue
Block a user