#
d1f9129b |
| 21-Aug-2024 |
florian <florian@openbsd.org> |
Make sure ai_canonname is set when AI_CANONNAME was requested.
We document, and posix requires, to return a NUL-terminated string on a successful call to getaddrinfo(3) when AI_CANONNAME was set.
Make sure ai_canonname is set when AI_CANONNAME was requested.
We document, and posix requires, to return a NUL-terminated string on a successful call to getaddrinfo(3) when AI_CANONNAME was set.
If the canonical name cannot be determined, return the node name as suggested by posix.
OK guenther
show more ...
|
#
ab51fa82 |
| 15-Jan-2024 |
florian <florian@openbsd.org> |
Make sure to return a proper string in ai_canonname.
When we made sure that getaddrinfo(3) always resolves "localhost" to the loopback address we forgot to set ai_canonname if AI_CANONNAME or AI_FQD
Make sure to return a proper string in ai_canonname.
When we made sure that getaddrinfo(3) always resolves "localhost" to the loopback address we forgot to set ai_canonname if AI_CANONNAME or AI_FQDN is set. On a successful call ai_canonname has to be a NUL-terminated string if either of those flags are set.
Problem observed by a@alexis-fouilhe.fr in smtpd(8) with a hostname of "localhost".
OK millert
show more ...
|
#
fada2b0b |
| 21-Nov-2023 |
florian <florian@openbsd.org> |
Do not short-circuit localhost resolution when AI_NUMERICHOST is set.
localhost is not a valid IP address and so getaddrinfo(3) has to fail. Found by anton in pfctl & ipsecctl regress.
OK anton
|
#
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 ...
|
#
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 ...
|
#
52b8ecd4 |
| 26-Jan-2021 |
florian <florian@openbsd.org> |
When checking for available address family for AI_ADDRCONFIG consider the routing domain we are currently in. Otherwise we might end up with address families that are not available in the current rdo
When checking for available address family for AI_ADDRCONFIG consider the routing domain we are currently in. Otherwise we might end up with address families that are not available in the current rdomain but in others since getifaddrs(3) gives us all interface addresses in the system. Clue-bat & OK claudio, input & OK eric, OK kn
show more ...
|
#
172d89a7 |
| 03-Nov-2018 |
eric <eric@openbsd.org> |
For correctness, do not read struct servent if getservbyname_r() failed. Also simplify code.
|
#
c43131ad |
| 22-Oct-2018 |
krw <krw@openbsd.org> |
More "explicitely" -> "explicitly" in various comments.
ok guenther@ tb@ deraadt@
|
#
abe78e02 |
| 27-Feb-2017 |
jca <jca@openbsd.org> |
Put a common flags field in the query struct, rather than in some elements of the union.
This field is for internal asr flags. The flags in "struct rrset" and "struct ni" are different kinds of fla
Put a common flags field in the query struct, rather than in some elements of the union.
This field is for internal asr flags. The flags in "struct rrset" and "struct ni" are different kinds of flags.
ok eric@
show more ...
|
#
f6f51dad |
| 23-Feb-2017 |
eric <eric@openbsd.org> |
Put a common subq pointer in the query struct, rather than one in each element of the union.
ok gilles@ millert@ krw@
|
#
6c455d5c |
| 21-Feb-2017 |
eric <eric@openbsd.org> |
missing breaks
ok jca@ krw@ gilles@
|
#
cbd3ae78 |
| 21-Feb-2017 |
eric <eric@openbsd.org> |
Report the errno set by getifaddrs(3) if the setup for AI_ADDRCONFIG fails, rather than a non-informative EAI_FAIL. Compare to -1 for error detection while here.
ok jca@ gilles@
|
#
c126605f |
| 16-Dec-2015 |
deraadt <deraadt@openbsd.org> |
Remove support for HOSTALIASES from the resolver. This "open and parse any file indicated by an environment variable" feature inside the resolver is incompatible with what pledge "dns" is trying to
Remove support for HOSTALIASES from the resolver. This "open and parse any file indicated by an environment variable" feature inside the resolver is incompatible with what pledge "dns" is trying to be. It is a misguided "feature" added way back in history which almost noone uses, but everyone has to assume the risk from. ok eric florian kettenis
show more ...
|
#
59f710d8 |
| 23-Nov-2015 |
deraadt <deraadt@openbsd.org> |
Remove support for "lookup yp" in /etc/resolv.conf. This historical wart is incompatible with pledge, because suddenly a "dns" operation needs "getpw" access to ypbind/ypserv, etc. file + dns acces
Remove support for "lookup yp" in /etc/resolv.conf. This historical wart is incompatible with pledge, because suddenly a "dns" operation needs "getpw" access to ypbind/ypserv, etc. file + dns access is enough for everyone, sorry if you were using that old SunOS 4.x style mechanism, but it is now gone. ok semarie millert florian
show more ...
|
#
9936a0e9 |
| 08-Oct-2015 |
eric <eric@openbsd.org> |
fix conditionals
ok deraadt@
|
#
136d56f7 |
| 08-Oct-2015 |
deraadt <deraadt@openbsd.org> |
Handle case where no hint is passed in. Found as a crash of fdm by jturner@
|
#
656b8d51 |
| 07-Oct-2015 |
deraadt <deraadt@openbsd.org> |
getaddrinfo_async() shouldn't unconditionally intialize the resolver via _asr_use_resolver(). If the hint specifies for AI_NUMERICHOST, create a transient lookup context which won't try to open /etc
getaddrinfo_async() shouldn't unconditionally intialize the resolver via _asr_use_resolver(). If the hint specifies for AI_NUMERICHOST, create a transient lookup context which won't try to open /etc/reslov.conf ok eric guenther
show more ...
|
#
a55a423a |
| 20-Sep-2015 |
eric <eric@openbsd.org> |
remove bogus includes of err.h
|
#
38ec4720 |
| 20-Sep-2015 |
eric <eric@openbsd.org> |
remove unused static function
|
#
5826fd8c |
| 14-Sep-2015 |
guenther <guenther@openbsd.org> |
Wrap <asr.h> so internal calls go direct and all the symbols are weak
|
#
253ef892 |
| 09-Sep-2015 |
deraadt <deraadt@openbsd.org> |
Hide all unnecessary asr / resolver related API with _ prefixes. direction & ok guenther
|
#
873f6271 |
| 16-Aug-2015 |
jca <jca@openbsd.org> |
Fix test against INADDR_LOOPBACK
ok gilles@
|
#
f108579b |
| 29-May-2015 |
eric <eric@openbsd.org> |
fix a possible off-by-one when reading /etc/hosts if it doesn't end with a newline.
ok jca@
|
#
d2d7f9c9 |
| 26-May-2015 |
eric <eric@openbsd.org> |
simply use _PATH_HOSTS where appropriate
|