mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-19 11:30:06 +00:00
5f0e6fc702
* malloc/malloc.h: Declare malloc_object_allocated_size, malloc_walk. * malloc/Makefile (dist-routines): Add malloc-size, malloc-walk. * malloc/malloc-size.c: New file. * malloc/malloc-walk.c: New file. * malloc/malloc-find.c (malloc_find_object_address): Return null if PTR is outside the heap. * elf/dl-load.c (_dl_map_object): If the requested name matches the soname of a loaded object, use that object. Mon Jun 24 19:57:01 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * Makefile (subdirs): Add nss. * inet/Makefile (routines): Add getrpcent, getrpcbyname, getrpcbynumber, getrpcent_r, getrpcbyname_r, getrpcbynumber_r. * inet/getrpcbynumber_r.c: New file. * inet/getrpcbynumber.c: New file. * inet/getrpcbyname.c: New file. * inet/getrpcbyname_r.c: New file. * inet/getrpcent_r.c: New file. * inet/getrpcent.c: New file. * nss/rpc-lookup.c: New file. * nss/nss_files/files-rpc.c: New file. * nss/Makefile (routines): Add rpc-lookup. (libnss_files-routines): Add files-rpc. * sunrpc/Makefile (routines): Remove getrpcent. * sunrpc/getrpcent.c: File removed. * nss/getXXent_r.c (REENTRANT_GETNAME): Clear NO_MORE when NIP is non-null on entry. * Makeconfig (rpath-link): Add $(nssobjdir). (nssobjdir): New variable. * Makerules: Move shared library building before objects rules, so versions are known before extra-lib.mk gets included. * extra-lib.mk (lib-noranlib): Depend on the shared object too. * pwd/getpwuid.c: Rewritten using nss. * pwd/getpwnam.c: Likewise. * pwd/getpwent.c: Likewise. * grp/getgrnam.c: Likewise. * grp/getgrgid.c: Likewise. * grp/getgrent.c: Likewise. * pwd/Makefile (routines): Add getpwent_r, getpwnam_r, getpwuid_r. * pwd/getpwent_r.c: New file. * pwd/getpwnam_r.c: New file. * pwd/getpwuid_r.c: New file. * grp/Makefile (routines): Add getgrent_r, getgrgid_r, getgrnam_r. * grp/getgrnam_r.c: New file. * grp/getgrgid_r.c: New file. * grp/getgrent_r.c: New file. * grp/Makefile (routines): Remove grpopen, grpread. * pwd/Makefile (routines): Remove pwdopen, pwdread. * grp/grpopen.c, grp/grpread.c, pwd/pwdopen.c, pwd/pwdread.c: Removed. * pwd/fgetpwent.c: Rewritten using files-parse.c. * grp/fgetgrent.c: Likewise. * nss/Makefile (routines): Add grp-lookup and pwd-lookup. * nss/pwd-lookup.c, nss/grp-lookup.c: New files. * nss/nss_files/files-grp.c: New file. * nss/nss_files/files-pwd.c: New file. * nss/Makefile (subdir-dirs): New variable; use it in vpath. * nss/nss_files/files-parse.c: New file. * nss/nss_files/files-XXX.c: New file. * nss/nss_files/files-hosts.c, nss/nss_files/files-proto.c, nss/nss_files/files-service.c, nss/nss_files/files-network.c: Rewritten using them. * nss/Makefile (libnss_files-routines): Remove files-host. Add files-hosts, files-grp, files-pwd. * nss/nss_dns/dns-network.c: Don't include <pthread.h>. Mon Jun 24 22:39:12 1996 Richard Henderson <rth@tamu.edu> * sysdeps/alpha/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE): A .plt entry now loads the .rela.plt offset directly rather than making us calculate it. Sun Jun 23 15:24:05 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * time/Makefile ($(installed-localtime-file) rule): Do $(make-target-directory) first. * resolv.h: Fix wrapper for resolv/resolv.h. * configure.in (ld --no-whole-archive check): Use AC_TRY_COMMAND. Compile dummy file and pass -nostdlib -nostartfiles so as not to require installed libraries. * shlib-versions (*-*-*): Set libresolv=2, libnss_files=1, libnss_dns=1. Sun Jun 23 19:42:05 1996 Ulrich Drepper <drepper@cygnus.com> * resolv/netdb.h (_PATH_NSSWITCH_CONF): New macro. * inet/herrno.c: New file. * resolv/res_init.c: Remove res_hconf calls. * nss/Makefile, nss/XXX-lookup.c, nss/file-lookup.c, nss/getXXbyYY.c, nss/getXXbyYY_r.c, nss/getXXent.c, nss/getXXent_r.c, nss/host-lookup.c, nss/network-lookup.c, nss/nsswitch.c, nss/nsswitch.h, nss/proto-lookup.c, nss/service-lookup.c: New files. Implementation of name service switch, following the approach in Solaris. Interface specification and general structure inspired by Peter Eriksson <pen@lysator.liu.se>. * nss/nss_files/files-host.c, nss/nss_files/files-network.c, nss/nss_files/files-proto.c, nss/nss_files/files-service.c: Implementation of libnss_files.so module for file based databases in NSS service. * nss/nss_dns/dns-host.c, nss/nss_dns/dns-network.c: Implementation if libnss_dns.so module for DNS name lookup in NSS service. * inet/getproto.c, inet/getprtent.c, inet/getprtname.c, inet/getservent.c, inet/getsrvbynm.c, inet/getsrvbypt.c: Changed to serve as interface to NSS. * inet/gethstbyad.c, inet/gethstbyad_r.c, inet/gethstbynm.c, inet/gethstbynm2.c, inet/gethstbynm2_r.c, inet/gethstbynm_r.c, inet/gethstent.c, inet/gethstent_r.c, inet/getnetbynm.c, inet/getnetbynm_r.c, inet/getnetbypt.c, inet/getnetbypt_r.c, inet/getnetent.c, inet/getnetent_r.c, inet/getproto_r.c, inet/getprtent_r.c, inet/getprtname_r.c, inet/getservent_r.c, inet/getsrvbynm_r.c, inet/getsrvbypt_r.c: New files. Implement interfaces to NSS, including reentrant functions. * resolv/getnetbyaddr.c, resolv/getnetbyname.c, resolv/getnetent.c, resolv/sethostent.c: Removed: Obsoleted by NSS. * resolv/mapv4v6addr.h, resolv/mapv4v6hostent.h: Extracted from gethnamaddr.c. These private functions are now used in more than one file. * resolv/inet_pton.c, resolv/gethnamaddr.c: Updated to bind-4.9.4-T5B. Sat Jun 22 16:49:47 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * rpm/Makefile ($(config)): Make sure the word list in the for loop is syntactically non-empty.
215 lines
5.0 KiB
C
215 lines
5.0 KiB
C
/* Copyright (c) 1996 by Internet Software Consortium.
|
|
*
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
* copyright notice and this permission notice appear in all copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
|
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
|
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
|
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
|
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
|
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
* SOFTWARE.
|
|
*/
|
|
|
|
#if defined(LIBC_SCCS) && !defined(lint)
|
|
static char rcsid[] = "$Id$";
|
|
#endif /* LIBC_SCCS and not lint */
|
|
|
|
#include <sys/param.h>
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
#include <arpa/inet.h>
|
|
#include <arpa/nameser.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
#include "../conf/portability.h"
|
|
|
|
/*
|
|
* WARNING: Don't even consider trying to compile this on a system where
|
|
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
|
|
*/
|
|
|
|
static int inet_pton4 __P((const char *src, u_char *dst));
|
|
static int inet_pton6 __P((const char *src, u_char *dst));
|
|
|
|
/* int
|
|
* inet_pton(af, src, dst)
|
|
* convert from presentation format (which usually means ASCII printable)
|
|
* to network format (which is usually some kind of binary format).
|
|
* return:
|
|
* 1 if the address was valid for the specified address family
|
|
* 0 if the address wasn't valid (`dst' is untouched in this case)
|
|
* -1 if some other error occurred (`dst' is untouched in this case, too)
|
|
* author:
|
|
* Paul Vixie, 1996.
|
|
*/
|
|
int
|
|
inet_pton(af, src, dst)
|
|
int af;
|
|
const char *src;
|
|
void *dst;
|
|
{
|
|
switch (af) {
|
|
case AF_INET:
|
|
return (inet_pton4(src, dst));
|
|
case AF_INET6:
|
|
return (inet_pton6(src, dst));
|
|
default:
|
|
errno = EAFNOSUPPORT;
|
|
return (-1);
|
|
}
|
|
/* NOTREACHED */
|
|
}
|
|
|
|
/* int
|
|
* inet_pton4(src, dst)
|
|
* like inet_pton() but without all the hexadecimal and shorthand.
|
|
* return:
|
|
* 1 if `src' is a valid dotted quad, else 0.
|
|
* notice:
|
|
* does not touch `dst' unless it's returning 1.
|
|
* author:
|
|
* Paul Vixie, 1996.
|
|
*/
|
|
static int
|
|
inet_pton4(src, dst)
|
|
const char *src;
|
|
u_char *dst;
|
|
{
|
|
static const char digits[] = "0123456789";
|
|
int saw_digit, octets, ch;
|
|
u_char tmp[INADDRSZ], *tp;
|
|
|
|
saw_digit = 0;
|
|
octets = 0;
|
|
*(tp = tmp) = 0;
|
|
while ((ch = *src++) != '\0') {
|
|
const char *pch;
|
|
|
|
if ((pch = strchr(digits, ch)) != NULL) {
|
|
u_int new = *tp * 10 + (pch - digits);
|
|
|
|
if (new > 255)
|
|
return (0);
|
|
*tp = new;
|
|
if (! saw_digit) {
|
|
if (++octets > 4)
|
|
return (0);
|
|
saw_digit = 1;
|
|
}
|
|
} else if (ch == '.' && saw_digit) {
|
|
if (octets == 4)
|
|
return (0);
|
|
*++tp = 0;
|
|
saw_digit = 0;
|
|
} else
|
|
return (0);
|
|
}
|
|
if (octets < 4)
|
|
return (0);
|
|
bcopy(tmp, dst, INADDRSZ);
|
|
return (1);
|
|
}
|
|
|
|
/* int
|
|
* inet_pton6(src, dst)
|
|
* convert presentation level address to network order binary form.
|
|
* return:
|
|
* 1 if `src' is a valid [RFC1884 2.2] address, else 0.
|
|
* notice:
|
|
* (1) does not touch `dst' unless it's returning 1.
|
|
* (2) :: in a full address is silently ignored.
|
|
* credit:
|
|
* inspired by Mark Andrews.
|
|
* author:
|
|
* Paul Vixie, 1996.
|
|
*/
|
|
static int
|
|
inet_pton6(src, dst)
|
|
const char *src;
|
|
u_char *dst;
|
|
{
|
|
static const char xdigits_l[] = "0123456789abcdef",
|
|
xdigits_u[] = "0123456789ABCDEF";
|
|
u_char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
|
|
const char *xdigits, *curtok;
|
|
int ch, saw_xdigit;
|
|
u_int val;
|
|
|
|
bzero((tp = tmp), IN6ADDRSZ);
|
|
endp = tp + IN6ADDRSZ;
|
|
colonp = NULL;
|
|
/* Leading :: requires some special handling. */
|
|
if (*src == ':')
|
|
if (*++src != ':')
|
|
return (0);
|
|
curtok = src;
|
|
saw_xdigit = 0;
|
|
val = 0;
|
|
while ((ch = *src++) != '\0') {
|
|
const char *pch;
|
|
|
|
if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
|
|
pch = strchr((xdigits = xdigits_u), ch);
|
|
if (pch != NULL) {
|
|
val <<= 4;
|
|
val |= (pch - xdigits);
|
|
if (val > 0xffff)
|
|
return (0);
|
|
saw_xdigit = 1;
|
|
continue;
|
|
}
|
|
if (ch == ':') {
|
|
curtok = src;
|
|
if (!saw_xdigit) {
|
|
if (colonp)
|
|
return (0);
|
|
colonp = tp;
|
|
continue;
|
|
}
|
|
if (tp + INT16SZ > endp)
|
|
return (0);
|
|
*tp++ = (u_char) (val >> 8) & 0xff;
|
|
*tp++ = (u_char) val & 0xff;
|
|
saw_xdigit = 0;
|
|
val = 0;
|
|
continue;
|
|
}
|
|
if (ch == '.' && ((tp + INADDRSZ) <= endp) &&
|
|
inet_pton4(curtok, tp) > 0) {
|
|
tp += INADDRSZ;
|
|
saw_xdigit = 0;
|
|
break; /* '\0' was seen by inet_pton4(). */
|
|
}
|
|
return (0);
|
|
}
|
|
if (saw_xdigit) {
|
|
if (tp + INT16SZ > endp)
|
|
return (0);
|
|
*tp++ = (u_char) (val >> 8) & 0xff;
|
|
*tp++ = (u_char) val & 0xff;
|
|
}
|
|
if (colonp != NULL) {
|
|
/*
|
|
* Since some memmove()'s erroneously fail to handle
|
|
* overlapping regions, we'll do the shift by hand.
|
|
*/
|
|
const int n = tp - colonp;
|
|
int i;
|
|
|
|
for (i = 1; i <= n; i++) {
|
|
endp[- i] = colonp[n - i];
|
|
colonp[n - i] = 0;
|
|
}
|
|
tp = endp;
|
|
}
|
|
if (tp != endp)
|
|
return (0);
|
|
bcopy(tmp, dst, IN6ADDRSZ);
|
|
return (1);
|
|
}
|