mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-22 15:27:02 +00:00
sts: Don't pre-filter MX list, but skip them if needed
Instead of pre-filtering the MX list based on STS policy, just check if it's allowed before each attempt, and skip it if not. This simplifies the code.
This commit is contained in:
@@ -140,9 +140,13 @@ func (p *Policy) Check() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MXMatches checks if the given MX is allowed, according to the policy.
|
||||
// MXIsAllowed checks if the given MX is allowed, according to the policy.
|
||||
// https://tools.ietf.org/html/draft-ietf-uta-mta-sts-18#section-4.1
|
||||
func (p *Policy) MXIsAllowed(mx string) bool {
|
||||
if p.Mode != Enforce {
|
||||
return true
|
||||
}
|
||||
|
||||
for _, pattern := range p.MXs {
|
||||
if matchDomain(mx, pattern) {
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user