diff options
author | 2002-07-24 01:38:34 +0000 | |
---|---|---|
committer | 2002-07-24 01:38:34 +0000 | |
commit | 6108e7a6df3a6c5fe645a27a92436f127e4dbb40 (patch) | |
tree | 067f552da7c0a5ea928293f7218ba815b283f21d /lib/libc | |
parent | limit user code up to below the user stack, making stack addresses, effectively, unexecutable. signal trampoline is mapped elesewhere now, 10x to art@ (diff) | |
download | wireguard-openbsd-6108e7a6df3a6c5fe645a27a92436f127e4dbb40.tar.xz wireguard-openbsd-6108e7a6df3a6c5fe645a27a92436f127e4dbb40.zip |
have _THREAD_PRIVATE_MUTEX for DNS/YP/hosts lookup.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/getaddrinfo.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index 4b02f8f1061..364bffedebd 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getaddrinfo.c,v 1.39 2002/07/01 21:57:35 itojun Exp $ */ +/* $OpenBSD: getaddrinfo.c,v 1.40 2002/07/24 01:38:34 itojun Exp $ */ /* $KAME: getaddrinfo.c,v 1.31 2000/08/31 17:36:43 itojun Exp $ */ /* @@ -108,6 +108,8 @@ #include "ypinternal.h" #endif +#include "thread_private.h" + #define SUCCESS 0 #define ANY 0 #define YES 1 @@ -500,6 +502,9 @@ getaddrinfo(hostname, servname, hints, res) /* * FQDN hostname, DNS lookup */ + +_THREAD_PRIVATE_MUTEX(getaddrinfo_explore_fqdn); + static int explore_fqdn(pai, hostname, servname, res) const struct addrinfo *pai; @@ -513,6 +518,8 @@ explore_fqdn(pai, hostname, servname, res) char lookups[MAXDNSLUS]; int i; + _THREAD_PRIVATE_MUTEX_LOCK(getaddrinfo_explore_fqdn); + result = NULL; #if 0 @@ -521,15 +528,19 @@ explore_fqdn(pai, hostname, servname, res) * return the address family or not. * XXX does not handle PF_UNSPEC case, should filter final result */ - if ((pai->ai_flags & AI_ADDRCONFIG) != 0 && !addrconfig(pai)) + if ((pai->ai_flags & AI_ADDRCONFIG) != 0 && !addrconfig(pai)) { + _THREAD_PRIVATE_MUTEX_UNLOCK(getaddrinfo_explore_fqdn); return 0; + } #endif /* * if the servname does not match socktype/protocol, ignore it. */ - if (get_portmatch(pai, servname) != 0) + if (get_portmatch(pai, servname) != 0) { + _THREAD_PRIVATE_MUTEX_UNLOCK(getaddrinfo_explore_fqdn); return 0; + } if ((_res.options & RES_INIT) == 0 && res_init() == -1) strncpy(lookups, "f", sizeof lookups); @@ -560,6 +571,7 @@ explore_fqdn(pai, hostname, servname, res) /* canonname should be filled already */ } *res = result; + _THREAD_PRIVATE_MUTEX_UNLOCK(getaddrinfo_explore_fqdn); return 0; } else { /* translate error code */ @@ -591,6 +603,7 @@ explore_fqdn(pai, hostname, servname, res) free: if (result) freeaddrinfo(result); + _THREAD_PRIVATE_MUTEX_UNLOCK(getaddrinfo_explore_fqdn); return error; } |