about summary refs log tree commit diff
path: root/src/network/getnameinfo.c
Commit message (Collapse)AuthorAgeFilesLines
* fix potential read past end of buffer in getnameinfo service name lookupRich Felker2014-09-051-1/+1
| | | | | | | | | if the loop stopped due to reaching the end of the string, the subsequent increment could possibly move the position one past the end of the buffer. no further writes happen, the reads cannot fault anyway unless the stack completely lacks any zero bytes, and reading junk should not yield an incorrect result from the function either. nonetheless the code was wrong and needs to be fixed.
* remove an extra layer of buffer copying in getnameinfo reverse dnsRich Felker2014-09-051-3/+2
| | | | | | | | | | | the outer getnameinfo function already has a properly-sized temporary buffer for storing the reverse dns (ptr) result. there is no reason for the callback to use a secondary buffer and copy it on success, and doing so potentially expanded the impact of the dn_expand bug that was fixed in commit 49d2c8c6bcf8c926e52c7f510033b6adc31355f5. this change reduces the code size by a small amount, and also reduces the run-time stack space requirements by about 256 bytes.
* add support for reverse port lookups from services file to getnameinfoRich Felker2014-06-041-4/+35
| | | | | this also affects the legacy getservbyport family, which uses getnameinfo as its backend.
* add support for reverse name lookups from hosts file to getnameinfoRich Felker2014-06-041-5/+53
| | | | | | | | | | | this also affects the legacy gethostbyaddr family, which uses getnameinfo as its backend. some other minor changes associated with the refactoring of source files are also made; in particular, the resolv.conf parser now uses the same code that's used elsewhere to handle ip literals, so as a side effect it can now accept a scope id for nameserver addressed with link-local scope.
* add support for ipv6 scope_id to getaddrinfo and getnameinfoRich Felker2014-06-041-4/+28
| | | | | | | | | | | | | | | | | | | | for all address types, a scope_id specified as a decimal value is accepted. for addresses with link-local scope, a string containing the interface name is also accepted. some changes are made to error handling to avoid unwanted fallbacks in the case where the scope_id is invalid: if an earlier name lookup backend fails with an error rather than simply "0 results", this failure now suppresses any later attempts with other backends. in getnameinfo, a light "itoa" type function is added for generating decimal scope_id results, and decimal port strings for services are also generated using this function now so as not to pull in the dependency on snprintf. in netdb.h, a definition for the NI_NUMERICSCOPE flag is added. this is required by POSIX (it was previously missing) and needed to allow callers to suppress interface-name lookups.
* switch standard resolver functions to use the new dns backendRich Felker2014-06-021-6/+53
| | | | | | | | | | this is the third phase of the "resolver overhaul" project. this commit removes all of the old dns code, and switches the __lookup_name backend (used by getaddrinfo, etc.) and the getnameinfo function to use the newly implemented __res_mkquery and __res_msend interfaces. for parsing the results, a new callback-based __dns_parse function, based on __dns_get_rr from the old dns code, is used.
* include cleanups: remove unused headers and add feature test macrosSzabolcs Nagy2013-12-121-1/+0
|
* use restrict everywhere it's required by c99 and/or posix 2008Rich Felker2012-09-061-3/+3
| | | | | | | | to deal with the fact that the public headers may be used with pre-c99 compilers, __restrict is used in place of restrict, and defined appropriately for any supported compiler. we also avoid the form [restrict] since older versions of gcc rejected it due to a bug in the original c99 standard, and instead use the form *restrict.
* initial check-in, version 0.5.0 v0.5.0Rich Felker2011-02-121-0/+54