summaryrefslogtreecommitdiff
path: root/lib/libc/asr
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-07 13:59:35 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-07 13:59:35 +0000
commitd60e1b26de1c07272bd535bdf79416f6a956fdb4 (patch)
tree574c5fa32ad4c58d8654312392148885203fd61d /lib/libc/asr
parent2414e837a832679bd052989e5d2b2424ad708a61 (diff)
getaddrinfo_async() shouldn't unconditionally intialize the resolver
via _asr_use_resolver(). If the hint specifies for AI_NUMERICHOST, create a transient lookup context which won't try to open /etc/reslov.conf ok eric guenther
Diffstat (limited to 'lib/libc/asr')
-rw-r--r--lib/libc/asr/asr.c8
-rw-r--r--lib/libc/asr/asr_private.h3
-rw-r--r--lib/libc/asr/getaddrinfo_async.c7
3 files changed, 14 insertions, 4 deletions
diff --git a/lib/libc/asr/asr.c b/lib/libc/asr/asr.c
index 1f6429f5109..7c13122a8cb 100644
--- a/lib/libc/asr/asr.c
+++ b/lib/libc/asr/asr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asr.c,v 1.45 2015/10/03 22:35:30 deraadt Exp $ */
+/* $OpenBSD: asr.c,v 1.46 2015/10/07 13:59:34 deraadt Exp $ */
/*
* Copyright (c) 2010-2012 Eric Faurot <eric@openbsd.org>
*
@@ -489,6 +489,12 @@ asr_ctx_create(void)
return (ac);
}
+struct asr_ctx *
+_asr_no_resolver(void)
+{
+ return asr_ctx_create();
+}
+
/*
* Add a search domain to the async context.
*/
diff --git a/lib/libc/asr/asr_private.h b/lib/libc/asr/asr_private.h
index 82ad6dc46d7..cef9cae373e 100644
--- a/lib/libc/asr/asr_private.h
+++ b/lib/libc/asr/asr_private.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: asr_private.h,v 1.34 2015/10/03 22:35:30 deraadt Exp $ */
+/* $OpenBSD: asr_private.h,v 1.35 2015/10/07 13:59:34 deraadt Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -315,6 +315,7 @@ ssize_t _asr_addr_as_fqdn(const char *, int, char *, size_t);
static void *_asr_resolver(void);
void _asr_resolver_done(void *);
struct asr_ctx *_asr_use_resolver(void *);
+struct asr_ctx *_asr_no_resolver(void);
void _asr_ctx_unref(struct asr_ctx *);
struct asr_query *_asr_async_new(struct asr_ctx *, int);
void _asr_async_free(struct asr_query *);
diff --git a/lib/libc/asr/getaddrinfo_async.c b/lib/libc/asr/getaddrinfo_async.c
index d3e7c569d14..4362da51514 100644
--- a/lib/libc/asr/getaddrinfo_async.c
+++ b/lib/libc/asr/getaddrinfo_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getaddrinfo_async.c,v 1.45 2015/09/20 14:19:21 eric Exp $ */
+/* $OpenBSD: getaddrinfo_async.c,v 1.46 2015/10/07 13:59:34 deraadt Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -88,7 +88,10 @@ getaddrinfo_async(const char *hostname, const char *servname,
struct asr_query *as;
char alias[MAXDNAME];
- ac = _asr_use_resolver(asr);
+ if ((hints->ai_flags & AI_NUMERICHOST) == 0)
+ ac = _asr_use_resolver(asr);
+ else
+ ac = _asr_no_resolver();
if ((as = _asr_async_new(ac, ASR_GETADDRINFO)) == NULL)
goto abort; /* errno set */
as->as_run = getaddrinfo_async_run;