aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2020-01-15 17:53:43 -0800
committerPaul Eggert2020-01-15 17:55:15 -0800
commit125bc5b1a4cf92e251680eb92ae45a1b25aee5cf (patch)
tree967a690a92ebad3cd5c91e88d8bc1134d905038b
parent41a270d218c7038f94295dbadd8b0b60c1af0827 (diff)
downloademacs-125bc5b1a4cf92e251680eb92ae45a1b25aee5cf.tar.gz
emacs-125bc5b1a4cf92e251680eb92ae45a1b25aee5cf.zip
dns-query now represents SOA integers as integers (Bug#38937)
* lisp/net/dns.el (dns-read-int32): Declare obsolete. Assume bignums. (dns-read-type): Represent SOA integers as integers, not strings.
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/net/dns.el16
2 files changed, 12 insertions, 9 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 3d5915a3774..7ea4bba9cd1 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -58,6 +58,11 @@ incorrect hashes for window configurations and some other objects.
58 58
59** The obsolete function 'thread-alive-p' has been removed. 59** The obsolete function 'thread-alive-p' has been removed.
60 60
61** dns-query now consistently uses Lisp integers to represent integers.
62Formerly it made an exception for integer components of SOA records,
63because SOA serial numbers can exceed fixnum ranges on 32-bit platforms.
64Emacs now supports bignums so this old glitch is no longer needed.
65
61 66
62* Lisp Changes in Emacs 28.1 67* Lisp Changes in Emacs 28.1
63 68
diff --git a/lisp/net/dns.el b/lisp/net/dns.el
index cefe0851f03..78d48271629 100644
--- a/lisp/net/dns.el
+++ b/lisp/net/dns.el
@@ -258,10 +258,8 @@ If TCP-P, the first two bytes of the package with be the length field."
258 (nreverse spec)))) 258 (nreverse spec))))
259 259
260(defun dns-read-int32 () 260(defun dns-read-int32 ()
261 ;; Full 32 bit Integers can't be handled by 32-bit Emacsen. If we 261 (declare (obsolete nil "28.1"))
262 ;; use floats, it works. 262 (number-to-string (dns-read-bytes 4)))
263 (format "%.0f" (+ (* (dns-read-bytes 1) 16777216.0)
264 (dns-read-bytes 3))))
265 263
266(defun dns-read-type (string type) 264(defun dns-read-type (string type)
267 (let ((buffer (current-buffer)) 265 (let ((buffer (current-buffer))
@@ -286,11 +284,11 @@ If TCP-P, the first two bytes of the package with be the length field."
286 ((eq type 'SOA) 284 ((eq type 'SOA)
287 (list (list 'mname (dns-read-name buffer)) 285 (list (list 'mname (dns-read-name buffer))
288 (list 'rname (dns-read-name buffer)) 286 (list 'rname (dns-read-name buffer))
289 (list 'serial (dns-read-int32)) 287 (list 'serial (dns-read-bytes 4))
290 (list 'refresh (dns-read-int32)) 288 (list 'refresh (dns-read-bytes 4))
291 (list 'retry (dns-read-int32)) 289 (list 'retry (dns-read-bytes 4))
292 (list 'expire (dns-read-int32)) 290 (list 'expire (dns-read-bytes 4))
293 (list 'minimum (dns-read-int32)))) 291 (list 'minimum (dns-read-bytes 4))))
294 ((eq type 'SRV) 292 ((eq type 'SRV)
295 (list (list 'priority (dns-read-bytes 2)) 293 (list (list 'priority (dns-read-bytes 2))
296 (list 'weight (dns-read-bytes 2)) 294 (list 'weight (dns-read-bytes 2))