Closed
Description
Calling NewRR(". 1 IN CNAME example.com")
normally turns example.com
into an FQDN, example.com.
, before storing it in the RR's Target
variable.
However, NewRR(". 1 IN CNAME example.com\\")
with a trailing backslash results in example.com\.
, which is not an FQDN since the last dot is escaped.
It seems to me like the parser should either add another dot in these cases, or (perhaps better) reject the trailing backslash with an error.
package main
import (
"fmt"
"github.com/miekg/dns"
)
func test(content string) {
rr, err := dns.NewRR(content)
if err != nil {
panic(err)
}
target := rr.(*dns.CNAME).Target
fmt.Printf("target %s is FQDN: %t\n", target, dns.IsFqdn(target))
}
func main() {
test(`. 1 IN CNAME example.com`)
test(`. 1 IN CNAME example.com\`)
}
$ go run ./...
target example.com. is FQDN: true
target example.com\. is FQDN: false
This may be related to #1384.
Metadata
Metadata
Assignees
Labels
No labels