• Miek Gieben's avatar
    middleware/secondary: fix crash with no zone (#680) · 30ecb83d
    Miek Gieben authored
    When CoreDNS starts up and can't get a zone transfer going the Apex is
    empty. This `nil` is then transformed into wireformat, which fails with
    a nil pointer dereference in Go DNS.
    
    In this case we should just return SERVFAIL, because we don't have any
    info (yet). Note the lookup code returned NXDOMAIN, which is correct
    from a lookup standpoint, but also invalidates every name in the future
    loaded zone.
    
    Anyway, look for an apex before doing the lookup and return SERVFAIL if
    nothing is found.
    
    Fixes #679
    30ecb83d
secondary_test.go 1017 Bytes