NO_DATA/EAI_NODATA when the hostname param is an empty string.
So far, they were using the entries in the search list with no
additional component, which is not really expected.
reported by jsing@ and a few others
ok deraadt@, "makes sense" jsing@
-/* $OpenBSD: getaddrinfo_async.c,v 1.28 2014/05/10 21:21:09 chl Exp $ */
+/* $OpenBSD: getaddrinfo_async.c,v 1.29 2014/07/23 21:26:25 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
break;
}
+ if (as->as.ai.hostname && as->as.ai.hostname[0] == '\0') {
+ ar->ar_gai_errno = EAI_NODATA;
+ async_set_state(as, ASR_STATE_HALT);
+ break;
+ }
+
ai = &as->as.ai.hints;
if (ai->ai_addrlen ||
-/* $OpenBSD: gethostnamadr_async.c,v 1.29 2014/05/13 11:57:35 eric Exp $ */
+/* $OpenBSD: gethostnamadr_async.c,v 1.30 2014/07/23 21:26:25 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
break;
}
- /* Name might be an IP address string */
if (as->as_type == ASR_GETHOSTBYNAME) {
+
+ if (as->as.hostnamadr.name[0] == '\0') {
+ ar->ar_h_errno = NO_DATA;
+ async_set_state(as, ASR_STATE_HALT);
+ break;
+ }
+
+ /* Name might be an IP address string */
for (c = as->as.hostnamadr.name; *c; c++)
if (!isdigit((unsigned char)*c) &&
*c != '.' && *c != ':')
-/* $OpenBSD: getnetnamadr_async.c,v 1.15 2014/05/13 11:57:35 eric Exp $ */
+/* $OpenBSD: getnetnamadr_async.c,v 1.16 2014/07/23 21:26:25 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
break;
}
+ if (as->as_type == ASR_GETNETBYNAME &&
+ as->as.netnamadr.name[0] == '\0') {
+ ar->ar_h_errno = NO_DATA;
+ async_set_state(as, ASR_STATE_HALT);
+ break;
+ }
+
async_set_state(as, ASR_STATE_NEXT_DB);
break;
-/* $OpenBSD: res_search_async.c,v 1.13 2014/03/26 18:13:15 eric Exp $ */
+/* $OpenBSD: res_search_async.c,v 1.14 2014/07/23 21:26:25 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
case ASR_STATE_INIT:
+ if (as->as.search.name[0] == '\0') {
+ ar->ar_h_errno = NO_DATA;
+ async_set_state(as, ASR_STATE_HALT);
+ break;
+ }
+
as->as.search.saved_h_errno = HERRNO_UNSET;
async_set_state(as, ASR_STATE_NEXT_DOMAIN);
break;