commit 7501e3f1c36404940199ac41b515ec81e1f43fc7 Author: Yawning Angel yawning@schwanenlied.me Date: Sun Mar 29 17:47:03 2015 +0000
Fix getaddrinfo() to respect AI_NUMERICHOST.
Signed-off-by: Yawning Angel yawning@schwanenlied.me --- src/lib/getaddrinfo.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/src/lib/getaddrinfo.c b/src/lib/getaddrinfo.c index 378f87f..0f7fd4f 100644 --- a/src/lib/getaddrinfo.c +++ b/src/lib/getaddrinfo.c @@ -89,6 +89,12 @@ LIBC_GETADDRINFO_RET_TYPE tsocks_getaddrinfo(LIBC_GETADDRINFO_SIG)
ret = inet_pton(af, node, addr); if (ret == 0) { + /* If AI_NUMERICHOST is set, return a error. */ + if (hints->ai_flags & AI_NUMERICHOST) { + ret = EAI_NONAME; + goto error; + } + /* The node most probably is a DNS name. */ ret = tsocks_tor_resolve(af, node, addr); if (ret < 0) {