]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
parse LOC milliseconds correctly
authorBob Halley <halley@dnspython.org>
Fri, 2 Sep 2005 05:22:55 +0000 (05:22 +0000)
committerBob Halley <halley@dnspython.org>
Fri, 2 Sep 2005 05:22:55 +0000 (05:22 +0000)
Original author: Bob Halley <halley@dnspython.org>
Date: 2004-06-16 05:27:28

ChangeLog
README
dns/rdtypes/ANY/LOC.py
dns/version.py
setup.py
tests/example
tests/example1.good
tests/example2.good

index 7fcdc44023b7afb309757257493e1cf0b1a42f72..25036a1fbe901a33f3e86848222c4fad6cd56b89 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-06-16  Bob Halley  <halley@dnspython.org>
+
+       * dns/rdtypes/ANY/LOC.py (LOC.from_text): LOC milliseconds values
+       were converted incorrectly if the length of the milliseconds
+       string was less than 3.
+
 2004-06-06  Bob Halley  <halley@dnspython.org>
 
        * (Version 1.3.1 released)
diff --git a/README b/README
index b8273ae5d27270e9f23e00203274af1c84c1646b..2fc4c6011100c584a8ff61240dcc087fda51308c 100644 (file)
--- a/README
+++ b/README
@@ -22,7 +22,12 @@ development by continuing to employ the author :).
 
 ABOUT THIS RELEASE
 
-This is dnspython 1.3.1.
+This is dnspython 1.3.2.
+
+New since 1.3.1:
+
+        The conversion of LOC milliseconds values from text to binary was
+       incorrect if the length of the milliseconds string was not 3.
 
 New since 1.3.0:
 
index f30bb95acc20cf62613b0c84902e478dd91e0f4c..a8dda7180644cdb379dfe81b12e820626500f971 100644 (file)
@@ -166,8 +166,24 @@ class LOC(dns.rdata.Rdata):
             t = tok.get_string()
             if '.' in t:
                 (seconds, milliseconds) = t.split('.')
+                if not seconds.isdigit():
+                    raise dns.exception.SyntaxError, \
+                          'bad latitude seconds value'
                 latitude[2] = int(seconds)
-                latitude[3] = int(milliseconds)
+                if latitude[2] >= 60:
+                    raise dns.exception.SyntaxError, \
+                          'latitude seconds >= 60'
+                l = len(milliseconds)
+                if l == 0 or l > 3 or not milliseconds.isdigit():
+                    raise dns.exception.SyntaxError, \
+                          'bad latitude milliseconds value'
+                if l == 1:
+                    m = 100
+                elif l == 2:
+                    m = 10
+                else:
+                    m = 1
+                latitude[3] = m * int(milliseconds)
                 t = tok.get_string()
             elif t.isdigit():
                 latitude[2] = int(t)
@@ -184,8 +200,24 @@ class LOC(dns.rdata.Rdata):
             t = tok.get_string()
             if '.' in t:
                 (seconds, milliseconds) = t.split('.')
+                if not seconds.isdigit():
+                    raise dns.exception.SyntaxError, \
+                          'bad longitude seconds value'
                 longitude[2] = int(seconds)
-                longitude[3] = int(milliseconds)
+                if longitude[2] >= 60:
+                    raise dns.exception.SyntaxError, \
+                          'longitude seconds >= 60'
+                l = len(milliseconds)
+                if l == 0 or l > 3 or not milliseconds.isdigit():
+                    raise dns.exception.SyntaxError, \
+                          'bad longitude milliseconds value'
+                if l == 1:
+                    m = 100
+                elif l == 2:
+                    m = 10
+                else:
+                    m = 1
+                longitude[3] = m * int(milliseconds)
                 t = tok.get_string()
             elif t.isdigit():
                 longitude[2] = int(t)
index f27cf4a99749bfaea0198d190e53daecea38c939..b2cf98adfe101afd3a1bb6b09a1e3100241a1841 100644 (file)
@@ -19,7 +19,7 @@
 
 MAJOR = 1
 MINOR = 3
-MICRO = 1
+MICRO = 2
 RELEASELEVEL = 0x0f
 SERIAL = 0
 
index 170ab84c30aa22ee14e0464b1acba3d6a29d3faa..fe364fa4fd693da45b0e9c7dd7fdd87b1a8fb9f9 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,7 @@ from distutils.core import setup
 
 setup(
     name = "dnspython",
-    version = "1.3.1",
+    version = "1.3.2",
     description = "DNS toolkit",
     long_description = \
     """dnspython is a DNS toolkit for Python. It supports almost all
index 4dcb0f1ece011809f2bfada3834a294596831e6b..27420f1ba413fcf263fd44cd7a4070a20f6f07b3 100644 (file)
@@ -110,6 +110,8 @@ kx02                        KX      10 .
 loc01                  LOC     60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m
 loc02                  LOC     60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m
 loc03                  LOC     60 9 0.000 N 24 39 0.000 E 10.00m 90000000.00m 2000m 20m
+loc04                  LOC     60 9 1.5 N 24 39 0.000 E 10.00m 20m 2000m 20m
+loc05                  LOC     60 9 1.51 N 24 39 0.000 E 10.00m 20m 2000m 20m
 ;;
 ;; XXXRTH  These are all obsolete and unused.  dnspython doesn't implement
 ;; them
index 4cd2d649be1e1efe7b6d70983daa7d2ec2046625..f71c6d452bf63291742939458533a57d42959c79 100644 (file)
@@ -48,6 +48,8 @@ kx02 3600 IN KX 10 .
 loc01 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20.00m 2000.00m 20.00m
 loc02 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20.00m 2000.00m 20.00m
 loc03 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 90000000.00m 2000.00m 20.00m
+loc04 3600 IN LOC 60 9 1.500 N 24 39 0.000 E 10.00m 20.00m 2000.00m 20.00m
+loc05 3600 IN LOC 60 9 1.510 N 24 39 0.000 E 10.00m 20.00m 2000.00m 20.00m
 mx01 3600 IN MX 10 mail
 mx02 3600 IN MX 10 .
 naptr01 3600 IN NAPTR 0 0 "" "" "" .
index 5cf5a4c06a0cb85a3cbdc724cd7c6e4b889402de..64b6df5c01ac8dd658e1802b3efeaff24d80d706 100644 (file)
@@ -48,6 +48,8 @@ kx02.example. 3600 IN KX 10 .
 loc01.example. 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20.00m 2000.00m 20.00m
 loc02.example. 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20.00m 2000.00m 20.00m
 loc03.example. 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 90000000.00m 2000.00m 20.00m
+loc04.example. 3600 IN LOC 60 9 1.500 N 24 39 0.000 E 10.00m 20.00m 2000.00m 20.00m
+loc05.example. 3600 IN LOC 60 9 1.510 N 24 39 0.000 E 10.00m 20.00m 2000.00m 20.00m
 mx01.example. 3600 IN MX 10 mail.example.
 mx02.example. 3600 IN MX 10 .
 naptr01.example. 3600 IN NAPTR 0 0 "" "" "" .