summaryrefslogtreecommitdiffstats
path: root/src/include/fake-addrinfo.h
Commit message (Collapse)AuthorAgeFilesLines
* Require IPv6 supportKen Raeburn2012-02-281-1/+1
| | | | | | | | | | | | | | The configure-time options to enable and disable IPv6 support have been deprecated for some time, but the checks for OS support were kept. This removes those checks, and unconditionally compiles in the IPv6 support. There was a configure-time test to see if the macro INET6 needed to be defined in order to enable (visibility of) OS support for IPv6, which was needed on an IRIX system we tested with. That check is retained, but the revised code is untested on IRIX. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25719 dc483132-0cff-0310-8789-dd5450dbe970
* Reindent include directory, reformatting prototypes as necessary.Greg Hudson2009-11-141-60/+61
| | | | | | | Exclude include/gssrpc due to its Sun origin and k5-platform.h due to macros too hairy for emacs c-mode to handle. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23180 dc483132-0cff-0310-8789-dd5450dbe970
* make mark-cstyleTom Yu2009-10-311-28/+28
| | | | | | make reindent git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23100 dc483132-0cff-0310-8789-dd5450dbe970
* Fix typo in last changeKen Raeburn2004-11-031-1/+1
| | | | | | | ticket: 2761 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16856 dc483132-0cff-0310-8789-dd5450dbe970
* move getaddrinfo hacks into support lib for easier maintenanceKen Raeburn2004-11-031-1159/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the cache on Mac OS X, and likely to be enabled eventually on other platforms, this is going to wind up being a non-trivial amount of code on most platforms, and updating the cache code to work on other configurations is likely to take a few rounds. Rather than recompile the world and add a bunch of code to each object file doing name lookups, moving the code into the support library that already defines the static data (list head, mutex) should make things simpler. (TODO: Fix calling conventions for Windows?) * include/fake-addrinfo.h: Move most of code content into util/support/fake-addrinfo.c. (krb5int_getaddrinfo, krb5int_freeaddrinfo, krb5int_getnameinfo, krb5int_gai_strerror): Declare. (getaddrinfo, freeaddrinfo, getnameinfo, gai_strerror): Define as macros mapping to the krb5int_ function names. * util/support/fake-addrinfo.c: Import most of the contents of include/fake-addrinfo.h, so we only compile it once. (krb5int_getaddrinfo, krb5int_freeaddrinfo, krb5int_getnameinfo, krb5int_gai_strerror): New functions, always defined and exported. * util/support/libkrb5support.exports: Export the new functions, not the old _fac symbols. ticket: new status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16854 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h: Include errno.h earlierKen Raeburn2004-10-291-2/+1
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16845 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (AI_ADDRCONFIG, AI_V4MAPPED, AI_ALL): If not defined, or whenKen Raeburn2004-10-051-7/+23
| | | | | | completely faking getaddrinfo, define them as zero. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16803 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (fai_add_hosts_by_name): Handle case where returned ↵Ken Raeburn2004-08-231-2/+4
| | | | | | ai_canonname is null git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16682 dc483132-0cff-0310-8789-dd5450dbe970
* Add a mutex to protect the per-process fake-getaddrinfo data cache.Ken Raeburn2004-07-231-4/+24
| | | | | | | | | | | | | | | | | | | | | | Currently it gets locked while a name lookup is in progress, which is not very efficient. That should be changed, after the code is fixed up so that the cache works on other platforms. * include/fake-addrinfo.h: Include k5-thread.h. (struct fac): Add a mutex. (plant_face, find_face): Check that mutex is already locked. (krb5int_lock_fac, krb5int_unlock_fac): Declare. (fai_add_hosts_by_name): Use them to lock and unlock the mutex. * util/support/fake-addrinfo.c (krb5int_fac): Initialize the mutex. (krb5int_init_fac, krb5int_fini_fac): New functions; finish initializing or destroy the mutex. (krb5int_lock_fac, krb5int_unlock_fac): New functions; lock the mutex after calling krb5int_call_thread_support_init, or unlock it. * util/support/threads.c (krb5int_call_thread_support_init): New function. (krb5int_init_fac, krb5int_fini_fac): Declare. (krb5int_thread_support_init, krb5int_thread_support_fini): Call them. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16622 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (struct face, struct fac): Always declare.Ken Raeburn2004-07-191-20/+20
| | | | | | (krb5int_fac): Renamed from fac, and made extern. Always declare. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16615 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h: Don't include netdb.h, since port-sockets.h already does.Ken Raeburn2004-07-161-7/+0
| | | | | | | | | | | * port-sockets.h: Define _XOPEN_SOURCE_EXTENDED around inclusion of netdb.h if it's not defined and not Windows, as fake-addrinfo.h used to do; otherwise just include it normally. ticket: 2379 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16608 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (in6addr_any): If we need to define a static copy, rename itKen Raeburn2004-07-111-0/+2
| | | | | | with a macro first. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16579 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h: Include stdio.hKen Raeburn2003-12-201-0/+2
| | | | | | ticket: 2016 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15957 dc483132-0cff-0310-8789-dd5450dbe970
* Add platform-dependent 64-bit and inline-function support via new headerKen Raeburn2003-12-131-15/+1
| | | | | | | | | | | | | | | k5-platform.h. Add 64-bit serializer support. [Not needed for ticket 1471, but needed for 2040 and annoying to check in separately.] Add to (internal for now) crypto API a function to get the mandatory checksum type associated with an enctype. New support for server-generated subkey, selected via an auth_context flag. ticket: 1471 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15908 dc483132-0cff-0310-8789-dd5450dbe970
* While libc5 isn't one of our supported configurations, this is a simple enoughKen Raeburn2003-08-301-3/+5
| | | | | | | | | | | | change. It should be in the 1.4 release. (Next 1.3.x release? I don't know.) * fake-addrinfo.h (WRAP_GETADDRINFO, COPY_FIRST_CANONNAME): Don't define on Linux unless HAVE_GETADDRINFO is defined, for libc5 compatibility. ticket: 1711 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15802 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (inline): Supported by Sun Forte Developer 7 compilerKen Raeburn2003-08-261-0/+2
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15791 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (getnameinfo): Define to my_fake_getnameinfo only ifKen Raeburn2003-08-211-10/+16
| | | | | | | | | HAVE_GETADDRINFO is defined. ticket: 1380 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15784 dc483132-0cff-0310-8789-dd5450dbe970
* Make things work on IRIX againKen Raeburn2003-08-211-14/+15
| | | | | | | | | | | | | | * fake-addrinfo.h (inline): Move definitions further up, before first use. Do use __inline__ for gcc without c99 support. (GET_SERV_BY_NAME) [!GETSERVBYNAME_R_RETURNS_INT]: Fix invocation for IRIX definition. * socket-utils.h: Include port-sockets.h to get a definition for struct sockaddr_storage. ticket: 1380 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15783 dc483132-0cff-0310-8789-dd5450dbe970
* Oops. Include errno.h even if gai_strerror isn't being definedKen Raeburn2003-08-211-1/+1
| | | | | | | ticket: 1380 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15782 dc483132-0cff-0310-8789-dd5450dbe970
* First cut at adding local caching to the getaddrinfo support. Still needs workKen Raeburn2003-08-211-81/+276
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fake-addrinfo.h: Delete the unused WRAP_GETNAMEINFO support. (HAVE_GETADDRINFO) [__APPLE__ && __MACH__]: Don't undefine. (FAI_CACHE) [__APPLE__ && __MACH__]: Define. (system_getaddrinfo, system_freeaddrinfo, system_getnameinfo): New functions. (gaiptr, faiptr, gniptr): Variables deleted. Change references to use the system_* functions above. (getaddrinfo, freeaddrinfo) [FAI_CACHE]: Define as macros to the my_fake_* versions. (protoname, socktypename, familyname): Use caller-supplied buffers instead of local static buffers. (debug_dump_getaddrinfo_args): Provide a buffer. (NEED_FAKE_GETNAMEINFO): Define if HAVE_GETADDRINFO is not defined. (inline): Rework macros to test for C99 and IRIX. (NEED_FAKE_GETADDRINFO): Define if FAI_CACHE is defined. (fai_add_entry) [KRB5_USE_INET6]: Support IPv6. (CACHE_ENTRY_LIFETIME): New macro. (struct face, struct fac): New types. (fac): New static variable. (plant_face, find_face): New functions. (fai_add_hosts_by_name) [FAI_CACHE]: Check the cache before looking up the hostname. Add the looked-up host info to the cache. (fake_getaddrinfo): Call GET_SERV_BY_NAME instead of conditionally calling getservbyname or getservbyname_r. Don't pass AF_INET to fai_add_hosts_by_name. (fake_getnameinfo): Define only if NEED_FAKE_GETNAMEINFO is defined. (gai_strerror): Define if either HAVE_FAKE_GETADDRINFO or NEED_FAKE_GETNAMEINFO is defined. (getaddrinfo): Do define function if FAI_CACHE is defined. (getnameinfo): Define only if NEED_FAKE_GETNAMEINFO is defined. ticket: 1380 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15780 dc483132-0cff-0310-8789-dd5450dbe970
* Don't use broken getaddrinfo on Mac OS XAlexandra Ellwood2003-07-221-0/+4
| | | | | | ticket: 1683 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15717 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (getaddrinfo) [NUMERIC_SERVICE_BROKEN]: Overwrite the portKen Raeburn2003-04-071-11/+13
| | | | | | | | | | number only if a numeric service port was supplied. ticket: 1392 status: open target_version: 1.3 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15324 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (COPY_FIRST_CANONNAME) [_AIX]: Define.Ken Raeburn2003-04-021-9/+44
| | | | | | | | | | | | | (GET_HOST_BY_NAME) [_AIX]: New version for AIX version of gethostbyname_r. (getaddrinfo) [NUMERIC_SERVICE_BROKEN]: Use "discard" as a dummy service name instead of none at all. Don't check for unsigned value less than zero. (getaddrinfo) [COPY_FIRST_CANONNAME]: Set any ai_canonname fields other than the first one to null. ticket: 1392 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15317 dc483132-0cff-0310-8789-dd5450dbe970
* AIX 4.3.3 getaddrinfo() is broken in a slightly different way than I thoughtKen Raeburn2003-01-091-7/+134
| | | | | | | | | | | * fake-addrinfo.h (getaddrinfo) [_AIX]: Always overwrite sa_family and sa_len fields, since sa_family at least may be non-zero *and* wrong. (protoname, socktypename, familyname, debug_dump_getaddrinfo_args, debug_dump_error, debug_dump_error, debug_dump_addrinfos) [DEBUG_ADDRINFO]: New debugging functions. (fake_getaddrinfo, getaddrinfo) [DEBUG_ADDRINFO]: Use them. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15104 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (freeaddrinfo): Back out 1/3/03 change. ANSIEzra Peisach2003-01-081-2/+1
| | | | | | does not require it. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15098 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (freeaddrinfo): Do not free a NULL pointerEzra Peisach2003-01-031-1/+2
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15078 dc483132-0cff-0310-8789-dd5450dbe970
* Better type and bounds checking:Ken Raeburn2002-11-131-5/+70
| | | | | | | | | | | | | | | | * fake-addrinfo.h [NEED_FAKE_GETADDRINFO]: Include errno.h. (fake_getnameinfo): Check that socklen_t size arguments are positive and fit in size_t; return EAI_SYSTEM/EINVAL if not. Use the size_t variants when calling string functions. Work around another AIX bug: [_AIX]: Define NUMERIC_SERVICE_BROKEN. [NUMERIC_SERVICE_BROKEN]: Include ctype.h and stdlib.h. (getaddrinfo) [NUMERIC_SERVICE_BROKEN]: If the service name is a numeric string, save its value and the socket type, pass a null pointer to the real getaddrinfo, and patch the returned results. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14995 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (gaiptr, faiptr, gniptr): Delete duplicate declarationsKen Raeburn2002-09-031-16/+0
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14823 dc483132-0cff-0310-8789-dd5450dbe970
* * port-sockets.h (SOCKET_WRITEV) [!_WIN32]: Use TMP after setting it, to ↵Ken Raeburn2002-07-051-4/+6
| | | | | | silence compiler warnings git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14606 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (GET_SERV_BY_PORT) [HAVE_GETSERVBYNAME_R &&Ken Raeburn2002-06-251-29/+46
| | | | | | | | | | !GETSERVBYNAME_R_RETURNS_INT]: Fix getservbyport_r calling sequence, based on IRIX man pages. (getaddrinfo) [WRAP_GETADDRINFO]: Handle case where gethostbyname fails because host has no IPv4 addresses. Don't return a success indication without replacing the old ai_canonname value if it wasn't null. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14582 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h: If IPv6 support is compiled in, but the OS doesEzra Peisach2002-06-211-0/+5
| | | | | | | | | | | | not provide in6addr_any in libc, provide a static copy. * configure.in: If IPv6 support is compiled in, test for existence of in6addr_any in libc. Irix 6.5.16 declares it, and some libraries appear to depend on it, but it is not defined in any libraries that I could find. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14555 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h [COPY_FIRST_CANONNAME]: Include string.hKen Raeburn2002-06-041-2/+9
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14471 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (getaddrinfo, getnameinfo, gai_strerror, freeaddrinfo)Ken Raeburn2002-05-311-14/+43
| | | | | | | | | | | [S_SPLINT_S]: Add Splint annotations. (getaddrinfo, getnameinfo): Buffer sizes are supposed to be socklen_t, not size_t. (freeaddrinfo) [COPY_FIRST_CANONNAME]: Handle null pointer argument. (getaddrinfo) [COPY_FIRST_CANONNAME]: Always do the copying if the ai_canonname is non-null, regardless of the supplied flags. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14462 dc483132-0cff-0310-8789-dd5450dbe970
* * configure.in: Check return type for getservbyname_r just as forKen Raeburn2002-05-311-2/+58
| | | | | | | | | | | | gethostbyname_r. * fake-addrinfo.h (GET_HOST_BY_NAME): Use plain gethostbyname if THREADSAFE_GETHOSTBYNAME is defined, even if _r versions are available. (GET_HOST_BY_ADDR) [GETHOSTBYNAME_R_RETURNS_INT]: Add missing variable declaration. (GET_SERV_BY_NAME, GET_SERV_BY_PORT): New macros, in three flavors, parallel to GET_HOST macros; not used yet. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14461 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (GET_HOST_BY_NAME, GET_HOST_BY_ADDR)Ken Raeburn2002-04-261-4/+4
| | | | | | [GETHOSTBYNAME_R_RETURNS_INT]: Fix backwards test of return value. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14424 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (getaddrinfo) [_AIX]: Declare and initialize variable "ai"Ken Raeburn2002-04-251-7/+7
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14420 dc483132-0cff-0310-8789-dd5450dbe970
* * configure.in: Check for gethostbyname_r, gethostbyaddr_r, getservbyname_r andKen Raeburn2002-04-121-22/+104
| | | | | | | | | | | | getservbyport_r. Figure out the return type of gethostbyname_r. * fake-addrinfo.h (GET_HOST_BY_NAME, GET_HOST_BY_ADDR): New macros. (fai_add_hosts_by_name, fake_getnameinfo, getaddrinfo): Use them. (fake_getaddrinfo): Use getservbyname_r if available. (fake_getnameinfo): Never call inet_ntoa; in open-coded form, initialize local pointer variable after label. Use getservbyport_r if available. (gaiptr, faiptr, gniptr): Pointer variables are now const. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14388 dc483132-0cff-0310-8789-dd5450dbe970
* * port-sockets.h: Use Winsock 2 headers for Win32.Danilo Almeida2002-04-111-1/+6
| | | | | | * fake-addrinfo.h: Define HAVE_GETADDRINFO for Win32. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14379 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (getaddrinfo) [__linux__]: Don't crash if hint is a null ↵Ken Raeburn2002-03-281-1/+1
| | | | | | pointer git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14304 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h [NEED_FAKE_GETADDRINFO]: Include errno.h.Ken Raeburn2002-03-281-1/+3
| | | | | | | (fake_getnameinfo) [__GNUC__ && __mips__]: Use const when referencing bytes of supplied address. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14296 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (fake_getnameinfo) [__GNUC__ && __mips__]: Don't callKen Raeburn2002-03-261-0/+12
| | | | | | inet_ntoa, struct passing doesn't work. Format the output string locally. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14293 dc483132-0cff-0310-8789-dd5450dbe970
* Change approach for getaddrinfo support. Now, only fake-addrinfo.h isKen Raeburn2002-03-261-17/+543
| | | | | | | | | | | | included, no magic macros need to be defined, and no special care needs to be taken to identify a unique object file used in all builds of a library/program. All defined functions (if any) are static in each object file, and declared inline under gcc so they can be more easily eliminated. Simplifies maintenance, and worst case should add no more than a few KB to libraries and programs. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14291 dc483132-0cff-0310-8789-dd5450dbe970
* delete a macro def that should've gone away before last checkinKen Raeburn2002-03-121-2/+0
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14263 dc483132-0cff-0310-8789-dd5450dbe970
* Restructure a little to permit wrapping a system implementation of getaddrinfoKen Raeburn2002-03-121-7/+22
| | | | | | | | | and friends in a function that does some fixups on the returned data. Use this for Linux and AIX. Also separate the replacement versions as functions with different names so that Windows can (eventually) use them from a wrapper function if a system version cannot be located. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14262 dc483132-0cff-0310-8789-dd5450dbe970
* update copyrightKen Raeburn2002-02-191-1/+1
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14146 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h: Always check for FAI_PREFIX, not just when fake getaddrinfoKen Raeburn2002-02-101-2/+8
| | | | | | | | | support is needed. (fixup_addrinfo): Declare. * fake-addrinfo.c (fixup_addrinfo): New function, fixes up breakage in AIX and GNU implementations (so far) of getaddrinfo. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14139 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h: Include socket-utils.hKen Raeburn2001-09-061-0/+1
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13729 dc483132-0cff-0310-8789-dd5450dbe970
* use a different macro in fake-addrinfo.h to tell fake-addrinfo.c to define fnsKen Raeburn2001-08-311-0/+1
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13717 dc483132-0cff-0310-8789-dd5450dbe970
* * fake-addrinfo.h (AI_V4MAPPED, AI_ADDRCONFIG, AI_ALL, AI_DEFAULT): Define asKen Raeburn2001-08-301-8/+8
| | | | | | bogus values, since they're part of getipnodeby* API, not getaddrinfo API. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13699 dc483132-0cff-0310-8789-dd5450dbe970
* copyrightsKen Raeburn2001-08-301-0/+41
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13692 dc483132-0cff-0310-8789-dd5450dbe970