[python-dns/el6] ecdsa not ready in el6. Only fix LOC

Paul Wouters pwouters at fedoraproject.org
Wed Feb 19 19:04:52 UTC 2014


commit 334cb7bd0a4095791fa78ab1ae2c2e5b52084582
Author: Paul Wouters <pwouters at redhat.com>
Date:   Wed Feb 19 14:05:16 2014 -0500

    ecdsa not ready in el6. Only fix LOC

 dnspython-1.11.1-ecdsa-loc.patch | 1671 --------------------------------------
 dnspython-1.11.1-loc.patch       |  203 +++++
 python-dns.spec                  |    4 +-
 3 files changed, 205 insertions(+), 1673 deletions(-)
---
diff --git a/dnspython-1.11.1-loc.patch b/dnspython-1.11.1-loc.patch
new file mode 100644
index 0000000..f2a8a0b
--- /dev/null
+++ b/dnspython-1.11.1-loc.patch
@@ -0,0 +1,203 @@
+diff -Naur dnspython-orig/dnspython-1.11.1/ChangeLog dnspython/dnspython-1.11.1/ChangeLog
+--- dnspython-orig/dnspython-1.11.1/ChangeLog	2013-09-02 14:50:25.000000000 -0400
++++ dnspython/dnspython-1.11.1/ChangeLog	2014-02-19 13:53:59.179676359 -0500
+@@ -1,3 +1,9 @@
++2013-12-11  Bob Halley  <halley at dnspython.org>
++
++	* dns/query.py: Fix problems with the IXFR state machine which caused
++	  long diffs to fail.  Thanks to James Raftery for the fix and the
++	  repeated prodding to get it applied :)
++
+ 2013-09-02  Bob Halley  <halley at dnspython.org>
+ 
+ 	* (Version 1.11.1 released)
+diff -Naur dnspython-orig/dnspython-1.11.1/dns/query.py dnspython/dnspython-1.11.1/dns/query.py
+--- dnspython-orig/dnspython-1.11.1/dns/query.py	2013-08-26 12:04:21.000000000 -0400
++++ dnspython/dnspython-1.11.1/dns/query.py	2014-02-19 13:53:59.180676335 -0500
+@@ -411,6 +411,8 @@
+         tcpmsg = struct.pack("!H", l) + wire
+         _net_write(s, tcpmsg, expiration)
+     done = False
++    delete_mode = True
++    expecting_SOA = False
+     soa_rrset = None
+     soa_count = 0
+     if relativize:
+@@ -439,18 +441,16 @@
+         tsig_ctx = r.tsig_ctx
+         first = False
+         answer_index = 0
+-        delete_mode = False
+-        expecting_SOA = False
+         if soa_rrset is None:
+             if not r.answer or r.answer[0].name != oname:
+-                raise dns.exception.FormError
++                raise dns.exception.FormError("No answer or RRset not for qname")
+             rrset = r.answer[0]
+             if rrset.rdtype != dns.rdatatype.SOA:
+                 raise dns.exception.FormError("first RRset is not an SOA")
+             answer_index = 1
+             soa_rrset = rrset.copy()
+             if rdtype == dns.rdatatype.IXFR:
+-                if soa_rrset[0].serial == serial:
++                if soa_rrset[0].serial <= serial:
+                     #
+                     # We're already up-to-date.
+                     #
+@@ -471,7 +471,14 @@
+                     expecting_SOA = False
+                 elif rdtype == dns.rdatatype.IXFR:
+                     delete_mode = not delete_mode
+-                if rrset == soa_rrset and not delete_mode:
++                #
++                # If this SOA RRset is equal to the first we saw then we're
++                # finished. If this is an IXFR we also check that we're seeing
++                # the record in the expected part of the response.
++                #
++                if rrset == soa_rrset and \
++                        (rdtype == dns.rdatatype.AXFR or \
++                        (rdtype == dns.rdatatype.IXFR and delete_mode)):
+                     done = True
+             elif expecting_SOA:
+                 #
+diff -Naur dnspython-orig/dnspython-1.11.1/dns/rdtypes/ANY/LOC.py dnspython/dnspython-1.11.1/dns/rdtypes/ANY/LOC.py
+--- dnspython-orig/dnspython-1.11.1/dns/rdtypes/ANY/LOC.py	2011-07-09 10:05:21.000000000 -0400
++++ dnspython/dnspython-1.11.1/dns/rdtypes/ANY/LOC.py	2014-02-19 13:53:59.180676335 -0500
+@@ -22,6 +22,11 @@
+ _pows = (1L, 10L, 100L, 1000L, 10000L, 100000L, 1000000L, 10000000L,
+          100000000L, 1000000000L, 10000000000L)
+ 
++# default values are in centimeters
++_default_size = 100.0
++_default_hprec = 1000000.0
++_default_vprec = 1000.0
++
+ def _exponent_of(what, desc):
+     exp = None
+     for i in xrange(len(_pows)):
+@@ -98,13 +103,14 @@
+                  'horizontal_precision', 'vertical_precision']
+ 
+     def __init__(self, rdclass, rdtype, latitude, longitude, altitude,
+-                 size=1.0, hprec=10000.0, vprec=10.0):
++                 size=_default_size, hprec=_default_hprec, vprec=_default_vprec):
+         """Initialize a LOC record instance.
+ 
+         The parameters I{latitude} and I{longitude} may be either a 4-tuple
+         of integers specifying (degrees, minutes, seconds, milliseconds),
+         or they may be floating point values specifying the number of
+-        degrees.  The other parameters are floats."""
++        degrees. The other parameters are floats. Size, horizontal precision,
++        and vertical precision are specified in centimeters."""
+ 
+         super(LOC, self).__init__(rdclass, rdtype)
+         if isinstance(latitude, int) or isinstance(latitude, long):
+@@ -141,8 +147,10 @@
+             self.longitude[3], long_hemisphere, self.altitude / 100.0
+             )
+ 
+-        if self.size != 1.0 or self.horizontal_precision != 10000.0 or \
+-           self.vertical_precision != 10.0:
++        # do not print default values
++        if self.size != _default_size or \
++            self.horizontal_precision != _default_hprec or \
++            self.vertical_precision != _default_vprec:
+             text += " %0.2fm %0.2fm %0.2fm" % (
+                 self.size / 100.0, self.horizontal_precision / 100.0,
+                 self.vertical_precision / 100.0
+@@ -152,9 +160,9 @@
+     def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
+         latitude = [0, 0, 0, 0]
+         longitude = [0, 0, 0, 0]
+-        size = 1.0
+-        hprec = 10000.0
+-        vprec = 10.0
++        size = _default_size
++        hprec = _default_hprec
++        vprec = _default_vprec
+ 
+         latitude[0] = tok.get_int()
+         t = tok.get_string()
+@@ -240,8 +248,8 @@
+                     value = token.value
+                     if value[-1] == 'm':
+                         value = value[0 : -1]
+-                        vprec = float(value) * 100.0	# m -> cm
+-                        tok.get_eol()
++                    vprec = float(value) * 100.0	# m -> cm
++                    tok.get_eol()
+ 
+         return cls(rdclass, rdtype, latitude, longitude, altitude,
+                    size, hprec, vprec)
+diff -Naur dnspython-orig/dnspython-1.11.1/tests/rdtypeanyloc.py dnspython/dnspython-1.11.1/tests/rdtypeanyloc.py
+--- dnspython-orig/dnspython-1.11.1/tests/rdtypeanyloc.py	1969-12-31 19:00:00.000000000 -0500
++++ dnspython/dnspython-1.11.1/tests/rdtypeanyloc.py	2014-02-19 13:53:59.181676313 -0500
+@@ -0,0 +1,68 @@
++# Copyright (C) 2014 Red Hat, Inc.
++# Author: Petr Spacek <pspacek at redhat.com>
++#
++# Permission to use, copy, modify, and distribute this software and its
++# documentation for any purpose with or without fee is hereby granted,
++# provided that the above copyright notice and this permission notice
++# appear in all copies.
++#
++# THE SOFTWARE IS PROVIDED 'AS IS' AND RED HAT DISCLAIMS ALL WARRANTIES
++# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
++# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
++# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++
++import unittest
++
++import dns.rrset
++import dns.rdtypes.ANY.LOC
++
++class RdtypeAnyLocTestCase(unittest.TestCase):
++
++    def testEqual1(self):
++        '''Test default values for size, horizontal and vertical precision.'''
++        r1 = dns.rrset.from_text('foo', 300, 'IN', 'LOC',
++                                 '49 11 42.400 N 16 36 29.600 E 227.64m')
++        r2 = dns.rrset.from_text('FOO', 600, 'in', 'loc',
++                                 '49 11 42.400 N 16 36 29.600 E 227.64m '
++                                 '1.00m 10000.00m 10.00m')
++        self.failUnless(r1 == r2, '"%s" != "%s"' % (r1, r2))
++
++    def testEqual2(self):
++        '''Test default values for size, horizontal and vertical precision.'''
++        r1 = dns.rdtypes.ANY.LOC.LOC(1, 29, (49, 11, 42, 400),
++                                     (16, 36, 29, 600), 22764.0) # centimeters
++        r2 = dns.rdtypes.ANY.LOC.LOC(1, 29, (49, 11, 42, 400),
++                                     (16, 36, 29, 600), 22764.0, # centimeters
++                                     100.0, 1000000.00, 1000.0)  # centimeters
++        self.failUnless(r1 == r2, '"%s" != "%s"' % (r1, r2))
++
++    def testEqual3(self):
++        '''Test size, horizontal and vertical precision parsers: 100 cm == 1 m.
++
++        Parsers in from_text() and __init__() have to produce equal results.'''
++        r1 = dns.rdtypes.ANY.LOC.LOC(1, 29, (49, 11, 42, 400),
++                                     (16, 36, 29, 600), 22764.0,
++                                     200.0, 1000.00, 200.0)      # centimeters
++        r2 = dns.rrset.from_text('FOO', 600, 'in', 'loc',
++                                 '49 11 42.400 N 16 36 29.600 E 227.64m '
++                                 '2.00m 10.00m 2.00m')[0]
++        self.failUnless(r1 == r2, '"%s" != "%s"' % (r1, r2))
++
++    def testEqual4(self):
++        '''Test size, horizontal and vertical precision parsers without unit.
++
++        Parsers in from_text() and __init__() have produce equal result
++        for values with and without trailing "m".'''
++        r1 = dns.rdtypes.ANY.LOC.LOC(1, 29, (49, 11, 42, 400),
++                                     (16, 36, 29, 600), 22764.0,
++                                     200.0, 1000.00, 200.0)      # centimeters
++        r2 = dns.rrset.from_text('FOO', 600, 'in', 'loc',
++                                 '49 11 42.400 N 16 36 29.600 E 227.64 '
++                                 '2 10 2')[0] # meters without explicit unit
++        self.failUnless(r1 == r2, '"%s" != "%s"' % (r1, r2))
++
++if __name__ == '__main__':
++    unittest.main()
diff --git a/python-dns.spec b/python-dns.spec
index d55c63f..2c93f49 100644
--- a/python-dns.spec
+++ b/python-dns.spec
@@ -37,7 +37,7 @@ Source3:        http://www.dnspython.org/kits3/%{version}/dnspython3-%{version}.
 %if 0%{?rhel} == 5
 Patch0:         0001-Don-t-fail-on-older-python-versions-because-of-hashe.patch
 %endif
-Patch1:		dnspython-1.11.1-ecdsa-loc.patch
+Patch1:		dnspython-1.11.1-loc.patch
 
 BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
@@ -258,7 +258,7 @@ rm -rf %{buildroot}
 
 %changelog
 * Tue Feb 18 2014 Paul Wouters <pwouters at redhat.com> - 1.11.1-2
-- Added LOC and ECDSA fixes from git (rhbz#1059594)
+- Added LOC fixes from git (rhbz#1059594)
 
 * Thu Sep  5 2013 Jeffrey C. Ollie <jeff at ocjtech.us> - 1.11.1-1
 - New since 1.11.0:


More information about the scm-commits mailing list