+2014-06-18 Bob Halley <halley@dnspython.org>
+
+ * dns/rdtypes/IN/APL.py: The APL from_wire() method did not accept an
+ rdata length of 0 as valid. Thanks to salzmdan for reporting the
+ problem.
+
2014-05-31 Bob Halley <halley@dnspython.org>
* dns/ipv6.py: Add is_mapped()
def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
items = []
while 1:
+ if rdlen == 0:
+ break
if rdlen < 4:
raise dns.exception.FormError
header = struct.unpack('!HBB', wire[current : current + 4])
rdlen -= afdlen
item = APLItem(header[0], negation, address, header[1])
items.append(item)
- if rdlen == 0:
- break
return cls(rdclass, rdtype, items)
from_wire = classmethod(from_wire)
"1 0 100 ABCD SCBCQHKU35969L2A68P3AD59LHF30715")
self.failUnless(rdata.windows == [])
+ def test_zero_size_APL(self):
+ rdata = dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.APL,
+ "")
+ rdata2 = dns.rdata.from_wire(dns.rdataclass.IN, dns.rdatatype.APL,
+ "", 0, 0)
+ self.failUnless(rdata == rdata2)
+
if __name__ == '__main__':
unittest.main()