mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-18 06:30:05 +00:00
BZ#16469: resolv: skip leading dot in domain to search
This should only happen if the domain to search is the root, represented as "." rather than by an empty string. Skipping it here prevents libc_res_nquerydomain from duplicating the trailing dot, which would cause the domain name compression to fail. for ChangeLog [BZ #16469] * resolv/res_query.c (__libc_res_nsearch): Skip leading dot in search domain names.
This commit is contained in:
parent
f3d945d5f2
commit
b59d114bd1
@ -1,3 +1,9 @@
|
|||||||
|
2014-11-21 Alexandre Oliva <aoliva@redhat.com>
|
||||||
|
|
||||||
|
[BZ #16469]
|
||||||
|
* resolv/res_query.c (__libc_res_nsearch): Skip leading dot in
|
||||||
|
search domain names.
|
||||||
|
|
||||||
2014-11-21 Alexandre Oliva <aoliva@redhat.com>
|
2014-11-21 Alexandre Oliva <aoliva@redhat.com>
|
||||||
|
|
||||||
[BZ #16469]
|
[BZ #16469]
|
||||||
|
@ -413,13 +413,24 @@ __libc_res_nsearch(res_state statp,
|
|||||||
for (domain = (const char * const *)statp->dnsrch;
|
for (domain = (const char * const *)statp->dnsrch;
|
||||||
*domain && !done;
|
*domain && !done;
|
||||||
domain++) {
|
domain++) {
|
||||||
|
const char *dname = domain[0];
|
||||||
searched = 1;
|
searched = 1;
|
||||||
|
|
||||||
if (domain[0][0] == '\0' ||
|
/* __libc_res_nquerydoman concatenates name
|
||||||
(domain[0][0] == '.' && domain[0][1] == '\0'))
|
with dname with a "." in between. If we
|
||||||
|
pass it in dname the "." we got from the
|
||||||
|
configured default search path, we'll end
|
||||||
|
up with "name..", which won't resolve.
|
||||||
|
OTOH, passing it "" will result in "name.",
|
||||||
|
which has the intended effect for both
|
||||||
|
possible representations of the root
|
||||||
|
domain. */
|
||||||
|
if (dname[0] == '.')
|
||||||
|
dname++;
|
||||||
|
if (dname[0] == '\0')
|
||||||
root_on_list++;
|
root_on_list++;
|
||||||
|
|
||||||
ret = __libc_res_nquerydomain(statp, name, *domain,
|
ret = __libc_res_nquerydomain(statp, name, dname,
|
||||||
class, type,
|
class, type,
|
||||||
answer, anslen, answerp,
|
answer, anslen, answerp,
|
||||||
answerp2, nanswerp2,
|
answerp2, nanswerp2,
|
||||||
|
Loading…
Reference in New Issue
Block a user