Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 24 Aug 2020 12:43:26 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Incompatible behaviour of res_query(3) w.r.t. NXDOMAIN

On Mon, Aug 24, 2020 at 12:16:47PM -0400, Rich Felker wrote:
> On Sun, Aug 23, 2020 at 11:31:32PM +0200, Daniel Neri wrote:
> >   Hello,
> > 
> > 
> > Musl’s res_query(3) returns success for a query that results in an
> > NXDOMAIN response, which disagrees with other common
> > implementations.
> > 
> > Simple test case: https://t.rb67.eu/res_query.c
> > 
> > On Debian Linux, OpenBSD and FreeBSD this program prints:
> > 
> >   error: Unknown host
> > 
> > but on Alpine Linux edge (musl v1.2.1):
> > 
> >   success (size 91)
> 
> I think there's a good argument that this should be changed, but that
> would require making res_* set h_errno, which would require making
> h_errno thread-local -- which it probably should have been all along,
> but the standard interfaces that used it, gethostby* etc., were
> non-thread-safe anyway and thus it seemed unnecessary.
> 
> FWIW I think the musl behavior is *better* here (more informative to
> the application), but usually it's preferable not to break the
> existing (even if informal) contracts of the interfaces being
> implemented than to be "better".

Hmm, I think in this case the "better" might be sufficient that we
want to keep it and pressure other implementations to change too. A
program performing a lookup where the result is NxDomain may very well
want to know whether that's an authenticated (by DNSSEC) NxDomain or
one in an insecure zone. Returning an error to the caller with no
packet contents discards this critical data.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.