Opened 8 years ago

Closed 8 years ago

#5421 defect closed fixed (fixed)

twisted.names.client.lookupAuthority displays authoritative name servers as 'auth=False'.

Reported by: Jacques Uber Owned by: Jean-Paul Calderone
Priority: normal Milestone:
Component: names Keywords: lookupAuthority
Cc: Branch: branches/rrheader-auth-5421
branch-diff, diff-cov, branch-cov, buildbot
Author: exarkun

Description (last modified by Thijs Triemstra)

If you want to test this out, here is a script.

#!/usr/bin/env python

from twisted.names import client
from twisted.internet import reactor
import sys

r = client.Resolver(servers=[('128.193.0.10',53)])

def test_soa(a):
    print a
    reactor.stop()


if __name__ == '__main__':
    r.lookupAuthority(sys.argv[1]).addCallback(test_soa)
    reactor.run()

Here is the output along with a dig showing the correct results.

uberj@uberj ~/Downloads/Twisted-11.1.0 (> ^ ^)> python soa_bug.py oregonstate.edu
([<RR name=oregonstate.edu type=SOA class=IN ttl=86400s auth=False>], [<RR name=oregonstate.edu type=NS class=IN ttl=86400s auth=False>, <RR name=oregonstate.edu type=NS class=IN ttl=86400s auth=False>, <RR name=oregonstate.edu type=NS class=IN ttl=86400s auth=False>, <RR name=oregonstate.edu type=NS class=IN ttl=86400s auth=False>, <RR name=oregonstate.edu type=NS class=IN ttl=86400s auth=False>], [<RR name=dns.merit.net type=A class=IN ttl=4294s auth=False>, <RR name=ns1.nero.net type=A class=IN ttl=4289s auth=False>, <RR name=ns1.ucsb.edu type=A class=IN ttl=1797s auth=False>, <RR name=ns1.ucsb.edu type=AAAA class=IN ttl=961s auth=False>, <RR name=ns1.oregonstate.edu type=A class=IN ttl=86400s auth=False>, <RR name=ns2.oregonstate.edu type=A class=IN ttl=86400s auth=False>])

uberj@uberj ~/Downloads/Twisted-11.1.0 (> ^ ^)> dig +short @ns2.oregonstate.edu oregonstate.edu soa
ns1.oregonstate.edu. hostmaster.oregonstate.edu. 1323150914 300 900 604800 86400

Here is a patch. Credit goes to exarkun in #twisted.

  • twisted/names/dns.py

     
    16351635
    16361636    def parseRecords(self, list, num, strio):
    16371637        for i in range(num):
    1638             header = RRHeader()
     1638            header = RRHeader(auth=self.auth)
    16391639            try:
    16401640                header.decode(strio)
    16411641            except EOFError:

Change History (5)

comment:1 Changed 8 years ago by Thijs Triemstra

Description: modified (diff)

comment:2 Changed 8 years ago by Jean-Paul Calderone

Author: exarkun
Branch: branches/rrheader-auth-5421

(In [33381]) Branching to 'rrheader-auth-5421'

comment:3 Changed 8 years ago by Jean-Paul Calderone

Keywords: review added

comment:4 Changed 8 years ago by Glyph

Keywords: review removed
Owner: set to Jean-Paul Calderone

Looks great. A very nice, straightforward fix. Please land.

comment:5 Changed 8 years ago by Jean-Paul Calderone

Resolution: fixed
Status: newclosed

(In [33417]) Merge rrheader-auth-5421

Author: exarkun Reviewer: glyph Fixes: #5421

When constructing RRHeader instances while parsing a message into a twisted.names.dns.Message instance, set the auth flag on the RRHeader instead to match the auth flag on the Message instance.

This makes RRHeader.auth reflect whether the record is part of an authoritative message or not.

Note: See TracTickets for help on using tickets.