History log of /freebsd-10-stable/lib/libc/net/gethostbydns.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 211340 15-Aug-2010 ume

Correct the return code from _dns_gethostby*() to correspond
with h_errno.

Obtained from: NetBSD
MFC after: 2 weeks


# 211276 13-Aug-2010 ume

- When there is no room for returning the result, nss backend
have to return ERANGE and terminate with NS_RETURN.
- When gethostbyname_r(3) and the friends end with an error,
set errno to the value nss backend returns, and return errno
value.

PR: kern/131623
MFC after: 2 weeks


# 188316 08-Feb-2009 ume

Shutup warning for DNAME RR.

PR: bin/127591
Submitted by: "Eugene M. Kim" <20080111.freebsd.org__at__ab.ote.we.lv>
MFC after: 1 week


# 165903 08-Jan-2007 imp

Per Regents of the University of Calfornia letter, remove advertising
clause.

# If I've done so improperly on a file, please let me know.


# 158477 12-May-2006 ume

Fix gethostbyaddr() prototype to conform to IEEE Std 1003.1:

http://www.opengroup.org/onlinepubs/009695399/functions/gethostbyaddr.html

gethostbyaddr_r() is changed as well.
It breaks ABI backward compatibility on 64 bit arch. So, we fix it
on 32 bit arch only for now.

Reported by: Rostislav Krasny <rosti.bsd@gmail.com>


# 157779 15-Apr-2006 ume

- make reentrant version of netdb functions glibc style API, and
expose them to outside of libc.
- make netdb functions NSS friendly.

Reviewed by: arch@ and current@ (no objection)


# 156960 21-Mar-2006 ume

Update the resolver in libc to BIND9's one.

Since, res_sendsigned(3) and the friends use MD5 functions, it is
hard to include them without having MD5 functions in libc. So,
res_sendsigned(3) is not merged into libc.

Since, res_update(3) in BIND9 is not binary compatible with our
res_update(3), res_update(3) is leaved as is, except some
necessary modifications.
The res_update(3) and the friends are not essential part of the
resolver. They are not defined in resolv.h but defined in
res_update.h separately in BIND9. Further, they are not called from
our tree. So, I hide them from our resolv.h, but leave them only
for binary backward compatibility (perhaps, no one calls them).

Since, struct __res_state_ext is not exposed in BIND9, I hide it
from our resolv.h. And, global variable _res_ext is removed. It
breaks binary backward compatibility. But, since it is not used from
outside of our libc, I think it is safe.

Reviewed by: arch@ (no objection)


# 145687 29-Apr-2005 ume

- do validation check and IPv4-mapped IPv6 address handling before
any query.
- don't query against IPv6 link-local address.
- use IN6_IS_ADDR_V4{MAPPED,COMPAT} macros.
- use memcpy() instead of bcopy().

Inspired by: NetBSD


# 145677 29-Apr-2005 ume

we cannot use inet_ntoa(3), here. so, use inet_ntop(3), instead.


# 145635 28-Apr-2005 ume

sync _map_v4v6_host*() with bind9's. it treats align better bit.

Obtained from: BIND9


# 145633 28-Apr-2005 ume

make gethostby*() thread-safe.


# 145602 27-Apr-2005 ume

hide implementation specific internal functions from netdb.h.
it is needed to make get{host,net}by*() thread-safe.


# 145512 25-Apr-2005 ume

ensure parsing numeric address before any host query.

Inspired by: NetBSD


# 145505 25-Apr-2005 ume

remove unused variable.


# 145113 15-Apr-2005 ume

hostalias() is not thread-safe. So, introduce _res_hostalias()
and use it.

Obtained from: BIND9


# 132508 21-Jul-2004 ume

now e.f.f.3.ip6.arpa is delegated, we no longer need to query ip6.int

Obtained from: KAME


# 126643 05-Mar-2004 markm

Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)
that this provokes. "Wherever possible" means "In the kernel OR NOT
C++" (implying C).

There are places where (void *) pointers are not valid, such as for
function pointers, but in the special case of (void *)0, agreement
settles on it being OK.

Most of the fixes were NULL where an integer zero was needed; many
of the fixes were NULL where ascii <nul> ('\0') was needed, and a
few were just "other".

Tested on: i386 sparc64


# 126243 25-Feb-2004 green

Make the resolver(3) and many associated interfaces much more reentrant.
The getaddrinfo(3), getipnodebyname(3) and resolver(3) can coincide now
with what should be totally reentrant, and h_errno values will now
be preserved correctly, but this does not affect interfaces such as
gethostbyname(3) which are still mostly non-reentrant.

In all of these relevant functions, the thread-safety has been pushed
down as far as it seems possible right now. This means that operations
that are selected via nsdispatch(3) (i.e. files, yp, dns) are protected
still under global locks that getaddrinfo(3) defines, but where possible
the locking is greatly reduced. The most noticeable improvement is
that multiple DNS lookups can now be run at the same time, and this
shows major improvement in performance of DNS-lookup threaded programs,
and solves the "Mozilla tab serialization" problem.

No single-threaded applications need to be recompiled. Multi-threaded
applications that reference "_res" to change resolver(3) options will
need to be recompiled, and ones which reference "h_errno" will also
if they desire the correct h_errno values. If the applications already
understood that _res and h_errno were not thread-safe and had their own
locking, they will see no performance improvement but will not
actually break in any way.

Please note that when NSS modules are used, or when nsdispatch(3)
defaults to adding any lookups of its own to the individual libc
_nsdispatch() calls, those MUST be reentrant as well.


# 114443 01-May-2003 nectar

Back out the `hiding' of strlcpy and strlcat. Several people
vocally objected to this safety belt.


# 114256 29-Apr-2003 nectar

`Hide' strlcpy and strlcat (using the namespace.h / __weak_reference
technique) so that we don't wind up calling into an application's
version if the application defines them.

Inspired by: qpopper's interfering and buggy version of strlcpy


# 106000 26-Oct-2002 ume

query ip6.arpa then ip6.int for IPv6 reverse lookup. follows RFC3152.

MFC after: 5 days


# 104415 03-Oct-2002 ume

Allocate 64K recieve buffer for DNS responses.
Though res_query.c also defines and refers MAXPACKET, it is not
related to ansbuf. So, I didn't touch res_query.c.


# 103350 15-Sep-2002 nectar

Check for truncation in calls to res_send/res_query/res_search.
Fail when it is detected.


# 103335 15-Sep-2002 nectar

Backout the increase of MAXPACKET from 1024 to 65536: it
broke pthreads.

Reported by: mbr, tjr


# 103307 13-Sep-2002 nectar

When using res_send/res_query/res_search, the caller must either
insure enough space is available for the response, or be prepared
to resize the buffer and retry as necessary.

Do the conservative thing and make sure enough space is available.

Reviewed by: silence on freebsd-audit


# 98877 26-Jun-2002 imp

Remove two stray lines that snuck in the cvs merge


# 98865 26-Jun-2002 imp

Include more robust checking of end of buffer that more completely
plugs the hole.


# 98858 26-Jun-2002 imp

Fix a minor last, minute issue that came in after I committed.

Noticed by: nectar


# 98855 26-Jun-2002 imp

Avoid remote buffer overflow on hostbuf[].

Submitted by: joost Pol <joost@pine.nl>


# 92986 22-Mar-2002 obrien

Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.


# 92905 21-Mar-2002 obrien

Remove __P() usage.


# 92889 21-Mar-2002 obrien

Remove 'register' keyword.


# 81975 20-Aug-2001 kris

Mark some functions as __printflike() and/or taking const char * arguments
instead of char *.

MFC after: 2 weeks


# 65532 06-Sep-2000 nectar

Add nsswitch support. By creating an /etc/nsswitch.conf file, you can
configure FreeBSD so that various databases such as passwd and group can be
looked up using flat files, NIS, or Hesiod.

= Hesiod has been added to libc (see hesiod(3)).

= A library routine for parsing nsswitch.conf and invoking callback
functions as specified has been added to libc (see nsdispatch(3)).

= The following C library functions have been modified to use nsdispatch:
. getgrent, getgrnam, getgrgid
. getpwent, getpwnam, getpwuid
. getusershell
. getaddrinfo
. gethostbyname, gethostbyname2, gethostbyaddr
. getnetbyname, getnetbyaddr
. getipnodebyname, getipnodebyaddr, getnodebyname, getnodebyaddr

= host.conf has been removed from src/etc. rc.network has been modified
to warn that host.conf is no longer used at boot time. In addition, if
there is a host.conf but no nsswitch.conf, the latter is created at boot
time from the former.

Obtained from: NetBSD


# 57252 16-Feb-2000 fenner

Fix coredump in gethostbyaddr() when the returned answer is too large to
fit in the static buffer. This fix causes it to look like there is no
data available, which is also wrong but is better than dumping core.

PR: bin/10344
Reviewed by: billf
Approved by: jkh


# 55174 28-Dec-1999 rwatson

Suppress vast quantities of unneeded warnings spewed by libc's gethostbydns
on encountering a real-world SIG record during a lookup of another type.

