1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

smtpsrv: Use spf.CheckHostWithSender

The spf library has gained support for macros, but to process them
properly, a new function needs to be called with the full sender
address, spf.CheckHostWithSender.

This patch updates chasquid's calls to the new API.
This commit is contained in:
Alberto Bertogli
2019-10-14 19:37:14 +01:00
parent 3584441549
commit 41d960590d
3 changed files with 5 additions and 4 deletions

View File

@@ -72,7 +72,7 @@ func main() {
log.Fatal(err)
}
for _, ip := range ips {
result, err := spf.CheckHost(ip, domain)
result, err := spf.CheckHostWithSender(ip, domain, "test@"+domain)
if result != spf.Pass {
log.Printf("SPF check != pass for IP %s: %s - %s",
ip, result, err)

View File

@@ -16,7 +16,8 @@ import (
func main() {
flag.Parse()
r, err := spf.CheckHost(net.ParseIP(flag.Arg(0)), flag.Arg(1))
r, err := spf.CheckHostWithSender(
net.ParseIP(flag.Arg(0)), "", flag.Arg(1))
fmt.Println(r)
fmt.Println(err)
}

View File

@@ -439,8 +439,8 @@ func (c *Conn) checkSPF(addr string) (spf.Result, error) {
}
if tcp, ok := c.conn.RemoteAddr().(*net.TCPAddr); ok {
res, err := spf.CheckHost(
tcp.IP, envelope.DomainOf(addr))
res, err := spf.CheckHostWithSender(
tcp.IP, envelope.DomainOf(addr), addr)
c.tr.Debugf("SPF %v (%v)", res, err)
spfResultCount.Add(string(res), 1)