diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-08-20 19:50:45 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-08-20 19:50:45 +0200 |
commit | 4dd9e35bfd35d3138bc44169baba098005bad51e (patch) | |
tree | a4939c43a9c3fe00eb27f023e14acc5e1fe8808c /inet | |
parent | bd42a4599d1b6f77bcfe1e4f67b7cbd9e1cb2dfd (diff) | |
parent | f76453c31593957fec1a99b986bfa5506618b79c (diff) |
Merge commit 'refs/top-bases/t/bigmem' into t/bigmem
Diffstat (limited to 'inet')
86 files changed, 332 insertions, 436 deletions
diff --git a/inet/Makefile b/inet/Makefile index f4c3273916..f1d871ff11 100644 --- a/inet/Makefile +++ b/inet/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2014 Free Software Foundation, Inc. +# Copyright (C) 1991-2015 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -20,6 +20,8 @@ # subdir := inet +include ../Makeconfig + headers := netinet/ether.h netinet/in.h netinet/in_systm.h \ netinet/if_ether.h netinet/igmp.h \ netinet/tcp.h netinet/ip.h $(wildcard arpa/*.h protocols/*.h) \ @@ -35,8 +37,6 @@ routines := htonl htons \ getproto getproto_r getprtent getprtent_r getprtname getprtname_r \ getsrvbynm getsrvbynm_r getsrvbypt getsrvbypt_r getservent \ getservent_r \ - getrpcent getrpcbyname getrpcbynumber \ - getrpcent_r getrpcbyname_r getrpcbynumber_r \ ether_aton ether_aton_r ether_hton ether_line \ ether_ntoa ether_ntoa_r ether_ntoh \ rcmd rexec ruserpass \ diff --git a/inet/Versions b/inet/Versions index 06507199a9..56eb274634 100644 --- a/inet/Versions +++ b/inet/Versions @@ -7,8 +7,7 @@ libc { rexecoptions; # e* - endaliasent; endhostent; endnetent; endnetgrent; endprotoent; endrpcent; - endservent; + endaliasent; endhostent; endnetent; endnetgrent; endprotoent; endservent; # e* ether_aton; ether_aton_r; ether_hostton; ether_line; ether_ntoa; @@ -21,9 +20,8 @@ libc { gethostent_r; getnetbyaddr; getnetbyaddr_r; getnetbyname; getnetbyname_r; getnetent; getnetent_r; getnetgrent; getnetgrent_r; getprotobyname; getprotobyname_r; getprotobynumber; - getprotobynumber_r; getprotoent; getprotoent_r; getrpcbyname; - getrpcbyname_r; getrpcbynumber; getrpcbynumber_r; getrpcent; getrpcent_r; - getrpcport; getservbyname; getservbyname_r; getservbyport; + getprotobynumber_r; getprotoent; getprotoent_r; + getservbyname; getservbyname_r; getservbyport; getservbyport_r; getservent; getservent_r; # h* @@ -41,7 +39,7 @@ libc { rcmd; rexec; rresvport; ruserok; ruserpass; # s* - setaliasent; setnetent; setnetgrent; setprotoent; setrpcent; setservent; + setaliasent; setnetent; setnetgrent; setprotoent; setservent; } GLIBC_2.1 { # variables in normal name space @@ -55,8 +53,7 @@ libc { getaliasbyname_r; getaliasent_r; gethostbyaddr_r; gethostbyname2_r; gethostbyname_r; gethostent_r; getnetbyaddr_r; getnetbyname_r; getnetent_r; getnetgrent_r; getprotobyname_r; getprotobynumber_r; - getprotoent_r; getrpcbyname_r; getrpcbynumber_r; getrpcent_r; - getservbyname_r; + getprotoent_r; getservbyname_r; } GLIBC_2.2 { # i* diff --git a/inet/aliases.h b/inet/aliases.h index 895520eb88..1b9fd38a71 100644 --- a/inet/aliases.h +++ b/inet/aliases.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/arpa/inet.h b/inet/arpa/inet.h index 22b554229a..d81d87c685 100644 --- a/inet/arpa/inet.h +++ b/inet/arpa/inet.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2014 Free Software Foundation, Inc. +/* Copyright (C) 1997-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/bug-if1.c b/inet/bug-if1.c index d6a4ef29a1..61bead4a32 100644 --- a/inet/bug-if1.c +++ b/inet/bug-if1.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2014 Free Software Foundation, Inc. +/* Copyright (C) 2004-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2004. diff --git a/inet/check_native.c b/inet/check_native.c index 3a1f192037..ee65b12676 100644 --- a/inet/check_native.c +++ b/inet/check_native.c @@ -1,5 +1,5 @@ /* Determine whether interfaces use native transport. Generic version. - Copyright (C) 2012-2014 Free Software Foundation, Inc. + Copyright (C) 2012-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/check_pf.c b/inet/check_pf.c index b2934f7718..3739a959c5 100644 --- a/inet/check_pf.c +++ b/inet/check_pf.c @@ -1,5 +1,5 @@ /* Determine protocol families for which interfaces exist. Generic version. - Copyright (C) 2003-2014 Free Software Foundation, Inc. + Copyright (C) 2003-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -62,7 +62,7 @@ __free_in6ai (struct in6addrinfo *in6ai) } -#ifdef IS_IN_nscd +#if IS_IN (nscd) uint32_t __bump_nl_timestamp (void) { diff --git a/inet/ether_aton.c b/inet/ether_aton.c index cb9f438817..de6c2e5a2b 100644 --- a/inet/ether_aton.c +++ b/inet/ether_aton.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/ether_aton_r.c b/inet/ether_aton_r.c index 8c8ad44e72..2d33f29ac6 100644 --- a/inet/ether_aton_r.c +++ b/inet/ether_aton_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/ether_hton.c b/inet/ether_hton.c index fe2e0b0fad..a1b31a3523 100644 --- a/inet/ether_hton.c +++ b/inet/ether_hton.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/ether_line.c b/inet/ether_line.c index 7458a8dec1..707b218271 100644 --- a/inet/ether_line.c +++ b/inet/ether_line.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/ether_ntoa.c b/inet/ether_ntoa.c index 9f29169619..298856951e 100644 --- a/inet/ether_ntoa.c +++ b/inet/ether_ntoa.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/ether_ntoa_r.c b/inet/ether_ntoa_r.c index 8c42a3e5f4..edd2793e2f 100644 --- a/inet/ether_ntoa_r.c +++ b/inet/ether_ntoa_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/ether_ntoh.c b/inet/ether_ntoh.c index f019525829..cf46b4ea49 100644 --- a/inet/ether_ntoh.c +++ b/inet/ether_ntoh.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/getaliasent.c b/inet/getaliasent.c index 4a1fe25fbd..5cfb51ac02 100644 --- a/inet/getaliasent.c +++ b/inet/getaliasent.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/getaliasent_r.c b/inet/getaliasent_r.c index 881dae301f..dfdf6c62df 100644 --- a/inet/getaliasent_r.c +++ b/inet/getaliasent_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/getaliasname.c b/inet/getaliasname.c index 623ecce17e..8b59b2bdb0 100644 --- a/inet/getaliasname.c +++ b/inet/getaliasname.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/getaliasname_r.c b/inet/getaliasname_r.c index 800ecd541c..dc3f5d6fa3 100644 --- a/inet/getaliasname_r.c +++ b/inet/getaliasname_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/gethstbyad.c b/inet/gethstbyad.c index 0bb94d854f..d7c36d7663 100644 --- a/inet/gethstbyad.c +++ b/inet/gethstbyad.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/gethstbyad_r.c b/inet/gethstbyad_r.c index e7ba9d1d70..06d39066c1 100644 --- a/inet/gethstbyad_r.c +++ b/inet/gethstbyad_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -32,7 +32,7 @@ be performed. */ #define PREPROCESS \ if (len == sizeof (struct in6_addr) \ - && __builtin_expect (memcmp (&in6addr_any, addr, \ + && __builtin_expect (memcmp (&__in6addr_any, addr, \ sizeof (struct in6_addr)), 1) == 0) \ { \ *h_errnop = HOST_NOT_FOUND; \ diff --git a/inet/gethstbynm.c b/inet/gethstbynm.c index e02959103e..cb12f2ae12 100644 --- a/inet/gethstbynm.c +++ b/inet/gethstbynm.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/gethstbynm2.c b/inet/gethstbynm2.c index 925f540228..4eae094a28 100644 --- a/inet/gethstbynm2.c +++ b/inet/gethstbynm2.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/gethstbynm2_r.c b/inet/gethstbynm2_r.c index d7da276a5e..d5fb50a8dd 100644 --- a/inet/gethstbynm2_r.c +++ b/inet/gethstbynm2_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/gethstbynm_r.c b/inet/gethstbynm_r.c index 56f0a30de5..999c0bb6b6 100644 --- a/inet/gethstbynm_r.c +++ b/inet/gethstbynm_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/gethstent.c b/inet/gethstent.c index aafec10aac..62a01999e8 100644 --- a/inet/gethstent.c +++ b/inet/gethstent.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/gethstent_r.c b/inet/gethstent_r.c index 31af630bf6..92552634e3 100644 --- a/inet/gethstent_r.c +++ b/inet/gethstent_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/getipv4sourcefilter.c b/inet/getipv4sourcefilter.c index 476fd0ab77..b47f272f08 100644 --- a/inet/getipv4sourcefilter.c +++ b/inet/getipv4sourcefilter.c @@ -1,5 +1,5 @@ /* Get source filter. Stub version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. + Copyright (C) 2004-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2004. diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c index ce54fe42a8..0126f20326 100644 --- a/inet/getnameinfo.c +++ b/inet/getnameinfo.c @@ -35,7 +35,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* This software is Copyright 1996 by Craig Metz, All Rights Reserved. */ -#include <alloca.h> #include <errno.h> #include <netdb.h> #include <stddef.h> @@ -53,6 +52,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <sys/un.h> #include <sys/utsname.h> #include <bits/libc-lock.h> +#include <scratch_buffer.h> #ifdef HAVE_LIBIDN # include <libidn/idna.h> @@ -82,17 +82,21 @@ nrl_domainname (void) { char *c; struct hostent *h, th; - size_t tmpbuflen = 1024; - char *tmpbuf = alloca (tmpbuflen); int herror; + struct scratch_buffer tmpbuf; + scratch_buffer_init (&tmpbuf); not_first = 1; - while (__gethostbyname_r ("localhost", &th, tmpbuf, tmpbuflen, &h, - &herror)) + while (__gethostbyname_r ("localhost", &th, + tmpbuf.data, tmpbuf.length, + &h, &herror)) { if (herror == NETDB_INTERNAL && errno == ERANGE) - tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); + { + if (!scratch_buffer_grow (&tmpbuf)) + goto done; + } else break; } @@ -103,22 +107,26 @@ nrl_domainname (void) { /* The name contains no domain information. Use the name now to get more information. */ - while (__gethostname (tmpbuf, tmpbuflen)) - tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); + while (__gethostname (tmpbuf.data, tmpbuf.length)) + if (!scratch_buffer_grow (&tmpbuf)) + goto done; - if ((c = strchr (tmpbuf, '.'))) + if ((c = strchr (tmpbuf.data, '.'))) domain = __strdup (++c); else { /* We need to preserve the hostname. */ - const char *hstname = strdupa (tmpbuf); + const char *hstname = strdupa (tmpbuf.data); - while (__gethostbyname_r (hstname, &th, tmpbuf, tmpbuflen, + while (__gethostbyname_r (hstname, &th, + tmpbuf.data, tmpbuf.length, &h, &herror)) { if (herror == NETDB_INTERNAL && errno == ERANGE) - tmpbuf = extend_alloca (tmpbuf, tmpbuflen, - 2 * tmpbuflen); + { + if (!scratch_buffer_grow (&tmpbuf)) + goto done; + } else break; } @@ -133,12 +141,15 @@ nrl_domainname (void) while (__gethostbyaddr_r ((const char *) &in_addr, sizeof (struct in_addr), - AF_INET, &th, tmpbuf, - tmpbuflen, &h, &herror)) + AF_INET, &th, + tmpbuf.data, tmpbuf.length, + &h, &herror)) { if (herror == NETDB_INTERNAL && errno == ERANGE) - tmpbuf = extend_alloca (tmpbuf, tmpbuflen, - 2 * tmpbuflen); + { + if (!scratch_buffer_grow (&tmpbuf)) + goto done; + } else break; } @@ -148,6 +159,8 @@ nrl_domainname (void) } } } + done: + scratch_buffer_free (&tmpbuf); } __libc_lock_unlock (lock); @@ -163,11 +176,12 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, int flags) { int serrno = errno; - int tmpbuflen = 1024; int herrno; - char *tmpbuf = alloca (tmpbuflen); struct hostent th; int ok = 0; + struct scratch_buffer tmpbuf; + + scratch_buffer_init (&tmpbuf); if (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV|NI_NOFQDN|NI_NAMEREQD|NI_DGRAM #ifdef HAVE_LIBIDN @@ -212,21 +226,35 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, { while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in6 *) sa)->sin6_addr), sizeof(struct in6_addr), - AF_INET6, &th, tmpbuf, tmpbuflen, + AF_INET6, &th, + tmpbuf.data, tmpbuf.length, &h, &herrno)) if (herrno == NETDB_INTERNAL && errno == ERANGE) - tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); + { + if (!scratch_buffer_grow (&tmpbuf)) + { + __set_h_errno (herrno); + return EAI_MEMORY; + } + } else break; } else { while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr), - sizeof(struct in_addr), AF_INET, - &th, tmpbuf, tmpbuflen, + sizeof(struct in_addr), + AF_INET, &th, + tmpbuf.data, tmpbuf.length, &h, &herrno)) if (herrno == NETDB_INTERNAL && errno == ERANGE) - tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); + { + if (!scratch_buffer_grow (&tmpbuf)) + { + __set_h_errno (herrno); + return EAI_MEMORY; + } + } else break; } @@ -401,11 +429,14 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, int e; while ((e = __getservbyport_r (((const struct sockaddr_in *) sa)->sin_port, ((flags & NI_DGRAM) - ? "udp" : "tcp"), - &ts, tmpbuf, tmpbuflen, &s))) + ? "udp" : "tcp"), &ts, + tmpbuf.data, tmpbuf.length, &s))) { if (e == ERANGE) - tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); + { + if (!scratch_buffer_grow (&tmpbuf)) + return EAI_MEMORY; + } else break; } diff --git a/inet/getnetbyad.c b/inet/getnetbyad.c index 7e7f410f66..a03d1ecb4e 100644 --- a/inet/getnetbyad.c +++ b/inet/getnetbyad.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/getnetbyad_r.c b/inet/getnetbyad_r.c index 9c2453d3b3..909ebc7d00 100644 --- a/inet/getnetbyad_r.c +++ b/inet/getnetbyad_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/getnetbynm.c b/inet/getnetbynm.c index 1edec1af00..5e92759aba 100644 --- a/inet/getnetbynm.c +++ b/inet/getnetbynm.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/getnetbynm_r.c b/inet/getnetbynm_r.c index bd2324bf74..a10c4be61d 100644 --- a/inet/getnetbynm_r.c +++ b/inet/getnetbynm_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/getnetent.c b/inet/getnetent.c index b4046b4c12..5858755bf2 100644 --- a/inet/getnetent.c +++ b/inet/getnetent.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/getnetent_r.c b/inet/getnetent_r.c index 51bbab129d..539d79faf0 100644 --- a/inet/getnetent_r.c +++ b/inet/getnetent_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/getnetgrent.c b/inet/getnetgrent.c index 2bcc5e5f6e..094f34f0fd 100644 --- a/inet/getnetgrent.c +++ b/inet/getnetgrent.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c index 62cdfda9cb..53ae648ced 100644 --- a/inet/getnetgrent_r.c +++ b/inet/getnetgrent_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -235,6 +235,14 @@ endnetgrent (void) } #ifdef USE_NSCD +static const char * +get_nonempty_val (const char *in) +{ + if (*in == '\0') + return NULL; + return in; +} + static enum nss_status nscd_getnetgrent (struct __netgrent *datap, char *buffer, size_t buflen, int *errnop) @@ -243,11 +251,11 @@ nscd_getnetgrent (struct __netgrent *datap, char *buffer, size_t buflen, return NSS_STATUS_UNAVAIL; datap->type = triple_val; - datap->val.triple.host = datap->cursor; + datap->val.triple.host = get_nonempty_val (datap->cursor); datap->cursor = (char *) __rawmemchr (datap->cursor, '\0') + 1; - datap->val.triple.user = datap->cursor; + datap->val.triple.user = get_nonempty_val (datap->cursor); datap->cursor = (char *) __rawmemchr (datap->cursor, '\0') + 1; - datap->val.triple.domain = datap->cursor; + datap->val.triple.domain = get_nonempty_val (datap->cursor); datap->cursor = (char *) __rawmemchr (datap->cursor, '\0') + 1; return NSS_STATUS_SUCCESS; @@ -273,8 +281,8 @@ __internal_getnetgrent_r (char **hostp, char **userp, char **domainp, { #ifdef USE_NSCD /* This bogus function pointer is a special marker left by - __nscd_setnetgrent to tell us to use the data it left - before considering any modules. */ + __nscd_setnetgrent to tell us to use the data it left + before considering any modules. */ if (datap->nip == (service_user *) -1l) fct = nscd_getnetgrent; else @@ -283,71 +291,73 @@ __internal_getnetgrent_r (char **hostp, char **userp, char **domainp, fct = __nss_lookup_function (datap->nip, "getnetgrent_r"); no_more = fct == NULL; } - } - - while (! no_more) - { - status = DL_CALL_FCT (*fct, (datap, buffer, buflen, &errno)); - if (status == NSS_STATUS_RETURN) + while (! no_more) { - /* This was the last one for this group. Look at next group - if available. */ - int found = 0; - while (datap->needed_groups != NULL && ! found) + status = DL_CALL_FCT (*fct, (datap, buffer, buflen, &errno)); + + if (status == NSS_STATUS_RETURN + /* The service returned a NOTFOUND, but there are more groups that + we need to resolve before we give up. */ + || (status == NSS_STATUS_NOTFOUND && datap->needed_groups != NULL)) { - struct name_list *tmp = datap->needed_groups; - datap->needed_groups = datap->needed_groups->next; - tmp->next = datap->known_groups; - datap->known_groups = tmp; + /* This was the last one for this group. Look at next group + if available. */ + int found = 0; + while (datap->needed_groups != NULL && ! found) + { + struct name_list *tmp = datap->needed_groups; + datap->needed_groups = datap->needed_groups->next; + tmp->next = datap->known_groups; + datap->known_groups = tmp; - found = __internal_setnetgrent_reuse (datap->known_groups->name, - datap, errnop); - } + found = __internal_setnetgrent_reuse (datap->known_groups->name, + datap, errnop); + } - if (found && datap->nip != NULL) - { - fct = __nss_lookup_function (datap->nip, "getnetgrent_r"); - if (fct != NULL) - continue; + if (found && datap->nip != NULL) + { + fct = __nss_lookup_function (datap->nip, "getnetgrent_r"); + if (fct != NULL) + continue; + } } - } - else if (status == NSS_STATUS_SUCCESS && datap->type == group_val) - { - /* The last entry was a name of another netgroup. */ - struct name_list *namep; - - /* Ignore if we've seen the name before. */ - for (namep = datap->known_groups; namep != NULL; - namep = namep->next) - if (strcmp (datap->val.group, namep->name) == 0) - break; - if (namep == NULL) - for (namep = datap->needed_groups; namep != NULL; - namep = namep->next) - if (strcmp (datap->val.group, namep->name) == 0) - break; - if (namep != NULL) - /* Really ignore. */ - continue; - - size_t group_len = strlen (datap->val.group) + 1; - namep = (struct name_list *) malloc (sizeof (struct name_list) - + group_len); - if (namep == NULL) - /* We are out of memory. */ - status = NSS_STATUS_RETURN; - else + else if (status == NSS_STATUS_SUCCESS && datap->type == group_val) { - namep->next = datap->needed_groups; - memcpy (namep->name, datap->val.group, group_len); - datap->needed_groups = namep; - /* And get the next entry. */ - continue; + /* The last entry was a name of another netgroup. */ + struct name_list *namep; + + /* Ignore if we've seen the name before. */ + for (namep = datap->known_groups; namep != NULL; + namep = namep->next) + if (strcmp (datap->val.group, namep->name) == 0) + break; + if (namep == NULL) + for (namep = datap->needed_groups; namep != NULL; + namep = namep->next) + if (strcmp (datap->val.group, namep->name) == 0) + break; + if (namep != NULL) + /* Really ignore. */ + continue; + + size_t group_len = strlen (datap->val.group) + 1; + namep = (struct name_list *) malloc (sizeof (struct name_list) + + group_len); + if (namep == NULL) + /* We are out of memory. */ + status = NSS_STATUS_RETURN; + else + { + namep->next = datap->needed_groups; + memcpy (namep->name, datap->val.group, group_len); + datap->needed_groups = namep; + /* And get the next entry. */ + continue; + } } + break; } - - break; } if (status == NSS_STATUS_SUCCESS) @@ -371,7 +381,7 @@ __getnetgrent_r (char **hostp, char **userp, char **domainp, __libc_lock_lock (lock); status = __internal_getnetgrent_r (hostp, userp, domainp, &dataset, - buffer, buflen, &errno); + buffer, buflen, &errno); __libc_lock_unlock (lock); diff --git a/inet/getproto.c b/inet/getproto.c index ac9baaa592..32dcd13f70 100644 --- a/inet/getproto.c +++ b/inet/getproto.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/getproto_r.c b/inet/getproto_r.c index b966b3be35..7dc08a7ead 100644 --- a/inet/getproto_r.c +++ b/inet/getproto_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/getprtent.c b/inet/getprtent.c index d549493444..3c4f4e50c4 100644 --- a/inet/getprtent.c +++ b/inet/getprtent.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/getprtent_r.c b/inet/getprtent_r.c index 5a322b7a01..965e4b89db 100644 --- a/inet/getprtent_r.c +++ b/inet/getprtent_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/getprtname.c b/inet/getprtname.c index 4ed8a5d5cd..78a96dfffa 100644 --- a/inet/getprtname.c +++ b/inet/getprtname.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/getprtname_r.c b/inet/getprtname_r.c index fcea2ebd43..9512261eb4 100644 --- a/inet/getprtname_r.c +++ b/inet/getprtname_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/getrpcbyname.c b/inet/getrpcbyname.c deleted file mode 100644 index 30867500ed..0000000000 --- a/inet/getrpcbyname.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <rpc/netdb.h> - - -#define LOOKUP_TYPE struct rpcent -#define FUNCTION_NAME getrpcbyname -#define DATABASE_NAME rpc -#define ADD_PARAMS const char *name -#define ADD_VARIABLES name -#define BUFLEN 1024 - -/* There is no nscd support for the rpc file. */ -#undef USE_NSCD - -#include "../nss/getXXbyYY.c" diff --git a/inet/getrpcbyname_r.c b/inet/getrpcbyname_r.c deleted file mode 100644 index 59d0d5c4c4..0000000000 --- a/inet/getrpcbyname_r.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <rpc/netdb.h> - - -#define LOOKUP_TYPE struct rpcent -#define FUNCTION_NAME getrpcbyname -#define DATABASE_NAME rpc -#define ADD_PARAMS const char *name -#define ADD_VARIABLES name - -/* There is no nscd support for the rpc file. */ -#undef USE_NSCD - -#include "../nss/getXXbyYY_r.c" diff --git a/inet/getrpcbynumber.c b/inet/getrpcbynumber.c deleted file mode 100644 index 37be93c11e..0000000000 --- a/inet/getrpcbynumber.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <rpc/netdb.h> - - -#define LOOKUP_TYPE struct rpcent -#define FUNCTION_NAME getrpcbynumber -#define DATABASE_NAME rpc -#define ADD_PARAMS int number -#define ADD_VARIABLES number -#define BUFLEN 1024 - -/* There is no nscd support for the rpc file. */ -#undef USE_NSCD - -#include "../nss/getXXbyYY.c" diff --git a/inet/getrpcbynumber_r.c b/inet/getrpcbynumber_r.c deleted file mode 100644 index a0020679d8..0000000000 --- a/inet/getrpcbynumber_r.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <rpc/netdb.h> - - -#define LOOKUP_TYPE struct rpcent -#define FUNCTION_NAME getrpcbynumber -#define DATABASE_NAME rpc -#define ADD_PARAMS int number -#define ADD_VARIABLES number - -/* There is no nscd support for the rpc file. */ -#undef USE_NSCD - -#include "../nss/getXXbyYY_r.c" diff --git a/inet/getrpcent.c b/inet/getrpcent.c deleted file mode 100644 index 496944d6be..0000000000 --- a/inet/getrpcent.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <rpc/netdb.h> - - -#define LOOKUP_TYPE struct rpcent -#define GETFUNC_NAME getrpcent -#define BUFLEN 1024 - -/* There is no nscd support for the rpc file. */ -#undef USE_NSCD - -#include "../nss/getXXent.c" diff --git a/inet/getrpcent_r.c b/inet/getrpcent_r.c deleted file mode 100644 index ae56362320..0000000000 --- a/inet/getrpcent_r.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <netdb.h> - - -#define LOOKUP_TYPE struct rpcent -#define SETFUNC_NAME setrpcent -#define GETFUNC_NAME getrpcent -#define ENDFUNC_NAME endrpcent -#define DATABASE_NAME rpc -#define STAYOPEN int stayopen -#define STAYOPEN_VAR stayopen - -/* There is no nscd support for the rpc file. */ -#undef USE_NSCD - -#include "../nss/getXXent_r.c" diff --git a/inet/getservent.c b/inet/getservent.c index 6526547c34..1c24ba4612 100644 --- a/inet/getservent.c +++ b/inet/getservent.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/getservent_r.c b/inet/getservent_r.c index 90cda146d2..b315c8d1ec 100644 --- a/inet/getservent_r.c +++ b/inet/getservent_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/getsourcefilter.c b/inet/getsourcefilter.c index 5fae44ea43..1fb9dc7eef 100644 --- a/inet/getsourcefilter.c +++ b/inet/getsourcefilter.c @@ -1,5 +1,5 @@ /* Get source filter. Stub version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. + Copyright (C) 2004-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2004. diff --git a/inet/getsrvbynm.c b/inet/getsrvbynm.c index b863ef7180..c367c9eb32 100644 --- a/inet/getsrvbynm.c +++ b/inet/getsrvbynm.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/getsrvbynm_r.c b/inet/getsrvbynm_r.c index 0ee158b618..498539d2d3 100644 --- a/inet/getsrvbynm_r.c +++ b/inet/getsrvbynm_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/getsrvbypt.c b/inet/getsrvbypt.c index 5542fbb366..cde598622f 100644 --- a/inet/getsrvbypt.c +++ b/inet/getsrvbypt.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/getsrvbypt_r.c b/inet/getsrvbypt_r.c index ec380fd9b5..7cde45dd32 100644 --- a/inet/getsrvbypt_r.c +++ b/inet/getsrvbypt_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/inet/herrno-loc.c b/inet/herrno-loc.c index ca0677f976..bff195ca81 100644 --- a/inet/herrno-loc.c +++ b/inet/herrno-loc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/herrno.c b/inet/herrno.c index 3298b79255..672a91d407 100644 --- a/inet/herrno.c +++ b/inet/herrno.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2014 Free Software Foundation, Inc. +/* Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,7 +24,7 @@ /* We need to have the error status variable of the resolver accessible in the libc. */ -__thread int h_errno; -extern __thread int __libc_h_errno __attribute__ ((alias ("h_errno"))) +__thread int __h_errno; +extern __thread int __libc_h_errno __attribute__ ((alias ("__h_errno"))) attribute_hidden; #define h_errno __libc_h_errno diff --git a/inet/htonl.c b/inet/htonl.c index 3829e4f0cf..f70283a8ba 100644 --- a/inet/htonl.c +++ b/inet/htonl.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2014 Free Software Foundation, Inc. +/* Copyright (C) 1993-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,8 +22,7 @@ #undef ntohl uint32_t -htonl (x) - uint32_t x; +htonl (uint32_t x) { #if BYTE_ORDER == BIG_ENDIAN return x; diff --git a/inet/htons.c b/inet/htons.c index 6305996126..dd0186e426 100644 --- a/inet/htons.c +++ b/inet/htons.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2014 Free Software Foundation, Inc. +/* Copyright (C) 1993-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,8 +21,7 @@ #undef ntohs uint16_t -htons (x) - uint16_t x; +htons (uint16_t x) { #if BYTE_ORDER == BIG_ENDIAN return x; diff --git a/inet/htontest.c b/inet/htontest.c index d66e8bc1de..f99f0128b5 100644 --- a/inet/htontest.c +++ b/inet/htontest.c @@ -1,5 +1,5 @@ /* Test hton/ntoh functions. - Copyright (C) 1997-2014 Free Software Foundation, Inc. + Copyright (C) 1997-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/inet/if_index.c b/inet/if_index.c index 98b01d1ff4..73b1efe06f 100644 --- a/inet/if_index.c +++ b/inet/if_index.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2014 Free Software Foundation, Inc. +/* Copyright (C) 1997-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,35 +20,43 @@ #include <stddef.h> unsigned int -if_nametoindex (const char *ifname) +__if_nametoindex (const char *ifname) { __set_errno (ENOSYS); return 0; } -libc_hidden_def (if_nametoindex) +libc_hidden_def (__if_nametoindex) +weak_alias (__if_nametoindex, if_nametoindex) +libc_hidden_weak (if_nametoindex) stub_warning (if_nametoindex) char * -if_indextoname (unsigned int ifindex, char *ifname) +__if_indextoname (unsigned int ifindex, char *ifname) { __set_errno (ENOSYS); return NULL; } -libc_hidden_def (if_indextoname) +weak_alias (__if_indextoname, if_indextoname) +libc_hidden_weak (if_indextoname) stub_warning (if_indextoname) void -if_freenameindex (struct if_nameindex *ifn) +__if_freenameindex (struct if_nameindex *ifn) { } +libc_hidden_def (__if_freenameindex) +weak_alias (__if_freenameindex, if_freenameindex) +libc_hidden_weak (if_freenameindex) stub_warning (if_freenameindex) struct if_nameindex * -if_nameindex (void) +__if_nameindex (void) { __set_errno (ENOSYS); return NULL; } +weak_alias (__if_nameindex, if_nameindex) +libc_hidden_weak (if_nameindex) stub_warning (if_nameindex) #if 0 diff --git a/inet/ifaddrs.c b/inet/ifaddrs.c index 8071600949..3b4780406d 100644 --- a/inet/ifaddrs.c +++ b/inet/ifaddrs.c @@ -1,5 +1,5 @@ /* getifaddrs -- get names and addresses of all network interfaces - Copyright (C) 2002-2014 Free Software Foundation, Inc. + Copyright (C) 2002-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,16 +24,17 @@ network interface on the host machine. If successful, store the list in *IFAP and return 0. On errors, return -1 and set `errno'. */ int -getifaddrs (struct ifaddrs **ifap) +__getifaddrs (struct ifaddrs **ifap) { __set_errno (ENOSYS); return -1; } -libc_hidden_def (getifaddrs) +weak_alias (__getifaddrs, getifaddrs) +libc_hidden_weak (getifaddrs) stub_warning (getifaddrs) void -freeifaddrs (struct ifaddrs *ifa) +__freeifaddrs (struct ifaddrs *ifa) { if (ifa == NULL) return; /* a la free, why not? */ @@ -41,5 +42,6 @@ freeifaddrs (struct ifaddrs *ifa) /* Can't be called properly if getifaddrs never succeeded. */ abort (); } -libc_hidden_def (freeifaddrs) +weak_alias (__freeifaddrs, freeifaddrs) +libc_hidden_weak (freeifaddrs) stub_warning (freeifaddrs) diff --git a/inet/ifaddrs.h b/inet/ifaddrs.h index e555102e9e..222a0a1b67 100644 --- a/inet/ifaddrs.h +++ b/inet/ifaddrs.h @@ -1,5 +1,5 @@ /* ifaddrs.h -- declarations for getting network interface addresses - Copyright (C) 2002-2014 Free Software Foundation, Inc. + Copyright (C) 2002-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/ifreq.c b/inet/ifreq.c index 12da48af1e..398e4459bb 100644 --- a/inet/ifreq.c +++ b/inet/ifreq.c @@ -1,5 +1,5 @@ /* Collect network interface list. Stub version. - Copyright (C) 2013-2014 Free Software Foundation, Inc. + Copyright (C) 2013-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/in6_addr.c b/inet/in6_addr.c index 519ca76564..fb7729001d 100644 --- a/inet/in6_addr.c +++ b/inet/in6_addr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2014 Free Software Foundation, Inc. +/* Copyright (C) 1997-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997. @@ -18,9 +18,13 @@ #include <netinet/in.h> -const struct in6_addr in6addr_any = +const struct in6_addr __in6addr_any = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; -libc_hidden_data_def (in6addr_any) -const struct in6_addr in6addr_loopback = +libc_hidden_data_def (__in6addr_any) +weak_alias (__in6addr_any, in6addr_any) +libc_hidden_data_weak (in6addr_any) +const struct in6_addr __in6addr_loopback = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }; -libc_hidden_data_def (in6addr_loopback) +libc_hidden_data_def (__in6addr_loopback) +weak_alias (__in6addr_loopback, in6addr_loopback) +libc_hidden_data_weak (in6addr_loopback) diff --git a/inet/inet6_opt.c b/inet/inet6_opt.c index a215889b5e..9a6bb0ab71 100644 --- a/inet/inet6_opt.c +++ b/inet/inet6_opt.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2006-2014 Free Software Foundation, Inc. +/* Copyright (C) 2006-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2006. diff --git a/inet/inet6_option.c b/inet/inet6_option.c index a828697a9c..47ca82ffdc 100644 --- a/inet/inet6_option.c +++ b/inet/inet6_option.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003-2014 Free Software Foundation, Inc. +/* Copyright (C) 2003-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -190,7 +190,7 @@ option_alloc (struct cmsghdr *cmsg, int datalen, int multx, int plusy) int dsize = cmsg->cmsg_len - CMSG_LEN (0); /* The first two bytes of the option are for the extended header. */ - if (__builtin_expect (dsize == 0, 0)) + if (__glibc_unlikely (dsize == 0)) { cmsg->cmsg_len += sizeof (struct ip6_ext); dsize = sizeof (struct ip6_ext); diff --git a/inet/inet6_rth.c b/inet/inet6_rth.c index 18c6750843..4094b7d75e 100644 --- a/inet/inet6_rth.c +++ b/inet/inet6_rth.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2006-2014 Free Software Foundation, Inc. +/* Copyright (C) 2006-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2006. diff --git a/inet/inet_mkadr.c b/inet/inet_mkadr.c index d8d92da768..580a9cd956 100644 --- a/inet/inet_mkadr.c +++ b/inet/inet_mkadr.c @@ -40,7 +40,7 @@ static char sccsid[] = "@(#)inet_makeaddr.c 8.1 (Berkeley) 6/4/93"; * building addresses stored in the ifnet structure. */ struct in_addr -inet_makeaddr(net, host) +__inet_makeaddr(net, host) in_addr_t net, host; { struct in_addr in; @@ -56,4 +56,5 @@ inet_makeaddr(net, host) in.s_addr = htonl(in.s_addr); return in; } -libc_hidden_def (inet_makeaddr) +libc_hidden_def (__inet_makeaddr) +weak_alias (__inet_makeaddr, inet_makeaddr) diff --git a/inet/inet_net.c b/inet/inet_net.c index 9fdd4bff1b..b28fdb1190 100644 --- a/inet/inet_net.c +++ b/inet/inet_net.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. */ -/* Copyright (C) 2013-2014 Free Software Foundation, Inc. +/* Copyright (C) 2013-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/inet_ntoa.c b/inet/inet_ntoa.c index 9fe8e9113f..306e12f480 100644 --- a/inet/inet_ntoa.c +++ b/inet/inet_ntoa.c @@ -1,5 +1,5 @@ /* Convert Inet number to ASCII representation. - Copyright (C) 1997-2014 Free Software Foundation, Inc. + Copyright (C) 1997-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. diff --git a/inet/netgroup.h b/inet/netgroup.h index 490004589d..3022f5a6b4 100644 --- a/inet/netgroup.h +++ b/inet/netgroup.h @@ -1,5 +1,5 @@ /* Internal header for netgroup related functions. - Copyright (C) 1996-2014 Free Software Foundation, Inc. + Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,7 +26,7 @@ struct name_list { struct name_list *next; - char name[0]; + char name[]; }; diff --git a/inet/netinet/ether.h b/inet/netinet/ether.h index 4d78f76469..f0e382143e 100644 --- a/inet/netinet/ether.h +++ b/inet/netinet/ether.h @@ -1,5 +1,5 @@ /* Functions for storing Ethernet addresses in ASCII and mapping to hostnames. - Copyright (C) 1996-2014 Free Software Foundation, Inc. + Copyright (C) 1996-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/netinet/icmp6.h b/inet/netinet/icmp6.h index baaeb267ed..dfdf4bb8d7 100644 --- a/inet/netinet/icmp6.h +++ b/inet/netinet/icmp6.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2014 Free Software Foundation, Inc. +/* Copyright (C) 1991-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/netinet/igmp.h b/inet/netinet/igmp.h index c12552cd13..55988f9ca0 100644 --- a/inet/netinet/igmp.h +++ b/inet/netinet/igmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2014 Free Software Foundation, Inc. +/* Copyright (C) 1997-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,7 +21,7 @@ #include <sys/cdefs.h> #include <sys/types.h> -#ifdef __USE_BSD +#ifdef __USE_MISC #include <netinet/in.h> diff --git a/inet/netinet/in.h b/inet/netinet/in.h index d8d8e53631..f541c5809d 100644 --- a/inet/netinet/in.h +++ b/inet/netinet/in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2014 Free Software Foundation, Inc. +/* Copyright (C) 1991-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -211,13 +211,13 @@ struct in6_addr union { uint8_t __u6_addr8[16]; -#if defined __USE_MISC || defined __USE_GNU +#ifdef __USE_MISC uint16_t __u6_addr16[8]; uint32_t __u6_addr32[4]; #endif } __in6_u; #define s6_addr __in6_u.__u6_addr8 -#if defined __USE_MISC || defined __USE_GNU +#ifdef __USE_MISC # define s6_addr16 __in6_u.__u6_addr16 # define s6_addr32 __in6_u.__u6_addr32 #endif @@ -259,7 +259,7 @@ struct sockaddr_in6 }; #endif /* !__USE_KERNEL_IPV6_DEFS */ -#if defined __USE_MISC || defined __USE_GNU +#ifdef __USE_MISC /* IPv4 multicast request. */ struct ip_mreq { @@ -295,7 +295,7 @@ struct ipv6_mreq }; #endif /* !__USE_KERNEL_IPV6_DEFS */ -#if defined __USE_MISC || defined __USE_GNU +#ifdef __USE_MISC /* Multicast group request. */ struct group_req { @@ -496,7 +496,7 @@ extern uint16_t htons (uint16_t __hostshort) #define IN6_IS_ADDR_MULTICAST(a) (((const uint8_t *) (a))[0] == 0xff) -#if defined __USE_MISC || defined __USE_GNU +#ifdef __USE_MISC /* Bind socket to a privileged IP port. */ extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW; @@ -530,6 +530,7 @@ extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in) #ifdef __USE_GNU struct cmsghdr; /* Forward declaration. */ +#ifndef __USE_KERNEL_IPV6_DEFS /* IPv6 packet information. */ struct in6_pktinfo { @@ -543,7 +544,7 @@ struct ip6_mtuinfo struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */ uint32_t ip6m_mtu; /* path MTU in host byte order */ }; - +#endif /* !__USE_KERNEL_IPV6_DEFS */ /* Obsolete hop-by-hop and Destination Options Processing (RFC 2292). */ extern int inet6_option_space (int __nbytes) diff --git a/inet/netinet/ip6.h b/inet/netinet/ip6.h index 3cebf9fb90..30f7e74648 100644 --- a/inet/netinet/ip6.h +++ b/inet/netinet/ip6.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2014 Free Software Foundation, Inc. +/* Copyright (C) 1991-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/rcmd.c b/inet/rcmd.c index acacaa0d8a..035cb0d87d 100644 --- a/inet/rcmd.c +++ b/inet/rcmd.c @@ -114,10 +114,10 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) struct addrinfo hints, *res, *ai; union { - struct sockaddr sa; - struct sockaddr_storage ss; - struct sockaddr_in sin; - struct sockaddr_in6 sin6; + struct sockaddr sa; + struct sockaddr_storage ss; + struct sockaddr_in sin; + struct sockaddr_in6 sin6; } from; struct pollfd pfd[2]; int32_t oldmask; @@ -374,7 +374,11 @@ rresvport_af(alport, family) int *alport; sa_family_t family; { - struct sockaddr_storage ss; + union { + struct sockaddr generic; + struct sockaddr_in in; + struct sockaddr_in6 in6; + } ss; int s; size_t len; uint16_t *sport; @@ -382,11 +386,11 @@ rresvport_af(alport, family) switch(family){ case AF_INET: len = sizeof(struct sockaddr_in); - sport = &((struct sockaddr_in *)&ss)->sin_port; + sport = &ss.in.sin_port; break; case AF_INET6: len = sizeof(struct sockaddr_in6); - sport = &((struct sockaddr_in6 *)&ss)->sin6_port; + sport = &ss.in6.sin6_port; break; default: __set_errno (EAFNOSUPPORT); @@ -398,9 +402,9 @@ rresvport_af(alport, family) memset (&ss, '\0', sizeof(ss)); #ifdef SALEN - ss.__ss_len = len; + ss.generic.__ss_len = len; #endif - ss.ss_family = family; + ss.generic.sa_family = family; /* Ignore invalid values. */ if (*alport < IPPORT_RESERVED / 2) @@ -411,7 +415,7 @@ rresvport_af(alport, family) int start = *alport; do { *sport = htons((uint16_t) *alport); - if (__bind(s, (struct sockaddr *)&ss, len) >= 0) + if (__bind(s, &ss.generic, len) >= 0) return s; if (errno != EADDRINUSE) { (void)__close(s); @@ -604,27 +608,29 @@ iruserok_af (raddr, superuser, ruser, luser, af) const char *ruser, *luser; sa_family_t af; { - struct sockaddr_storage ra; + union { + struct sockaddr generic; + struct sockaddr_in in; + struct sockaddr_in6 in6; + } ra; size_t ralen; memset (&ra, '\0', sizeof(ra)); switch (af){ case AF_INET: - ra.ss_family = AF_INET; - memcpy (&(((struct sockaddr_in *)&ra)->sin_addr), raddr, - sizeof(struct in_addr)); + ra.in.sin_family = AF_INET; + memcpy (&ra.in.sin_addr, raddr, sizeof(struct in_addr)); ralen = sizeof(struct sockaddr_in); break; case AF_INET6: - ra.ss_family = AF_INET6; - memcpy (&(((struct sockaddr_in6 *)&ra)->sin6_addr), raddr, - sizeof(struct in6_addr)); + ra.in6.sin6_family = AF_INET6; + memcpy (&ra.in6.sin6_addr, raddr, sizeof(struct in6_addr)); ralen = sizeof(struct sockaddr_in6); break; default: return 0; } - return ruserok_sa ((struct sockaddr *)&ra, ralen, superuser, ruser, luser); + return ruserok_sa (&ra.generic, ralen, superuser, ruser, luser); } libc_hidden_def (iruserok_af) @@ -803,31 +809,43 @@ __validuser2_sa(hostf, ra, ralen, luser, ruser, rhost) *p = '\0'; /* <nul> terminate username (+host?) */ /* buf -> host(?) ; user -> username(?) */ + if (*buf == '\0') + break; + if (*user == '\0') + user = luser; + + /* First check the user part. In a naive implementation we + would check the host part first, then the user. However, + if we check the user first and reject the entry we will + have saved doing any host lookups to normalize the comparison + and that likely saves several DNS queries. Therefore we + check the user first. */ + ucheck = __icheckuser (user, ruser); + + /* Either we found the user, or we didn't and this is a + negative host check. We must do the negative host lookup + in order to preserve the semantics of stopping on this line + before processing others. */ + if (ucheck != 0 || *buf == '-') { + + /* Next check host part. */ + hcheck = __checkhost_sa (ra, ralen, buf, rhost); + + /* Negative '-host user(?)' match? */ + if (hcheck < 0) + break; - /* First check host part */ - hcheck = __checkhost_sa (ra, ralen, buf, rhost); - - if (hcheck < 0) - break; - - if (hcheck) { - /* Then check user part */ - if (! (*user)) - user = luser; - - ucheck = __icheckuser (user, ruser); - - /* Positive 'host user' match? */ - if (ucheck > 0) { + /* Positive 'host user' match? */ + if (hcheck > 0 && ucheck > 0) { retval = 0; break; } - /* Negative 'host -user' match? */ - if (ucheck < 0) - break; + /* Negative 'host -user' match? */ + if (hcheck > 0 && ucheck < 0) + break; - /* Neither, go on looking for match */ + /* Neither, go on looking for match. */ } } diff --git a/inet/setipv4sourcefilter.c b/inet/setipv4sourcefilter.c index 0d8fbbef4f..1bcc728840 100644 --- a/inet/setipv4sourcefilter.c +++ b/inet/setipv4sourcefilter.c @@ -1,5 +1,5 @@ /* Set source filter. Stub version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. + Copyright (C) 2004-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2004. diff --git a/inet/setsourcefilter.c b/inet/setsourcefilter.c index e5c87b95b7..4a2749b8c0 100644 --- a/inet/setsourcefilter.c +++ b/inet/setsourcefilter.c @@ -1,5 +1,5 @@ /* Set source filter. Stub version. - Copyright (C) 2004-2014 Free Software Foundation, Inc. + Copyright (C) 2004-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2004. diff --git a/inet/test-ifaddrs.c b/inet/test-ifaddrs.c index 6220be35c3..6e6c01570f 100644 --- a/inet/test-ifaddrs.c +++ b/inet/test-ifaddrs.c @@ -1,5 +1,5 @@ /* Test listing of network interface addresses. - Copyright (C) 2002-2014 Free Software Foundation, Inc. + Copyright (C) 2002-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/inet/test-inet6_opt.c b/inet/test-inet6_opt.c index 3bf319ef0c..a7ebf006c6 100644 --- a/inet/test-inet6_opt.c +++ b/inet/test-inet6_opt.c @@ -194,8 +194,8 @@ decode_inet6_opt (void *eb, socklen_t el) return ret; } -int -main (void) +static int +do_test (void) { void *eb; socklen_t el; @@ -206,3 +206,6 @@ main (void) return 1; return 0; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/inet/test_ifindex.c b/inet/test_ifindex.c index fc81848415..ef4dbc4334 100644 --- a/inet/test_ifindex.c +++ b/inet/test_ifindex.c @@ -1,5 +1,5 @@ /* Test interface name <-> index conversions. - Copyright (C) 1997-2014 Free Software Foundation, Inc. + Copyright (C) 1997-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Philip Blundell <Philip.Blundell@pobox.com>. diff --git a/inet/tst-gethnm.c b/inet/tst-gethnm.c index 8af44d66a1..dd3a547811 100644 --- a/inet/tst-gethnm.c +++ b/inet/tst-gethnm.c @@ -10,8 +10,8 @@ #include <netinet/in.h> #include <arpa/inet.h> -int -main (void) +static int +do_test (void) { struct hostent *ent; struct in_addr hostaddr; @@ -62,3 +62,6 @@ main (void) return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/inet/tst-network.c b/inet/tst-network.c index fc90bd7245..71d49c2807 100644 --- a/inet/tst-network.c +++ b/inet/tst-network.c @@ -1,5 +1,5 @@ /* Test for inet_network. - Copyright (C) 2000-2014 Free Software Foundation, Inc. + Copyright (C) 2000-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>, 2000. @@ -51,8 +51,8 @@ struct }; -int -main (void) +static int +do_test (void) { int errors = 0; size_t i; @@ -76,3 +76,6 @@ main (void) return errors != 0; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/inet/tst-ntoa.c b/inet/tst-ntoa.c index 9be91eb511..ef82d4d537 100644 --- a/inet/tst-ntoa.c +++ b/inet/tst-ntoa.c @@ -22,8 +22,8 @@ test (unsigned int inaddr, const char *expected) } -int -main (void) +static int +do_test (void) { int result = 0; @@ -34,3 +34,6 @@ main (void) return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" |