History log of /openbsd/lib/libc/asr/asr_utils.c (Results 1 – 22 of 22)
Revision Date Author Comments
# 373da8ab 20-Nov-2023 florian <florian@openbsd.org>

localhost is either 127.0.0.1 or ::1, nothing else.

RFC 6761, 6.3 Domain Name Reservation Considerations for "localhost.":
3. Name resolution APIs and libraries SHOULD recognize localhost

localhost is either 127.0.0.1 or ::1, nothing else.

RFC 6761, 6.3 Domain Name Reservation Considerations for "localhost.":
3. Name resolution APIs and libraries SHOULD recognize localhost
names as special and SHOULD always return the IP loopback address
for address queries and negative responses for all other query
types. Name resolution APIs SHOULD NOT send queries for
localhost names to their configured caching DNS server(s).

This makes sure that the getaddrinfo(3) and gethostbyname(3) family of
functions always return the loopback address and do not send queries
to name servers. This includes "localhost", "localhost." and
everything under ".localhost" and ".localhost.".

For example, a host underneath the .com.ar zone will per default have
a search list of "com.ar.". resolv.conf(5) has a default of "lookup
bind file". Both combined will result in lookups for "localhost" to
not return 127.0.0.1 because localhost.com.ar is registered in DNS.

It has been known for decades that this is a problem, especially for
localhost.

Problem recently spotted by gonzalo@ and debugged by sthen@

Testing sthen, gonzalo
Input & OK phessler, eric, millert
OK sthen, kn, deraadt

show more ...


# 43f5d167 15-Mar-2023 millert <millert@openbsd.org>

Fix a number of out of bound reads in DNS response parsing.
Originally from djm@. OK deraadt@ florian@ bluhm@


# 2c53affb 27-Dec-2022 jmc <jmc@openbsd.org>

spelling fixes; from paul tagliamonte
any changes not taken noted on tech, but chiefly here i did not take the
cancelation - cancellation changes;


# 1b04c78c 17-Nov-2022 florian <florian@openbsd.org>

Restrict what getaddrinfo(3) is willing to try to resolve.

Programs assume that a successful call to getaddrinfo(3) validates the
input as "safe", but that's not true. Characters like '$', '`', '\n'

Restrict what getaddrinfo(3) is willing to try to resolve.

Programs assume that a successful call to getaddrinfo(3) validates the
input as "safe", but that's not true. Characters like '$', '`', '\n'
or '*' can traverse the DNS without problems, but have special
meaning, for example a shell.

There is a function res_hnok() already in libc, but it validates if a
string is a host name, which is too strict in practice. For example
foo-.example.com is not a valid host name, but is used on the
Internet.

Posix has this to say:
"The getaddrinfo() function shall translate the name of a service
location (for example, a host name)"

It hints that the input should be a host name, but it does not
restrict it to it.

This introduces a function hnok_lenient() which restricts the input to
getaddrinfo(3) to the set [A-z0-9-_.]. Additionally two consecutive
dots ('.') are not allowed nor can the string start with - or '.'.

glibc introduced a similar restriction years ago, so this should not
cause problems.

It has been known in the DNS community for years, probably decades
that getaddrinfo(3) is too lenient what it accepts, but it has always
been kicked down the road as "not a DNS problem". Unfortunately this
information never made it out of the DNS community and no coordinated
effort happened to have this addressed in operating systems.

David Leadbeater recently demonstrated how ssh(1) and ftp(1) are too
trusting with what getaddrinfo(3) accepts. Both have been fixed
independently of this.

Input deraadt, eric
OK millert, deraadt

show more ...


# 4b44b1f4 23-Sep-2017 jca <jca@openbsd.org>

Kill unused function

Spotted by krw@


# d4d39a6f 27-Feb-2017 jca <jca@openbsd.org>

Add support for RES_USE_DNSSEC

RES_USE_DNSSEC is implemented by setting the DNSSEC DO bit in outgoing
queries. The resolver is then supposed to set the AD bit in the reply
if it managed to validate

Add support for RES_USE_DNSSEC

RES_USE_DNSSEC is implemented by setting the DNSSEC DO bit in outgoing
queries. The resolver is then supposed to set the AD bit in the reply
if it managed to validate the answer through DNSSEC. Useful when the
application doesn't implement validation internally. This scheme
assumes that the validating resolver is trusted and that the
communication channel between the validating resolver and and the client
is secure.

ok eric@ gilles@

show more ...


# c6fa5c87 19-Feb-2017 jca <jca@openbsd.org>

Use T_OPT instead of literal "41".

Requested earlier by eric@


# 2aa4cd21 18-Feb-2017 jca <jca@openbsd.org>

Add EDNS0 support.

EDNS allows for various DNS extensions, among which UDP DNS packets size
bigger than 512 bytes. The default is still to not advertize anything.

ok eric@


# 92f75510 17-Feb-2017 eric <eric@openbsd.org>

use common errnos instead of random strings as error indicators in
pack/unpack contexts.

ok krw@ deraadt@


# 253ef892 09-Sep-2015 deraadt <deraadt@openbsd.org>

Hide all unnecessary asr / resolver related API with _ prefixes.
direction & ok guenther


# d216d6b1 26-Mar-2014 eric <eric@openbsd.org>

Make the asr API public. Install asr.h to /usr/include.h and manpages.
Include tweaks suggested by mpi@

ok deraadt@


# f90bf415 14-Mar-2014 eric <eric@openbsd.org>

prefix structure names to avoid ambiguity and possible collisions when
the API gets public.

ok deraadt@


# 01b887f7 26-Feb-2014 eric <eric@openbsd.org>

Do not restrict chars in dname during label expansion, but validate resulting
hostnames before returning them to the caller.

ok deraadt@


# dfe5467e 24-Nov-2013 deraadt <deraadt@openbsd.org>

most obvious unsigned char casts for ctype
ok jca krw ingo


# 5bd9e5c2 12-Jul-2013 eric <eric@openbsd.org>

Make some symbols static and prefix all visible symbols with asr_
to prevent collisions with third-party programs.

suggested by sthen@, ok theo@


# 770edc8b 14-Apr-2013 deraadt <deraadt@openbsd.org>

spacing


# 6f68500a 02-Apr-2013 eric <eric@openbsd.org>

make sure we always point before the current offset.

spotted by matthew@


# 43f9b988 01-Apr-2013 deraadt <deraadt@openbsd.org>

space cleanup; ok eric


# c4cedade 29-Mar-2013 eric <eric@openbsd.org>

properly handle scope when parsing IPv6 addresses.

ok bluhm@ naddy@ sthen@


# 80f48568 24-Nov-2012 eric <eric@openbsd.org>

knf


# 975956b6 24-Nov-2012 eric <eric@openbsd.org>

make separate structures for pack and unpack


# b44da627 14-Apr-2012 eric <eric@openbsd.org>

Import asr, an experimental async resolver implementation.
The idea is to eventually replace the existing resolver with
something better. Time to start working on it in tree.

ok deraadt@