summaryrefslogtreecommitdiffstats
path: root/crypto/bio
diff options
context:
space:
mode:
authorTomas Mraz <tmraz@fedoraproject.org>2019-08-05 19:11:07 +0200
committerTomas Mraz <tmraz@fedoraproject.org>2019-08-13 11:44:15 +0200
commit63be1415bf6c3b73bb0a4971e1ffeb5923269b7c (patch)
treed7138cbf824446b25329ba65a683c860113e2b32 /crypto/bio
parente17a712e763701e05f3e6965498e2697c7d1e30e (diff)
BIO_lookup_ex: Always retry the lookup on failure with AI_NUMERICHOST set
Do not try to discern the error return value on getaddrinfo() failure but when retrying set the AI_NUMERICHOST to avoid DNS lookups. Fixes: #9053 Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9535) (cherry picked from commit 7f616a00e9232392927099dca1eca70d0d058665)
Diffstat (limited to 'crypto/bio')
-rw-r--r--crypto/bio/b_addr.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/crypto/bio/b_addr.c b/crypto/bio/b_addr.c
index 1619ab586b..10738daacb 100644
--- a/crypto/bio/b_addr.c
+++ b/crypto/bio/b_addr.c
@@ -707,20 +707,14 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
case 0:
ret = 1; /* Success */
break;
-# if (defined(EAI_FAMILY) || defined(EAI_ADDRFAMILY)) && defined(AI_ADDRCONFIG)
-# ifdef EAI_FAMILY
- case EAI_FAMILY:
-# endif
-# ifdef EAI_ADDRFAMILY
- case EAI_ADDRFAMILY:
-# endif
+ default:
+# if defined(AI_ADDRCONFIG) && defined(AI_NUMERICHOST)
if (hints.ai_flags & AI_ADDRCONFIG) {
hints.ai_flags &= ~AI_ADDRCONFIG;
+ hints.ai_flags |= AI_NUMERICHOST;
goto retry;
}
# endif
- /* fall through */
- default:
BIOerr(BIO_F_BIO_LOOKUP_EX, ERR_R_SYS_LIB);
ERR_add_error_data(1, gai_strerror(gai_ret));
break;