From 9f1fdbf5dd633f81352fac0d6bc0d0c4d45be459 Mon Sep 17 00:00:00 2001 From: Brad House Date: Thu, 2 May 2019 09:14:01 -0400 Subject: [PATCH] Fix c89 compilation support broken by .onion rejection changes Move .onion check lower after all variables have been declared. Bug: #246 --- ares_gethostbyname.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ares_gethostbyname.c b/ares_gethostbyname.c index 8187746b..938f489c 100644 --- a/ares_gethostbyname.c +++ b/ares_gethostbyname.c @@ -346,10 +346,6 @@ static int file_lookup(const char *name, int family, struct hostent **host) int status; int error; - /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */ - if (ares__is_onion_domain(name)) - return ARES_ENOTFOUND; - #ifdef WIN32 char PATH_HOSTS[MAX_PATH]; win_platform platform; @@ -387,6 +383,11 @@ static int file_lookup(const char *name, int family, struct hostent **host) return ARES_ENOTFOUND; #endif + /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */ + if (ares__is_onion_domain(name)) + return ARES_ENOTFOUND; + + fp = fopen(PATH_HOSTS, "r"); if (!fp) {