Skip to content

Commit

Permalink
Fix --dnssec and add a test (#442)
Browse files Browse the repository at this point in the history
* fixed dnssec record fetching

* added dnssec fetching smoke test

* lint
  • Loading branch information
phillip-stephens authored Sep 12, 2024
1 parent fa97e8e commit f68bf09
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
8 changes: 1 addition & 7 deletions src/zdns/lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,7 @@ func (r *Resolver) followingLookup(ctx context.Context, q Question, nameServer *

// populateResults will parse the Answers and update the candidateSet, cnameSet, and garbage caching maps
populateResults(res.Answers, q.Type, candidateSet, cnameSet, dnameSet, garbage)
for _, ans := range res.Answers {
answer, ok := ans.(Answer)
if !ok {
continue
}
allAnswerSet = append(allAnswerSet, answer)
}
allAnswerSet = append(allAnswerSet, res.Answers...)

if isLookupComplete(originalName, candidateSet, cnameSet, dnameSet) {
return &SingleQueryResult{
Expand Down
13 changes: 13 additions & 0 deletions testing/integration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,19 @@ def test_a_lookup_IP_name_server_with_input_flag_loopback_mismatch(self):
self.assertEqual(res["results"]["A"]["data"]["resolver"], "8.8.8.8:53", "user-supplied name server with input "
"should take precedence")

def test_dnssec_option(self):
c = "A --dnssec --name-servers=1.0.0.1"
name = "cloudflare.com"
cmd, res = self.run_zdns(c, name)
self.assertSuccess(res, cmd, "A")
hasRRSIG = False
for record in res["results"]["A"]["data"]["answers"]:
if record["type"] == "RRSIG":
hasRRSIG = True
break
self.assertTrue(hasRRSIG, "DNSSEC option should return an RRSIG record")




if __name__ == "__main__":
Expand Down

0 comments on commit f68bf09

Please sign in to comment.