1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

resolv: Lift domain search list limits [BZ #19569] [BZ #21475]

This change uses the extended resolver state in struct resolv_conf to
store the search list.  If applications have not patched the _res
object directly, this extended search list will be used by the stub
resolver during name resolution.
This commit is contained in:
Florian Weimer
2017-07-01 00:53:05 +02:00
parent f30a54b21b
commit 3f853f22c8
8 changed files with 382 additions and 81 deletions

View File

@@ -93,6 +93,25 @@ struct resolv_context *__resolv_context_get_override (struct __res_state *)
__attribute__ ((nonnull (1), warn_unused_result));
libc_hidden_proto (__resolv_context_get_override)
/* Return the search path entry at INDEX, or NULL if there are fewer
than INDEX entries. */
static __attribute__ ((nonnull (1), unused)) const char *
__resolv_context_search_list (const struct resolv_context *ctx, size_t index)
{
if (ctx->conf != NULL)
{
if (index < ctx->conf->search_list_size)
return ctx->conf->search_list[index];
else
return NULL;
}
/* Fallback. ctx->resp->dnsrch is a NULL-terminated array. */
for (size_t i = 0; ctx->resp->dnsrch[i] != NULL && i < MAXDNSRCH; ++i)
if (i == index)
return ctx->resp->dnsrch[i];
return NULL;
}
/* Called during thread shutdown to free the associated resolver
context (mostly in response to cancellation, otherwise the
__resolv_context_get/__resolv_context_put pairing will already have