summaryrefslogtreecommitdiff
path: root/lib/libc/net/gethostbydns.c
Commit message (Collapse)AuthorAgeFilesLines
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Rename dprintf into dbg_printf to avoid collision with dprintf(3)Baptiste Daroussin2016-05-101-10/+10
| | | | | | | | When dprintf(3) in 2009 was added a _WITH_DPRINTF guard has also been added. This rename is made in preparation for the removal of this guard Notes: svn path=/head/; revision=299341
* libc: do not include <sys/types.h> where <sys/param.h> was already includedAndriy Voskoboinyk2016-04-181-1/+0
| | | | | | | | | According to style(9): > normally, include <sys/types.h> OR <sys/param.h>, but not both. (<sys/param.h> already includes <sys/types.h> when LOCORE is not defined). Notes: svn path=/head/; revision=298226
* Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.Craig Rodrigues2015-09-201-5/+2
| | | | Notes: svn path=/head/; revision=288045
* Correct the return code from _dns_gethostby*() to correspondHajimu UMEMOTO2010-08-151-4/+20
| | | | | | | | | | with h_errno. Obtained from: NetBSD MFC after: 2 weeks Notes: svn path=/head/; revision=211340
* - When there is no room for returning the result, nss backendHajimu UMEMOTO2010-08-131-3/+8
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=211276
* Shutup warning for DNAME RR.Hajimu UMEMOTO2009-02-081-1/+1
| | | | | | | | | PR: bin/127591 Submitted by: "Eugene M. Kim" <20080111.freebsd.org__at__ab.ote.we.lv> MFC after: 1 week Notes: svn path=/head/; revision=188316
* Per Regents of the University of Calfornia letter, remove advertisingWarner Losh2007-01-091-4/+0
| | | | | | | | | clause. # If I've done so improperly on a file, please let me know. Notes: svn path=/head/; revision=165903
* Fix gethostbyaddr() prototype to conform to IEEE Std 1003.1:Hajimu UMEMOTO2006-05-121-4/+7
| | | | | | | | | | | | | 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> Notes: svn path=/head/; revision=158477
* - make reentrant version of netdb functions glibc style API, andHajimu UMEMOTO2006-04-151-102/+156
| | | | | | | | | | expose them to outside of libc. - make netdb functions NSS friendly. Reviewed by: arch@ and current@ (no objection) Notes: svn path=/head/; revision=157779
* Update the resolver in libc to BIND9's one.Hajimu UMEMOTO2006-03-211-57/+67
| | | | | | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=156960
* - do validation check and IPv4-mapped IPv6 address handling beforeHajimu UMEMOTO2005-04-291-35/+5
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=145687
* we cannot use inet_ntoa(3), here. so, use inet_ntop(3), instead.Hajimu UMEMOTO2005-04-291-3/+7
| | | | Notes: svn path=/head/; revision=145677
* sync _map_v4v6_host*() with bind9's. it treats align better bit.Hajimu UMEMOTO2005-04-281-2/+2
| | | | | | | Obtained from: BIND9 Notes: svn path=/head/; revision=145635
* make gethostby*() thread-safe.Hajimu UMEMOTO2005-04-281-93/+91
| | | | Notes: svn path=/head/; revision=145633
* hide implementation specific internal functions from netdb.h.Hajimu UMEMOTO2005-04-271-0/+1
| | | | | | | it is needed to make get{host,net}by*() thread-safe. Notes: svn path=/head/; revision=145602
* ensure parsing numeric address before any host query.Hajimu UMEMOTO2005-04-251-87/+0
| | | | | | | Inspired by: NetBSD Notes: svn path=/head/; revision=145512
* remove unused variable.Hajimu UMEMOTO2005-04-251-3/+1
| | | | Notes: svn path=/head/; revision=145505
* hostalias() is not thread-safe. So, introduce _res_hostalias()Hajimu UMEMOTO2005-04-151-1/+5
| | | | | | | | | and use it. Obtained from: BIND9 Notes: svn path=/head/; revision=145113
* now e.f.f.3.ip6.arpa is delegated, we no longer need to query ip6.intHajimu UMEMOTO2004-07-211-6/+0
| | | | | | | Obtained from: KAME Notes: svn path=/head/; revision=132508
* Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)Mark Murray2004-03-051-2/+2
| | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=126643
* Make the resolver(3) and many associated interfaces much more reentrant.Brian Feldman2004-02-251-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=126243
* Back out the `hiding' of strlcpy and strlcat. Several peopleJacques Vidrine2003-05-011-4/+2
| | | | | | | vocally objected to this safety belt. Notes: svn path=/head/; revision=114443
* `Hide' strlcpy and strlcat (using the namespace.h / __weak_referenceJacques Vidrine2003-04-291-2/+4
| | | | | | | | | | 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 Notes: svn path=/head/; revision=114256
* query ip6.arpa then ip6.int for IPv6 reverse lookup. follows RFC3152.Hajimu UMEMOTO2002-10-261-1/+7
| | | | | | | MFC after: 5 days Notes: svn path=/head/; revision=106000
* Allocate 64K recieve buffer for DNS responses.Hajimu UMEMOTO2002-10-031-13/+26
| | | | | | | | Though res_query.c also defines and refers MAXPACKET, it is not related to ansbuf. So, I didn't touch res_query.c. Notes: svn path=/head/; revision=104415
* Check for truncation in calls to res_send/res_query/res_search.Jacques Vidrine2002-09-151-2/+6
| | | | | | | Fail when it is detected. Notes: svn path=/head/; revision=103350
* Backout the increase of MAXPACKET from 1024 to 65536: itJacques Vidrine2002-09-151-1/+5
| | | | | | | | | broke pthreads. Reported by: mbr, tjr Notes: svn path=/head/; revision=103335
* When using res_send/res_query/res_search, the caller must eitherJacques Vidrine2002-09-131-5/+1
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=103307
* Remove two stray lines that snuck in the cvs mergeWarner Losh2002-06-261-1/+0
| | | | Notes: svn path=/head/; revision=98877
* Include more robust checking of end of buffer that more completelyWarner Losh2002-06-261-24/+15
| | | | | | | plugs the hole. Notes: svn path=/head/; revision=98865
* Fix a minor last, minute issue that came in after I committed.Warner Losh2002-06-261-1/+1
| | | | | | | Noticed by: nectar Notes: svn path=/head/; revision=98858
* Avoid remote buffer overflow on hostbuf[].Warner Losh2002-06-261-0/+1
| | | | | | | Submitted by: joost Pol <joost@pine.nl> Notes: svn path=/head/; revision=98855
* Fix the style of the SCM ID's.David E. O'Brien2002-03-221-1/+2
| | | | | | | I believe have made all of libc .c's as consistent as possible. Notes: svn path=/head/; revision=92986
* Remove __P() usage.David E. O'Brien2002-03-211-2/+2
| | | | Notes: svn path=/head/; revision=92905
* Remove 'register' keyword.David E. O'Brien2002-03-211-7/+7
| | | | Notes: svn path=/head/; revision=92889
* Mark some functions as __printflike() and/or taking const char * argumentsKris Kennaway2001-08-201-0/+4
| | | | | | | | | instead of char *. MFC after: 2 weeks Notes: svn path=/head/; revision=81975
* Add nsswitch support. By creating an /etc/nsswitch.conf file, you canJacques Vidrine2000-09-061-24/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=65532
* Fix coredump in gethostbyaddr() when the returned answer is too large toBill Fenner2000-02-161-0/+4
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=57252
* Suppress vast quantities of unneeded warnings spewed by libc's gethostbydnsRobert Watson1999-12-281-3/+4
| | | | | | | | | | on encountering a real-world SIG record during a lookup of another type. PR: bin/7352 Reviewed by: peter, eivind Notes: svn path=/head/; revision=55174
* Add unsigned char cast to is[x]digitAndrey A. Chernov1999-11-041-4/+4
| | | | Notes: svn path=/head/; revision=52863
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50476
* Update libc dns code to 4.9.7-T1B level. This involved chopping out largePeter Wemm1998-05-021-5/+42
| | | | | | | | | 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. Notes: svn path=/head/; revision=35623
* Merge in bind-4.9.6 resolver changes. Note that they resolve thePeter Wemm1997-06-271-9/+25
| | | | | | | overflow problem differently. Notes: svn path=/head/; revision=26974
* _res_close() -> res_close()Peter Wemm1997-03-121-2/+2
| | | | | | | Pointed out by: bde Notes: svn path=/head/; revision=23766
* Revert $FreeBSD$ to $Id$Peter Wemm1997-02-221-1/+1
| | | | Notes: svn path=/head/; revision=22993
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=21673
* Fix fake failures on the short names which looks like hexadecimal numbersAndrey A. Chernov1997-01-081-8/+4
| | | | | | | Submitted by: paul@vix.com Notes: svn path=/head/; revision=21433
* Disable isxdigit block until proper solution will be foundAndrey A. Chernov1997-01-051-2/+7
| | | | | | | | isxdigit(name[0]) gives false failures on short names which looks like hexadecimal digits, f.e. "fade", "babe", "d133", etc. Notes: svn path=/head/; revision=21343