mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-22 04:01:57 +03:00
Backport BIND code to query name as TLD.
This commit is contained in:
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2011-05-07 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12734]
|
||||
* resolv/resolv.h: Define RES_NOTLDQUERY.
|
||||
* resolv/res_init.c (res_setoptions): Recognize no_tld_query and
|
||||
no-tld-query and set RES_NOTLDQUERY.
|
||||
* resolv/res_debug.c (p_option): Handle RES_NOTLDQUERY.
|
||||
* resolv/res_query.c (__libc_res_nsearch): Backport changes from
|
||||
modern BIND to search name as TLD unless forbidden.
|
||||
|
||||
2011-05-07 Petr Baudis <pasky@suse.cz>
|
||||
Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
|
2
NEWS
2
NEWS
@ -24,7 +24,7 @@ Version 2.14
|
||||
|
||||
11724, 12393, 12420, 12445, 12454, 12460, 12469, 12489, 12509, 12510,
|
||||
12518, 12583, 12587, 12597, 12631, 12650, 12653, 12655, 12685, 12714,
|
||||
12717, 12723
|
||||
12717, 12723, 12734
|
||||
|
||||
Version 2.13
|
||||
|
||||
|
@ -588,6 +588,7 @@ p_option(u_long option) {
|
||||
case RES_USEBSTRING: return "ip6-bytstring";
|
||||
case RES_USE_EDNS0: return "edns0";
|
||||
case RES_USE_DNSSEC: return "dnssec";
|
||||
case RES_NOTLDQUERY: return "no-tld-query";
|
||||
/* XXX nonreentrant */
|
||||
default: sprintf(nbuf, "?0x%lx?", (u_long)option);
|
||||
return (nbuf);
|
||||
|
@ -545,6 +545,11 @@ res_setoptions(res_state statp, const char *options, const char *source) {
|
||||
} else if (!strncmp(cp, "single-request",
|
||||
sizeof("single-request") - 1)) {
|
||||
statp->options |= RES_SNGLKUP;
|
||||
} else if (!strncmp(cp, "no_tld_query",
|
||||
sizeof("no_tld_query") - 1) ||
|
||||
!strncmp(cp, "no-tld-query",
|
||||
sizeof("no-tld-query") - 1)) {
|
||||
statp->options |= RES_NOTLDQUERY;
|
||||
} else {
|
||||
/* XXX - print a warning here? */
|
||||
}
|
||||
|
@ -344,6 +344,7 @@ __libc_res_nsearch(res_state statp,
|
||||
int trailing_dot, ret, saved_herrno;
|
||||
int got_nodata = 0, got_servfail = 0, root_on_list = 0;
|
||||
int tried_as_is = 0;
|
||||
int searched = 0;
|
||||
|
||||
__set_errno (0);
|
||||
RES_SET_H_ERRNO(statp, HOST_NOT_FOUND); /* True if we never query. */
|
||||
@ -406,6 +407,7 @@ __libc_res_nsearch(res_state statp,
|
||||
for (domain = (const char * const *)statp->dnsrch;
|
||||
*domain && !done;
|
||||
domain++) {
|
||||
searched = 1;
|
||||
|
||||
if (domain[0][0] == '\0' ||
|
||||
(domain[0][0] == '.' && domain[0][1] == '\0'))
|
||||
@ -477,11 +479,11 @@ __libc_res_nsearch(res_state statp,
|
||||
}
|
||||
|
||||
/*
|
||||
* If the name has any dots at all, and no earlier 'as-is' query
|
||||
* for the name, and "." is not on the search list, then try an as-is
|
||||
* query now.
|
||||
* f the query has not already been tried as is then try it
|
||||
* unless RES_NOTLDQUERY is set and there were no dots.
|
||||
*/
|
||||
if (dots && !(tried_as_is || root_on_list)) {
|
||||
if ((dots || !searched || (statp->options & RES_NOTLDQUERY) == 0)
|
||||
&& !(tried_as_is || root_on_list)) {
|
||||
ret = __libc_res_nquerydomain(statp, name, NULL, class, type,
|
||||
answer, anslen, answerp,
|
||||
answerp2, nanswerp2, resplen2);
|
||||
|
@ -219,6 +219,8 @@ struct res_sym {
|
||||
#define RES_SNGLKUPREOP 0x00400000 /* -"-, but open new socket for each
|
||||
request */
|
||||
#define RES_USE_DNSSEC 0x00800000 /* use DNSSEC using OK bit in OPT */
|
||||
#define RES_NOTLDQUERY 0x01000000 /* Do not look up unqualified name
|
||||
as a TLD. */
|
||||
|
||||
#define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)
|
||||
|
||||
|
Reference in New Issue
Block a user