Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* Better presentation of signatures in HTML

* EDNS buffer size bug fixed
  • Loading branch information...
commit 74a52ec89e48a55013d7fdee2b8e4a971a6a8250 1 parent 1133994
@bortzmeyer authored
Showing with 24 additions and 6 deletions.
  1. +16 −3 DNSLG/Formatter.py
  2. +1 −1  DNSLG/Resolver.py
  3. +7 −2 DNSLG/__init__.py
View
19 DNSLG/Formatter.py
@@ -696,7 +696,7 @@ def result(self, querier):
<div class="body">
<p tal:condition="distinctowner">Response is name <span class="hostname" tal:content="ownername"/>.</p><p tal:condition="flags">Response flags are: <span tal:replace="flags"/>.</p>
<div class="rrsets" tal:repeat="rrset rrsets">
- <p><span tal:condition="rrset/ttl">Time-to-Live of this answer is <span tal:replace="rrset/ttl"/>.</span></p>
+ <p><span tal:condition="rrset/ttl">Time-to-Live of this answer is <span tal:replace="rrset/ttl"/>: </span></p>
<ul tal:condition="rrset/records">
<li tal:repeat="record rrset/records" tal:content="structure record"/>
</ul>
@@ -720,7 +720,10 @@ def result(self, querier):
"""
# TODO: better presentation of "admin" (replacement of . by @ and mailto: URL)
# TODO: better presentation of intervals? (Weeks, days, etc)
-# TODO: indicate the type of the record before the answer? Not obvious. At least add an explanatory text instead of just the data (TODO CRIT)
+# TODO: indicate the type of the record before the answer? Not obvious
+# since it is useless when there is only one type requested. At least
+# test if the QTYPE was ANY and add an explanatory text instead of
+# just the data.
soa_html_template = """
<span>Zone administrator <span tal:replace="admin"/>, master server <a class="hostname" tal:attributes="href path" tal:content="master"/>, serial number <span tal:replace="serial"/>, refresh interval <span tal:replace="refresh"/> s, retry interval <span tal:replace="retry"/> s, expiration delay <span tal:replace="expire"/> s, negative reply TTL <span tal:replace="minimum"/> s</span>
"""
@@ -754,6 +757,10 @@ def result(self, querier):
dnskey_html_template = """
<span><span tal:condition="keytag">Key <span tal:replace="keytag"/>, </span>algorithm <span tal:replace="algorithm"/>, length <span tal:replace="length"/> bits, flags <span tal:replace="flags"/></span>
"""
+# TODO display the key tag, the inception and expiration time?
+rrsig_html_template = """
+<span>DNSSEC signature</span>
+"""
sshfp_html_template = """
<span>Algorithm <span tal:replace="algorithm"/>, Fingerprint type <span tal:replace="fptype"/>, fingerprint <span tal:replace="fingerprint"/></span>
"""
@@ -851,6 +858,7 @@ def format(self, answer, qtype, flags, querier):
self.ds_template = simpleTAL.compileXMLTemplate (ds_html_template)
self.dlv_template = simpleTAL.compileXMLTemplate (dlv_html_template)
self.dnskey_template = simpleTAL.compileXMLTemplate (dnskey_html_template)
+ self.rrsig_template = simpleTAL.compileXMLTemplate (rrsig_html_template)
self.sshfp_template = simpleTAL.compileXMLTemplate (sshfp_html_template)
self.naptr_template = simpleTAL.compileXMLTemplate (naptr_html_template)
self.unknown_template = simpleTAL.compileXMLTemplate (unknown_html_template)
@@ -1010,6 +1018,12 @@ def format(self, answer, qtype, flags, querier):
self.dnskey_template.expand (icontext, iresult,
suppressXMLDeclaration=True,
outputEncoding=querier.encoding)
+ elif rdata.rdtype == dns.rdatatype.RRSIG:
+ self.rrsig_template.expand (icontext, iresult,
+ suppressXMLDeclaration=True,
+ outputEncoding=querier.encoding)
+ elif rdata.rdtype == dns.rdatatype.NSEC or rdata.rdtype == dns.rdatatype.NSEC3:
+ pass # Can it happen? We do not display anything if NXDOMAIN or ANSWER=0
elif rdata.rdtype == dns.rdatatype.SSHFP:
icontext.addGlobal ("algorithm", rdata.algorithm)
icontext.addGlobal ("fptype", rdata.fp_type)
@@ -1028,7 +1042,6 @@ def format(self, answer, qtype, flags, querier):
self.naptr_template.expand (icontext, iresult,
suppressXMLDeclaration=True,
outputEncoding=querier.encoding)
- # TODO CRIT: handle RRSIG (46) and NSEC (47) and NSEC3
else:
icontext.addGlobal ("rrtype", rdata.rdtype)
self.unknown_template.expand (icontext, iresult,
View
2  DNSLG/Resolver.py
@@ -72,7 +72,7 @@ def query(self, name, type, tcp=False, cd=False):
want_dnssec=self.do)
except dns.rdatatype.UnknownRdatatype:
raise UnknownRRtype()
- message.payload = DEFAULT_EDNS_SIZE
+ message.payload = self.payload
except dns.rdatatype.UnknownRdatatype:
raise UnknownRRtype()
if cd:
View
9 DNSLG/__init__.py
@@ -216,8 +216,13 @@ def query(self, start_response, path, client, format="HTML", alt_resolver=None,
elif format == "XML":
formatter = Formatter.XmlFormatter(domain)
self.resolver.reset()
- if do_dnssec:
- self.resolver.set_edns(dnssec=True)
+ if edns_size is None:
+ self.resolver.set_edns(version=-1)
+ else:
+ if do_dnssec:
+ self.resolver.set_edns(payload=edns_size, dnssec=True)
+ else:
+ self.resolver.set_edns(payload=edns_size)
if alt_resolver:
self.resolver.set_nameservers([alt_resolver,])
query_start = datetime.now()
Please sign in to comment.
Something went wrong with that request. Please try again.