Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another case of panic of CNAME #6

Open
devl00p opened this issue Mar 30, 2023 · 2 comments
Open

Another case of panic of CNAME #6

devl00p opened this issue Mar 30, 2023 · 2 comments

Comments

@devl00p
Copy link

devl00p commented Mar 30, 2023

Hello,

I bumped into a case similar to issue #5 but not caugth in v0.9.5.

It would be nice to have the same warning.

Traceback:

panic: interface conversion: dns.RR is *dns.CNAME, not *dns.MX

goroutine 1 [running]:
github.com/mileusna/spf.lookupMX({0xc00003777a?, 0x47fb89?})
        /home/nico/go/pkg/mod/github.com/mileusna/[email protected]/resolver.go:112 +0x145
github.com/mileusna/spf.(*check).checkMX(0x868138?, {0xc0003eb380, 0x10, 0x10}, {0xc00003777a?, 0x4bdc26?}, {0x0, 0x0}, {0x0, 0x0})
        /home/nico/go/pkg/mod/github.com/mileusna/[email protected]/spf.go:207 +0x66
github.com/mileusna/spf.(*check).checkHost(0xc00052fcc8, {0xc0003eb380, 0x10, 0x10}, {0xc0000bbe6b, 0xb}, {0xc0000bbf80, 0x11})
        /home/nico/go/pkg/mod/github.com/mileusna/[email protected]/spf.go:85 +0x47b
github.com/mileusna/spf.CheckHost({0xc0003eb380?, 0x8?, 0xc00052fd90?}, {0xc0000bbe6b?, 0x1?}, {0xc0000bbf80?, 0x7b47c0?}, {0x0?, 0xc00039fda8?})
        /home/nico/go/pkg/mod/github.com/mileusna/[email protected]/spf.go:60 +0xb0
main.main()
        /home/nico/dev/checkspf/main.go:124 +0x435
exit status 2

Code:

package main

import (
    "net"
    "fmt"

    "github.com/mileusna/spf"
)

func main() {
    ip := net.ParseIP("123.123.123.123")
    r := spf.CheckHost(ip, "annonces.fr", "[email protected]", "")
    fmt.Printf("status: %s\n", r)
}

SPF is the following:

v=spf1 mx:www.annonces.fr mx:smtp.triplemind.com mx:mx.fluxgrid.net ?all

Thank you for your help

Regards

@devl00p
Copy link
Author

devl00p commented Mar 30, 2023

And another case, not in mx (domain lherbergement.fr):

v=spf1 include:spf.protection.outlook.com include:_spf.google.com include:_spf.afi-sa.net include:spf.ecollectivites.fr ip4:77.159.229.30 ip4:77.159.229.23 ip4:135.125.126.160/27 -all

@mileusna
Copy link
Owner

Yes, it have that same assumption that the record is not CNAME on other places as well. I will take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants