mirror of
https://blitiri.com.ar/repos/chasquid
synced 2026-01-07 17:47:14 +00:00
chasquid: Fail at RCPT TO time if a user does not exist
It's more convenient and in line with standard practice to fail RCPT TO if the user does not exist. This involves making the server and client aware of aliases, but it doesn't end up being very convoluted, and simplifies other code.
This commit is contained in:
@@ -120,6 +120,19 @@ func (v *Resolver) Resolve(addr string) ([]Recipient, error) {
|
||||
return v.resolve(0, addr)
|
||||
}
|
||||
|
||||
// Exists check that the address exists in the database.
|
||||
// It returns the cleaned address, and a boolean indicating the result.
|
||||
// The clean address can be used to look it up in other databases, even if it
|
||||
// doesn't exist.
|
||||
func (v *Resolver) Exists(addr string) (string, bool) {
|
||||
v.mu.Lock()
|
||||
defer v.mu.Unlock()
|
||||
|
||||
addr = v.cleanIfLocal(addr)
|
||||
_, ok := v.aliases[addr]
|
||||
return addr, ok
|
||||
}
|
||||
|
||||
func (v *Resolver) resolve(rcount int, addr string) ([]Recipient, error) {
|
||||
if rcount >= recursionLimit {
|
||||
return nil, ErrRecursionLimitExceeded
|
||||
|
||||
Reference in New Issue
Block a user