mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-18 14:47:03 +00:00
Normalize local usernames using PRECIS
This patch implements local username normalization using PRECIS (https://tools.ietf.org/html/rfc7564, https://tools.ietf.org/html/rfc7613) It makes chasquid accept local email and authentication regardless of the case. It covers both userdb and aliases. Note that non-local usernames remain untouched.
This commit is contained in:
12
chasquid.go
12
chasquid.go
@@ -25,6 +25,7 @@ import (
|
||||
"blitiri.com.ar/go/chasquid/internal/config"
|
||||
"blitiri.com.ar/go/chasquid/internal/courier"
|
||||
"blitiri.com.ar/go/chasquid/internal/envelope"
|
||||
"blitiri.com.ar/go/chasquid/internal/normalize"
|
||||
"blitiri.com.ar/go/chasquid/internal/queue"
|
||||
"blitiri.com.ar/go/chasquid/internal/set"
|
||||
"blitiri.com.ar/go/chasquid/internal/spf"
|
||||
@@ -738,8 +739,15 @@ func (c *Conn) RCPT(params string) (code int, msg string) {
|
||||
return 503, "relay not allowed"
|
||||
}
|
||||
|
||||
if localDst && !c.userExists(addr) {
|
||||
return 550, "recipient unknown, please check the address for typos"
|
||||
if localDst {
|
||||
addr, err = normalize.Addr(addr)
|
||||
if err != nil {
|
||||
return 550, "recipient invalid, please check the address for typos"
|
||||
}
|
||||
|
||||
if !c.userExists(addr) {
|
||||
return 550, "recipient unknown, please check the address for typos"
|
||||
}
|
||||
}
|
||||
|
||||
c.rcptTo = append(c.rcptTo, addr)
|
||||
|
||||
Reference in New Issue
Block a user