]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Fix SRV record comparison
authorBob Halley <halley@nominum.com>
Thu, 23 Jul 2009 18:26:51 +0000 (11:26 -0700)
committerBob Halley <halley@nominum.com>
Thu, 23 Jul 2009 18:26:51 +0000 (11:26 -0700)
ChangeLog
dns/rdtypes/IN/SRV.py

index 50f902efb5fc02f5a46b7d4b8e6741bd54038f07..c75df5bb72756ee3be0edb25161f300bcf75f075 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 2009-07-23  Bob Halley  <halley@dnspython.org>
 
-       * dns/e164.py (query): The resolver parameter was never used.
+       * dns/rdtypes/IN/SRV.py (SRV._cmp): SRV records were compared
+         incorrectly due to a cut-and-paste error.  Thanks to Tommie
+         Gannert for reporting this bug.
+
+       * dns/e164.py (query): The resolver parameter was not used.
+         Thanks to Matías Bellone for reporting this bug.
 
 2009-06-23  Bob Halley  <halley@dnspython.org>
 
index 2689d7f9eb121500e223152ef2cb28144c596d92..2e78513db1a7bf40ff40596b6e253f070a1345d0 100644 (file)
@@ -33,7 +33,7 @@ class SRV(dns.rdata.Rdata):
     @see: RFC 2782"""
 
     __slots__ = ['priority', 'weight', 'port', 'target']
-    
+
     def __init__(self, rdclass, rdtype, priority, weight, port, target):
         super(SRV, self).__init__(rdclass, rdtype)
         self.priority = priority
@@ -45,7 +45,7 @@ class SRV(dns.rdata.Rdata):
         target = self.target.choose_relativity(origin, relativize)
         return '%d %d %d %s' % (self.priority, self.weight, self.port,
                                 target)
-        
+
     def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
         priority = tok.get_uint16()
         weight = tok.get_uint16()
@@ -54,14 +54,14 @@ class SRV(dns.rdata.Rdata):
         target = target.choose_relativity(origin, relativize)
         tok.get_eol()
         return cls(rdclass, rdtype, priority, weight, port, target)
-    
+
     from_text = classmethod(from_text)
 
     def to_wire(self, file, compress = None, origin = None):
         three_ints = struct.pack("!HHH", self.priority, self.weight, self.port)
         file.write(three_ints)
         self.target.to_wire(file, compress, origin)
-        
+
     def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
         (priority, weight, port) = struct.unpack('!HHH',
                                                  wire[current : current + 6])
@@ -82,7 +82,7 @@ class SRV(dns.rdata.Rdata):
 
     def _cmp(self, other):
         sp = struct.pack("!HHH", self.priority, self.weight, self.port)
-        op = struct.pack("!HHH", other.priority, self.weight, self.port)
+        op = struct.pack("!HHH", other.priority, other.weight, other.port)
         v = cmp(sp, op)
         if v == 0:
             v = cmp(self.target, other.target)