This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] nss_dns: Do not replace root domain with empty string
* Carlos O'Donell:
> On 4/8/19 7:18 AM, Florian Weimer wrote:
>> The purpose of the bp[0] == '.' check is unclear. Only the root domain
>> starts with '.'. An empty string is not a valid domain name, so the
>> subsequent res_dnok check fails.
>
> Was the intent to *cause* a failure if a root domain was unpacked?
>
> Are you certain res_dnok() fails with the empty string? It looks to me
> like ns_name_pton() might work, and so would printable_string(), but
> the result is obviously garbage, and may fail later.
>
> Logically the code in question doesn't make any sense from first
> principles, therefore I think the deletion is warranted, and that
> we'll fix any fallout.
Hmm, you are right, res_dnok et al. accept it, which is something we
cannot change for backwards compatibility reasons. Odd. There is even
a test for it.
I'm going to use this as the commit message then:
nss_dns: Do not replace root domain with empty string
The purpose of the bp[0] == '.' check is unclear. Only the root domain
starts with '.'. The empty string is accepted as a domain name in many
places, denoting the root, but using it implicitly is confusing.
Still okay?
Thansk,
Florian