[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] netsec 742c234 4/4: Don't check unibyte hostnames for pure
From: |
Robert Pluim |
Subject: |
[Emacs-diffs] netsec 742c234 4/4: Don't check unibyte hostnames for pure-ASCII |
Date: |
Tue, 17 Jul 2018 14:05:26 -0400 (EDT) |
branch: netsec
commit 742c2344bf076040f9c57f37b2220410f9e27304
Author: Robert Pluim <address@hidden>
Commit: Robert Pluim <address@hidden>
Don't check unibyte hostnames for pure-ASCII
* src/process.c (network_lookup_address_info_1): Only check multibyte
hostnames for pure-ASCII.
* test/src/process-tests.el (unibyte-domain-name): Test unibyte domain
names with network-lookup-address-info.
---
src/process.c | 2 +-
test/src/process-tests.el | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/process.c b/src/process.c
index 25f02af..42909c4 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4537,7 +4537,7 @@ network_lookup_address_info_1 (Lisp_Object host, const
char *service,
Lisp_Object msg = Qt;
int ret;
- if (SBYTES (host) != SCHARS (host))
+ if (STRING_MULTIBYTE (host) && SBYTES (host) != SCHARS (host))
error ("Non-ASCII hostname %s detected, please use puny-encode-domain",
SSDATA (host));
ret = getaddrinfo (SSDATA (host), service, hints, res);
diff --git a/test/src/process-tests.el b/test/src/process-tests.el
index 2cc646e..ff7404f 100644
--- a/test/src/process-tests.el
+++ b/test/src/process-tests.el
@@ -227,6 +227,10 @@
(should-error (network-lookup-address-info "faß.de"))
(should (length (network-lookup-address-info (puny-encode-domain
"faß.de")))))
+(ert-deftest unibyte-domain-name ()
+ "Unibyte domain names should work"
+ (should (length (network-lookup-address-info (string-to-unibyte
"google.com")))))
+
(ert-deftest lookup-google ()
"Check that we can look up google IP addresses"
(let ((addresses-both (network-lookup-address-info "google.com"))