]> git.eshelyaron.com Git - emacs.git/commitdiff
dns-query now represents SOA integers as integers (Bug#38937)
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 16 Jan 2020 01:53:43 +0000 (17:53 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 16 Jan 2020 01:55:15 +0000 (17:55 -0800)
* lisp/net/dns.el (dns-read-int32): Declare obsolete.
Assume bignums.
(dns-read-type): Represent SOA integers as integers, not strings.

etc/NEWS
lisp/net/dns.el

index 3d5915a3774fec07dbd5040de817ecde655dd6f9..7ea4bba9cd1f4f1a5c0a01606fd50729d8707d68 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -58,6 +58,11 @@ incorrect hashes for window configurations and some other objects.
 
 ** The obsolete function 'thread-alive-p' has been removed.
 
+** dns-query now consistently uses Lisp integers to represent integers.
+Formerly it made an exception for integer components of SOA records,
+because SOA serial numbers can exceed fixnum ranges on 32-bit platforms.
+Emacs now supports bignums so this old glitch is no longer needed.
+
 \f
 * Lisp Changes in Emacs 28.1
 
index cefe0851f0344fef9c3d9106abba146da784966c..78d482716296a957a1ec8ab622a1bc8b1d2b1a18 100644 (file)
@@ -258,10 +258,8 @@ If TCP-P, the first two bytes of the package with be the length field."
       (nreverse spec))))
 
 (defun dns-read-int32 ()
-  ;; Full 32 bit Integers can't be handled by 32-bit Emacsen.  If we
-  ;; use floats, it works.
-  (format "%.0f" (+ (* (dns-read-bytes 1) 16777216.0)
-                   (dns-read-bytes 3))))
+  (declare (obsolete nil "28.1"))
+  (number-to-string (dns-read-bytes 4)))
 
 (defun dns-read-type (string type)
   (let ((buffer (current-buffer))
@@ -286,11 +284,11 @@ If TCP-P, the first two bytes of the package with be the length field."
            ((eq type 'SOA)
             (list (list 'mname (dns-read-name buffer))
                   (list 'rname (dns-read-name buffer))
-                  (list 'serial (dns-read-int32))
-                  (list 'refresh (dns-read-int32))
-                  (list 'retry (dns-read-int32))
-                  (list 'expire (dns-read-int32))
-                  (list 'minimum (dns-read-int32))))
+                 (list 'serial (dns-read-bytes 4))
+                 (list 'refresh (dns-read-bytes 4))
+                 (list 'retry (dns-read-bytes 4))
+                 (list 'expire (dns-read-bytes 4))
+                 (list 'minimum (dns-read-bytes 4))))
            ((eq type 'SRV)
             (list (list 'priority (dns-read-bytes 2))
                   (list 'weight (dns-read-bytes 2))