PR: bin/7352
Reviewed by: peter, eivind


# 52863 04-Nov-1999 ache

Add unsigned char cast to is[x]digit


# 50476 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 35623 02-May-1998 peter

Update libc dns code to 4.9.7-T1B level. This involved chopping out large
chunks of res_comp.c and replacing it with chunks of bind-8.1.1's resolver
code. (There are no interface changes though)
The other parts are better bounds checking related.


# 26974 27-Jun-1997 peter

Merge in bind-4.9.6 resolver changes. Note that they resolve the
overflow problem differently.


# 23766 12-Mar-1997 peter

_res_close() -> res_close()

Pointed out by: bde


# 22993 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 21433 08-Jan-1997 ache

Fix fake failures on the short names which looks like hexadecimal numbers
Submitted by: paul@vix.com


# 21343 05-Jan-1997 ache

Disable isxdigit block until proper solution will be found
isxdigit(name[0]) gives false failures on short names which looks
like hexadecimal digits, f.e. "fade", "babe", "d133", etc.


# 21057 30-Dec-1996 peter

Here goes.. Bring the 4.9.5-P1 resolver into -current. This has the
DNSSEC stuff, among other things. There are also some renamed functions,
I've left out the res_stubs.c from this commit in case cvs bombs out..


# 20953 27-Dec-1996 wpaul

Small yet significant tweaks/cleanups:

- getservent:
o put _yp_check() proto under #ifdef YP where it belongs
o local YP buffers should be YPMAXRECORD + 2 bytes long and should
be NUL terminated after copying

- gethostbynis:
o local YP buffer should be YPMAXRECORD + 2 bytes long

- getnetbynis:
o local YP buffer should be YPMAXRECORD + 2 bytes long and should
be NUL terminated after copying

- ether_addr:
o local YP buffers should be YPMAXRECORD + 2 bytes long and should
be NUL terminated after copying (in this case it's BUFSIZ + 2 bytes,
but it happens that BUFSIZ == YPMAXRECORD.

- gethostbydns:
o nuke stray 'return(NULL)' in __dns_getanswer() (harmless but looks silly)

These are 2.2 candidates. I will wait a few days to make sure these don't
break anything and then, if there are no objections, move them to the 2.2
branch.


# 20892 24-Dec-1996 wpaul

Make the __dns_getanswer() wrapper work right. For the newer versions
of BIND, we need to tweak some things to that gethostanswer() knows
whether or not we're dealing with an IPv4 or IPv6 address. (This'll
teach me to use a 2.1.0 system for NIS development -- but it's so nice
and stable I just can't being myself to upgrade it. :)


# 20817 22-Dec-1996 wpaul

Add __dns_getanswer() hook to allow access to the gethostanswer()
functions from outside libc. (Needed for async DNS resolver in ypserv.)


# 19301 01-Nov-1996 peter

Add an "officially undocumented" tweak for squid so that it can see the
TTL of DNS records that it looks up for it's resolver cache.

Obtained from: Endre Balint Nagy <bne@CareNet.hu>, via squid-1.1.x source.


# 18608 01-Oct-1996 pst

Skip results that have unexpected lengths


# 17903 29-Aug-1996 peter

Merge in bind-4.9.4-P1 resolver...


# 17141 12-Jul-1996 jkh

General -Wall warning cleanup, part I.
Submitted-By: Kent Vander Velden <graphix@iastate.edu>


# 13408 13-Jan-1996 peter

The last of the bind-4.9.3-REL resolver merges.


# 11661 22-Oct-1995 phk

As above.


# 10150 21-Aug-1995 bde

Fix bogus include paths, some of which stopped libresolv from compiling.


# 10133 20-Aug-1995 peter

Update the resolver part of libc to bind-4.9.3-beta24 level (from beta9p1)
Note that this was done by selective patching from diffs, to not conflict
with the 4.4bsd base code.. This was *not* a trivial task.. I have been
testing this code (apart from cosmetic changes) in my libc for a while now.

Obtained from: Paul Vixie <paul@vix.com>


# 8870 30-May-1995 rgrimes

Remove trailing whitespace.


# 4892 01-Dec-1994 wollman

In _gethostbydnsaddr(), force RES_RECURSE into _res.options. This is
incredibly obnoxious, but also makes inverse mappings work when the local
resolver is in a cache-only configuration. (Maybe this is actually
a bug in BIND?)


# 3094 25-Sep-1994 pst

remove need for -DDEBUG from resolver code (conflict with db/hash)


# 3070 25-Sep-1994 pst

get* rework and new bind code