From 2774ea772499f5779e846646824784a44377c69a Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 31 May 2006 15:10:35 +0000 Subject: Updated to fedora-glibc-20060531T1322 --- ChangeLog | 72 ++++ NEWS | 7 +- elf/dl-addr.c | 3 +- fedora/branch.mk | 4 +- fedora/glibc.spec.in | 54 ++- include/netinet/in.h | 1 - inet/Makefile | 4 +- inet/Versions | 6 + inet/inet6_opt.c | 278 +++++++++++++++ inet/inet6_option.c | 26 +- inet/inet6_rth.c | 192 +++++++++++ inet/netinet/icmp6.h | 30 +- inet/netinet/in.h | 61 +++- inet/netinet/ip6.h | 21 +- localedata/ChangeLog | 7 + localedata/SUPPORTED | 2 + localedata/locales/as_IN | 728 +++++++++++++++++++++++++++++++++++++++ localedata/locales/or_IN | 807 ++++++++++++++++++++++++++++++++++++++++++++ nis/nis_addmember.c | 30 +- nis/nis_callback.c | 3 +- nis/nis_removemember.c | 80 ++--- nscd/cache.c | 37 +- nscd/connections.c | 29 +- nscd/nscd.c | 30 +- nscd/nscd.h | 3 +- sysdeps/posix/getaddrinfo.c | 3 +- 26 files changed, 2377 insertions(+), 141 deletions(-) create mode 100644 inet/inet6_opt.c create mode 100644 inet/inet6_rth.c create mode 100644 localedata/locales/as_IN create mode 100644 localedata/locales/or_IN diff --git a/ChangeLog b/ChangeLog index 3de745cf0d..0fca57dc90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,75 @@ +2006-05-30 Jakub Jelinek + + * nscd/nscd.h (prune_cache): Add fd argument to prototype. + * nscd/nscd.c (parse_opt): Read response from INVALIDATE request + to make sure the database has been already invalidated. + * nscd/cache.c (prune_cache): Add fd argument. Write response to fd + after the cache has been invalidated. Use pthread_mutex_lock rather + than pthread_mutex_trylock if fd != -1. + * nscd/connections.c (invalidate_cache): Add fd argument, write + response to fd if not calling prune_cache, pass fd to prune_cache. + (handle_request): Adjust invalidate_cache caller. + (nscd_run): Pass -1 as fd to prune_cache. + +2006-05-30 Ulrich Drepper + + * sysdeps/posix/getaddrinfo.c (gaiconf_init): Initialize bits in + the correct place. + +2006-05-29 Ulrich Drepper + + * nscd/nscd.h (struct database_dyn): Add prunelock field. + * nscd/cache.c (prune_cache): Take prunelock before starting the + work. Just return in case it is already taken. + * nscd/connections.c (dbs): Initialize .prunelock. + +2006-05-25 Ulrich Drepper + + * nis/nis_removemember.c (nis_removemember): Avoid unnecessary + copying. No need to allocate new array for group members. Just + move the pointers and update the size. + + * nis/nis_addmember.c (nis_addmember): Avoid unnecessary copying. + Avoid memory leak in case realloc fails. Simplification for + better code generation. + + Avoid deprecation warning because of libc_hidden_proto for + inet6_option_alloc. + * inet/inet6_option.c (option_alloc): Renamed from + inet6_option_alloc. Made static. + (inet6_option_alloc): Now a simple wrapper around option_alloc. + (inet6_option_append): Call option_alloc. + * include/netinet/in.h: Remove libc_hidden_proto for + inet6_option_alloc. + + * nis/nis_callback.c (__nis_create_callback): Always call xdr_free + for cleanup when cb!=NULL [Coverity CID 233]. + +2006-05-24 Ulrich Drepper + + [BZ #2693] + * inet/Makefile (routines): Add inet6_opt and inet6_rth. + * inet/Versions (libc, GLIBC_2.5): Add inet6_opt_init, + inet6_opt_append, inet6_opt_finish, inet6_opt_set_val, inet6_opt_next, + inet6_opt_find, inet6_opt_get_val, inet6_rth_space, inet6_rth_init, + inet6_rth_add, inet6_rth_reverse, inet6_rth_segments, + and inet6_rth_getaddr. + * inet/netinet/ip6.h (struct ip6_rthdr0): Make ip6r0_addr a flexible + array. + * inet/netinet/in.h (struct ip6_mtuinfo): Define. + Mark inet6_option_* interfaces as deprecated. + Declare inet6_opt_init, inet6_opt_append, inet6_opt_finish, + inet6_opt_set_val, inet6_opt_next, inet6_opt_find, inet6_opt_get_val, + inet6_rth_space, inet6_rth_init, inet6_rth_add, inet6_rth_reverse, + inet6_rth_segments, and inet6_rth_getaddr. + * inet/inet6_opt.c: New file. + * inet/inet6_rth.c: New file. + + * inet/netinet/icmp6.h: Pretty printing. + + [BZ #2683] + * elf/dl-addr.c (_dl_addr): Don't match undefined references. + 2006-05-23 Ulrich Drepper * nis/nis_lookup.c (nis_lookup): Use __prepare_niscall instead of diff --git a/NEWS b/NEWS index 006aa2989f..edc576e096 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -GNU C Library NEWS -- history of user-visible changes. 2006-05-07 +GNU C Library NEWS -- history of user-visible changes. 2006-05-24 Copyright (C) 1992-2002,2003,2004,2005,2006 Free Software Foundation, Inc. See the end for copying conditions. @@ -23,11 +23,14 @@ Version 2.5 site might have problems with default behavior. Implemented by Ulrich Drepper. -* Iterating over entire database in NIS and NIS+ can be slow. With the +* Iterating over entire database in NIS can be slow. With the SETENT_BATCH_READ option in /etc/default/nss a system admin can decide to trade time for memory. The entire database will be read at once. Implemented by Ulrich Drepper. +* The interfaces introduced in RFC 3542 have been implemented by + Ulrich Drepper. + Version 2.4 diff --git a/elf/dl-addr.c b/elf/dl-addr.c index fa62e40840..ced8978eb3 100644 --- a/elf/dl-addr.c +++ b/elf/dl-addr.c @@ -1,5 +1,5 @@ /* Locate the shared object symbol nearest a given address. - Copyright (C) 1996-2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1996-2004, 2005, 2006 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 @@ -92,6 +92,7 @@ _dl_addr (const void *address, Dl_info *info, #if defined USE_TLS && ELFW(ST_TYPE) (symtab->st_info) != STT_TLS #endif + && symtab->st_shndx != SHN_UNDEF && DL_ADDR_SYM_MATCH (match, symtab, matchsym, addr) && symtab->st_name < strtabsize) matchsym = (ElfW(Sym) *) symtab; diff --git a/fedora/branch.mk b/fedora/branch.mk index 773fe3e523..93d7c4f3d8 100644 --- a/fedora/branch.mk +++ b/fedora/branch.mk @@ -3,5 +3,5 @@ glibc-branch := fedora glibc-base := HEAD DIST_BRANCH := devel COLLECTION := dist-fc4 -fedora-sync-date := 2006-05-24 07:21 UTC -fedora-sync-tag := fedora-glibc-20060524T0721 +fedora-sync-date := 2006-05-31 13:22 UTC +fedora-sync-tag := fedora-glibc-20060531T1322 diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in index 0360f5dd66..58760fec40 100644 --- a/fedora/glibc.spec.in +++ b/fedora/glibc.spec.in @@ -1,4 +1,4 @@ -%define glibcrelease 10 +%define glibcrelease 11 %define auxarches i586 i686 athlon sparcv9 alphaev6 %define prelinkarches noarch %define xenarches i686 athlon @@ -326,6 +326,9 @@ cat > override_headers/asm/unistd.h < override_headers/asm/unistd.h < override_headers/asm/unistd.h < override_headers/asm/unistd.h < override_headers/asm/unistd.h < 2.4.90-11 +- don't exit from nscd -i before the database is + actually invalidated, add locking to prune_cache (#191464) +- build glibc-devel.i386 static libraries with + -mno-tls-direct-seg-refs -DNO_TLS_DIRECT_SEG_REFS +- RFC3542 support (advanced API for IPv6; #191001, BZ##2693) + * Wed May 24 2006 Jakub Jelinek 2.4.90-10 - on i686 make glibc owner of /lib/i686 directory (#192597) - search parent NIS+ domains (#190803) diff --git a/include/netinet/in.h b/include/netinet/in.h index 2018ed21c3..876f1a4369 100644 --- a/include/netinet/in.h +++ b/include/netinet/in.h @@ -5,6 +5,5 @@ libc_hidden_proto (bindresvport) libc_hidden_proto (in6addr_loopback) libc_hidden_proto (in6addr_any) -libc_hidden_proto (inet6_option_alloc) #endif diff --git a/inet/Makefile b/inet/Makefile index 0fdf9e33e4..075716fbeb 100644 --- a/inet/Makefile +++ b/inet/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1991-2002, 2003, 2004, 2006 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 @@ -47,7 +47,7 @@ routines := htonl htons \ getaliasent_r getaliasent getaliasname getaliasname_r \ in6_addr getnameinfo if_index ifaddrs inet6_option \ getipv4sourcefilter setipv4sourcefilter \ - getsourcefilter setsourcefilter + getsourcefilter setsourcefilter inet6_opt inet6_rth aux := check_pf ifreq diff --git a/inet/Versions b/inet/Versions index 2b7ec901ff..06507199a9 100644 --- a/inet/Versions +++ b/inet/Versions @@ -78,6 +78,12 @@ libc { getipv4sourcefilter; setipv4sourcefilter; getsourcefilter; setsourcefilter; } + GLIBC_2.5 { + inet6_opt_init; inet6_opt_append; inet6_opt_finish; inet6_opt_set_val; + inet6_opt_next; inet6_opt_find; inet6_opt_get_val; + inet6_rth_space; inet6_rth_init; inet6_rth_add; inet6_rth_reverse; + inet6_rth_segments; inet6_rth_getaddr; + } GLIBC_PRIVATE { # functions used in other libraries __internal_endnetgrent; __internal_getnetgrent_r; diff --git a/inet/inet6_opt.c b/inet/inet6_opt.c new file mode 100644 index 0000000000..bddb85182b --- /dev/null +++ b/inet/inet6_opt.c @@ -0,0 +1,278 @@ +/* Copyright (C) 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2006. + + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + + +/* RFC 3542, 10.1 + + This function returns the number of bytes needed for the empty + extension header i.e., without any options. If EXTBUF is not NULL it + also initializes the extension header to have the correct length + field. In that case if the EXTLEN value is not a positive (i.e., + non-zero) multiple of 8 the function fails and returns -1. */ +int +inet6_opt_init (void *extbuf, socklen_t extlen) +{ + if (extbuf != NULL) + { + if (extlen <= 0 || (extlen % 8) != 0) + return -1; + + /* Fill in the length in units of 8 octets. */ + struct ip6_hbh *extp = (struct ip6_hbh *) extbuf; + extp->ip6h_len = extlen / 8; + } + + return sizeof (struct ip6_hbh); +} + + +static void +add_padding (uint8_t *extbuf, int offset, int npad) +{ + if (npad == 1) + extbuf[offset] = IP6OPT_PAD1; + else + { + struct ip6_opt *pad_opt = (struct ip6_opt *) (extbuf + offset); + + pad_opt->ip6o_type = IP6OPT_PADN; + pad_opt->ip6o_len = npad - sizeof (struct ip6_opt); + /* Clear the memory used by the padding. */ + memset (pad_opt + 1, '\0', pad_opt->ip6o_len); + } +} + + + +/* RFC 3542, 10.2 + + This function returns the updated total length taking into account + adding an option with length 'len' and alignment 'align'. If + EXTBUF is not NULL then, in addition to returning the length, the + function inserts any needed pad option, initializes the option + (setting the type and length fields) and returns a pointer to the + location for the option content in databufp. If the option does + not fit in the extension header buffer the function returns -1. */ +int +inet6_opt_append (void *extbuf, socklen_t extlen, int offset, uint8_t type, + socklen_t len, uint8_t align, void **databufp) +{ + /* Check minimum offset. */ + if (offset < sizeof (struct ip6_hbh)) + return -1; + + /* One cannot add padding options. */ + if (type == IP6OPT_PAD1 || type == IP6OPT_PADN) + return -1; + + /* The option length must fit in one octet. */ + if (len > 255) + return -1; + + /* The alignment can only by 1, 2, 4, or 8 and must not exceed the + option length. */ + if (align == 0 || align > 8 || (align & (align - 1)) != 0 || align > len) + return -1; + + /* Determine the needed padding for alignment. Following the + current content of the buffer we have the is the IPv6 option type + and length, followed immediately by the data. The data has the + alignment constraints. Therefore padding must be inserted in the + form of padding options before the new option. */ + int data_offset = offset + sizeof (struct ip6_opt); + int npad = (align - data_offset % align) & (align - 1); + + /* Now we can check whether the buffer is large enough. */ + if (data_offset + npad + len > extlen) + return -1; + + if (npad != 0) + { + if (extbuf != NULL) + add_padding (extbuf, offset, npad); + + offset += npad; + } + + /* Now prepare the option itself. */ + if (extbuf != NULL) + { + struct ip6_opt *opt = (struct ip6_opt *) ((uint8_t *) extbuf + offset); + + opt->ip6o_type = type; + opt->ip6o_len = len; + + *databufp = opt + 1; + } + + return offset + sizeof (struct ip6_opt) + len; +} + + +/* RFC 3542, 10.3 + + This function returns the updated total length taking into account + the final padding of the extension header to make it a multiple of + 8 bytes. If EXTBUF is not NULL the function also initializes the + option by inserting a Pad1 or PadN option of the proper length. */ +int +inet6_opt_finish (void *extbuf, socklen_t extlen, int offset) +{ + /* Check minimum offset. */ + if (offset < sizeof (struct ip6_hbh)) + return -1; + + /* Required padding at the end. */ + int npad = (8 - (offset & 7)) & 7; + + /* Make sure the buffer is large enough. */ + if (offset + npad > extlen) + return -1; + + if (extbuf != NULL) + add_padding (extbuf, offset, npad); + + return offset + npad; +} + + +/* RFC 3542, 10.4 + + This function inserts data items of various sizes in the data + portion of the option. VAL should point to the data to be + inserted. OFFSET specifies where in the data portion of the option + the value should be inserted; the first byte after the option type + and length is accessed by specifying an offset of zero. */ +int +inet6_opt_set_val (void *databuf, int offset, void *val, socklen_t vallen) +{ + memcpy ((uint8_t *) databuf + offset, val, vallen); + + return offset + vallen; +} + + +/* RFC 3542, 10.5 + + This function parses received option extension headers returning + the next option. EXTBUF and EXTLEN specifies the extension header. + OFFSET should either be zero (for the first option) or the length + returned by a previous call to 'inet6_opt_next' or + 'inet6_opt_find'. It specifies the position where to continue + scanning the extension buffer. */ +int +inet6_opt_next (void *extbuf, socklen_t extlen, int offset, uint8_t *typep, + socklen_t *lenp, void **databufp) +{ + if (offset == 0) + offset = sizeof (struct ip6_hbh); + else if (offset < sizeof (struct ip6_hbh)) + return -1; + + while (offset < extlen) + { + struct ip6_opt *opt = (struct ip6_opt *) ((uint8_t *) extbuf + offset); + + if (opt->ip6o_type == IP6OPT_PAD1) + /* Single byte padding. */ + ++offset; + else if (opt->ip6o_type == IP6OPT_PADN) + offset += sizeof (struct ip6_opt) + opt->ip6o_len; + else + { + /* Check whether the option is valid. */ + offset += sizeof (struct ip6_opt) + opt->ip6o_len; + if (offset > extlen) + return -1; + + *typep = opt->ip6o_type; + *lenp = opt->ip6o_len; + *databufp = opt + 1; + return offset; + } + } + + return -1; +} + + +/* RFC 3542, 10.6 + + This function is similar to the previously described + 'inet6_opt_next' function, except this function lets the caller + specify the option type to be searched for, instead of always + returning the next option in the extension header. */ +int +inet6_opt_find (void *extbuf, socklen_t extlen, int offset, uint8_t type, + socklen_t *lenp, void **databufp) +{ + if (offset == 0) + offset = sizeof (struct ip6_hbh); + else if (offset < sizeof (struct ip6_hbh)) + return -1; + + while (offset < extlen) + { + struct ip6_opt *opt = (struct ip6_opt *) ((uint8_t *) extbuf + offset); + + if (opt->ip6o_type == IP6OPT_PAD1) + { + /* Single byte padding. */ + ++offset; + if (type == IP6OPT_PAD1) + { + *lenp = 0; + *databufp = (uint8_t *) extbuf + offset; + return offset; + } + } + else if (opt->ip6o_type != type) + offset += sizeof (struct ip6_opt) + opt->ip6o_len; + else + { + /* Check whether the option is valid. */ + offset += sizeof (struct ip6_opt) + opt->ip6o_len; + if (offset > extlen) + return -1; + + *lenp = opt->ip6o_len; + *databufp = opt + 1; + return offset; + } + } + + return -1; +} + + +/* RFC 3542, 10.7 + + This function extracts data items of various sizes in the data + portion of the option. */ +int +inet6_opt_get_val (void *databuf, int offset, void *val, socklen_t vallen) +{ + memcpy (val, (uint8_t *) databuf + offset, vallen); + + return offset + vallen; +} diff --git a/inet/inet6_option.c b/inet/inet6_option.c index f88982e323..cae9ae5797 100644 --- a/inet/inet6_option.c +++ b/inet/inet6_option.c @@ -75,6 +75,10 @@ get_opt_end (const uint8_t **result, const uint8_t *startp, } +static uint8_t *option_alloc (struct cmsghdr *cmsg, int datalen, int multx, + int plusy); + + /* RFC 2292, 6.3.1 This function returns the number of bytes required to hold an option @@ -150,7 +154,7 @@ inet6_option_append (cmsg, typep, multx, plusy) int len = typep[0] == IP6OPT_PAD1 ? 1 : typep[1] + 2; /* Get the pointer to the space in the message. */ - uint8_t *ptr = inet6_option_alloc (cmsg, len, multx, plusy); + uint8_t *ptr = option_alloc (cmsg, len, multx, plusy); if (ptr == NULL) /* Some problem with the parameters. */ return -1; @@ -169,12 +173,8 @@ inet6_option_append (cmsg, typep, multx, plusy) inet6_option_init(). This function returns a pointer to the 8-bit option type field that starts the option on success, or NULL on an error. */ -uint8_t * -inet6_option_alloc (cmsg, datalen, multx, plusy) - struct cmsghdr *cmsg; - int datalen; - int multx; - int plusy; +static uint8_t * +option_alloc (struct cmsghdr *cmsg, int datalen, int multx, int plusy) { /* The RFC limits the value of the alignment values. */ if ((multx != 1 && multx != 2 && multx != 4 && multx != 8) @@ -214,7 +214,17 @@ inet6_option_alloc (cmsg, datalen, multx, plusy) return result; } -libc_hidden_def (inet6_option_alloc) + + +uint8_t * +inet6_option_alloc (cmsg, datalen, multx, plusy) + struct cmsghdr *cmsg; + int datalen; + int multx; + int plusy; +{ + return option_alloc (cmsg, datalen, multx, plusy); +} /* RFC 2292, 6.3.5 diff --git a/inet/inet6_rth.c b/inet/inet6_rth.c new file mode 100644 index 0000000000..15f8240909 --- /dev/null +++ b/inet/inet6_rth.c @@ -0,0 +1,192 @@ +/* Copyright (C) 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2006. + + 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + + +/* RFC 3542, 7.1 + + This function returns the number of bytes required to hold a + Routing header of the specified type containing the specified + number of segments (addresses). For an IPv6 Type 0 Routing header, + the number of segments must be between 0 and 127, inclusive. */ +socklen_t +inet6_rth_space (int type, int segments) +{ + switch (type) + { + case IPV6_RTHDR_TYPE_0: + if (segments < 0 || segments > 127) + return 0; + + return sizeof (struct ip6_rthdr0) + segments * sizeof (struct in6_addr); + } + + return 0; +} + + +/* RFC 3542, 7.2 + + This function initializes the buffer pointed to by BP to contain a + Routing header of the specified type and sets ip6r_len based on the + segments parameter. */ +void * +inet6_rth_init (void *bp, socklen_t bp_len, int type, int segments) +{ + struct ip6_rthdr *rthdr = (struct ip6_rthdr *) bp; + + switch (type) + { + case IPV6_RTHDR_TYPE_0: + /* Make sure the parameters are valid and the buffer is large enough. */ + if (segments < 0 || segments > 127) + break; + + socklen_t len = (sizeof (struct ip6_rthdr0) + + segments * sizeof (struct in6_addr)); + if (len > bp_len) + break; + + /* Some implementations seem to initialize the whole memory area. */ + memset (bp, '\0', len); + + /* Length in units of 8 octets. */ + rthdr->ip6r_len = segments * sizeof (struct in6_addr) / 8; + rthdr->ip6r_type = IPV6_RTHDR_TYPE_0; + return bp; + } + + return NULL; +} + + +/* RFC 3542, 7.3 + + This function adds the IPv6 address pointed to by addr to the end of + the Routing header being constructed. */ +int +inet6_rth_add (void *bp, const struct in6_addr *addr) +{ + struct ip6_rthdr *rthdr = (struct ip6_rthdr *) bp; + + switch (rthdr->ip6r_type) + { + struct ip6_rthdr0 *rthdr0; + case IPV6_RTHDR_TYPE_0: + rthdr0 = (struct ip6_rthdr0 *) rthdr; + + memcpy (&rthdr0->ip6r0_addr[rthdr0->ip6r0_segleft++], + addr, sizeof (struct in6_addr)); + + return 0; + } + + return -1; +} + + +/* RFC 3542, 7.4 + + This function takes a Routing header extension header (pointed to by + the first argument) and writes a new Routing header that sends + datagrams along the reverse of that route. The function reverses the + order of the addresses and sets the segleft member in the new Routing + header to the number of segments. */ +int +inet6_rth_reverse (const void *in, void *out) +{ + struct ip6_rthdr *in_rthdr = (struct ip6_rthdr *) in; + + switch (in_rthdr->ip6r_type) + { + struct ip6_rthdr0 *in_rthdr0; + struct ip6_rthdr0 *out_rthdr0; + case IPV6_RTHDR_TYPE_0: + in_rthdr0 = (struct ip6_rthdr0 *) in; + out_rthdr0 = (struct ip6_rthdr0 *) out; + + /* Copy header, not the addresses. The memory regions can overlap. */ + memmove (out_rthdr0, in_rthdr0, sizeof (struct ip6_rthdr0)); + + int total = in_rthdr0->ip6r0_segleft * 8 / sizeof (struct in6_addr); + for (int i = 0; i < total / 2; ++i) + { + /* Remember, IN_RTHDR0 and OUT_RTHDR0 might overlap. */ + struct in6_addr temp = in_rthdr0->ip6r0_addr[i]; + out_rthdr0->ip6r0_addr[i] = in_rthdr0->ip6r0_addr[total - 1 - i]; + out_rthdr0->ip6r0_addr[total - 1 - i] = temp; + } + if (total % 2 != 0 && in != out) + out_rthdr0->ip6r0_addr[total / 2] = in_rthdr0->ip6r0_addr[total / 2]; + + return 0; + } + + return -1; +} + + +/* RFC 3542, 7.5 + + This function returns the number of segments (addresses) contained in + the Routing header described by BP. */ +int +inet6_rth_segments (const void *bp) +{ + struct ip6_rthdr *rthdr = (struct ip6_rthdr *) bp; + + switch (rthdr->ip6r_type) + { + case IPV6_RTHDR_TYPE_0: + + return rthdr->ip6r_len * 8 / sizeof (struct in6_addr); + } + + return -1; +} + + +/* RFC 3542, 7.6 + + This function returns a pointer to the IPv6 address specified by + index (which must have a value between 0 and one less than the + value returned by 'inet6_rth_segments') in the Routing header + described by BP. */ +struct in6_addr * +inet6_rth_getaddr (const void *bp, int index) +{ + struct ip6_rthdr *rthdr = (struct ip6_rthdr *) bp; + + switch (rthdr->ip6r_type) + { + struct ip6_rthdr0 *rthdr0; + case IPV6_RTHDR_TYPE_0: + rthdr0 = (struct ip6_rthdr0 *) rthdr; + + if (index >= rthdr0->ip6r0_len * 8 / sizeof (struct in6_addr)) + break; + + return &rthdr0->ip6r0_addr[index]; + } + + return NULL; +} diff --git a/inet/netinet/icmp6.h b/inet/netinet/icmp6.h index c5138a39c9..0cb1aa6a6c 100644 --- a/inet/netinet/icmp6.h +++ b/inet/netinet/icmp6.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,93,94,95,96,97,2000 Free Software Foundation, Inc. +/* Copyright (C) 1991-1997,2000,2006 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 @@ -191,13 +191,13 @@ struct nd_opt_hdr /* Neighbor discovery option header */ /* followed by option specific data */ }; -#define ND_OPT_SOURCE_LINKADDR 1 -#define ND_OPT_TARGET_LINKADDR 2 -#define ND_OPT_PREFIX_INFORMATION 3 -#define ND_OPT_REDIRECTED_HEADER 4 -#define ND_OPT_MTU 5 -#define ND_OPT_RTR_ADV_INTERVAL 7 -#define ND_OPT_HOME_AGENT_INFO 8 +#define ND_OPT_SOURCE_LINKADDR 1 +#define ND_OPT_TARGET_LINKADDR 2 +#define ND_OPT_PREFIX_INFORMATION 3 +#define ND_OPT_REDIRECTED_HEADER 4 +#define ND_OPT_MTU 5 +#define ND_OPT_RTR_ADV_INTERVAL 7 +#define ND_OPT_HOME_AGENT_INFO 8 struct nd_opt_prefix_info /* prefix information */ { @@ -211,9 +211,9 @@ struct nd_opt_prefix_info /* prefix information */ struct in6_addr nd_opt_pi_prefix; }; -#define ND_OPT_PI_FLAG_ONLINK 0x80 -#define ND_OPT_PI_FLAG_AUTO 0x40 -#define ND_OPT_PI_FLAG_RADDR 0x20 +#define ND_OPT_PI_FLAG_ONLINK 0x80 +#define ND_OPT_PI_FLAG_AUTO 0x40 +#define ND_OPT_PI_FLAG_RADDR 0x20 struct nd_opt_rd_hdr /* redirected header */ { @@ -300,11 +300,11 @@ struct rr_pco_use /* use prefix part */ #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x10 #if BYTE_ORDER == BIG_ENDIAN -# define ICMP6_RR_PCOUSE_DECRVLTIME 0x80000000 -# define ICMP6_RR_PCOUSE_DECRPLTIME 0x40000000 +# define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000 +# define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000 #elif BYTE_ORDER == LITTLE_ENDIAN -# define ICMP6_RR_PCOUSE_DECRVLTIME 0x80 -# define ICMP6_RR_PCOUSE_DECRPLTIME 0x40 +# define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 +# define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 #endif struct rr_result /* router renumbering result message */ diff --git a/inet/netinet/in.h b/inet/netinet/in.h index 8898be3664..4fdc0fadf1 100644 --- a/inet/netinet/in.h +++ b/inet/netinet/in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2001, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1991-2001, 2003, 2004, 2006 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 @@ -455,25 +455,66 @@ extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in) /* IPv6 packet information. */ struct in6_pktinfo { - struct in6_addr ipi6_addr; /* src/dst IPv6 address */ - unsigned int ipi6_ifindex; /* send/recv interface index */ + struct in6_addr ipi6_addr; /* src/dst IPv6 address */ + unsigned int ipi6_ifindex; /* send/recv interface index */ + }; + +/* IPv6 MTU information. */ +struct ip6_mtuinfo + { + struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */ + uint32_t ip6m_mtu; /* path MTU in host byte order */ }; #ifdef __USE_GNU -/* Hop-by-Hop and Destination Options Processing. */ -extern int inet6_option_space (int __nbytes) __THROW; +/* Obsolete hop-by-hop and Destination Options Processing (RFC 2292). */ +extern int inet6_option_space (int __nbytes) + __THROW __attribute_deprecated__; extern int inet6_option_init (void *__bp, struct cmsghdr **__cmsgp, - int __type) __THROW; + int __type) __THROW __attribute_deprecated__; extern int inet6_option_append (struct cmsghdr *__cmsg, __const uint8_t *__typep, int __multx, - int __plusy) __THROW; + int __plusy) __THROW __attribute_deprecated__; extern uint8_t *inet6_option_alloc (struct cmsghdr *__cmsg, int __datalen, - int __multx, int __plusy) __THROW; + int __multx, int __plusy) + __THROW __attribute_deprecated__; extern int inet6_option_next (__const struct cmsghdr *__cmsg, - uint8_t **__tptrp) __THROW; + uint8_t **__tptrp) + __THROW __attribute_deprecated__; extern int inet6_option_find (__const struct cmsghdr *__cmsg, - uint8_t **__tptrp, int __type) __THROW; + uint8_t **__tptrp, int __type) + __THROW __attribute_deprecated__; + + +/* Hop-by-Hop and Destination Options Processing (RFC 3542). */ +extern int inet6_opt_init (void *__extbuf, socklen_t __extlen) __THROW; +extern int inet6_opt_append (void *__extbuf, socklen_t __extlen, int __offset, + uint8_t __type, socklen_t __len, uint8_t __align, + void **__databufp) __THROW; +extern int inet6_opt_finish (void *__extbuf, socklen_t __extlen, int __offset) + __THROW; +extern int inet6_opt_set_val (void *__databuf, int __offset, void *__val, + socklen_t __vallen) __THROW; +extern int inet6_opt_next (void *__extbuf, socklen_t __extlen, int __offset, + uint8_t *__typep, socklen_t *__lenp, + void **__databufp) __THROW; +extern int inet6_opt_find (void *__extbuf, socklen_t __extlen, int __offset, + uint8_t __type, socklen_t *__lenp, + void **__databufp) __THROW; +extern int inet6_opt_get_val (void *__databuf, int __offset, void *__val, + socklen_t __vallen) __THROW; + + +/* Routing Header Option (RFC 3542). */ +extern socklen_t inet6_rth_space (int __type, int __segments) __THROW; +extern void *inet6_rth_init (void *__bp, socklen_t __bp_len, int __type, + int __segments) __THROW; +extern int inet6_rth_add (void *__bp, __const struct in6_addr *__addr) __THROW; +extern int inet6_rth_reverse (__const void *__in, void *__out) __THROW; +extern int inet6_rth_segments (__const void *__bp) __THROW; +extern struct in6_addr *inet6_rth_getaddr (__const void *__bp, int __index) + __THROW; /* Multicast source filter support. */ diff --git a/inet/netinet/ip6.h b/inet/netinet/ip6.h index 0ad62f8980..bef2af2f5a 100644 --- a/inet/netinet/ip6.h +++ b/inet/netinet/ip6.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1997, 2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1991-1997, 2001, 2003, 2006 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 @@ -89,7 +89,8 @@ struct ip6_rthdr0 uint8_t ip6r0_segleft; /* segments left */ uint8_t ip6r0_reserved; /* reserved field */ uint8_t ip6r0_slmap[3]; /* strict/loose bit map */ - struct in6_addr ip6r0_addr[1]; /* up to 23 addresses */ + /* followed by up to 127 struct in6_addr */ + struct in6_addr ip6r0_addr[0]; }; /* Fragment header */ @@ -101,14 +102,14 @@ struct ip6_frag uint32_t ip6f_ident; /* identification */ }; -#if BYTE_ORDER == BIG_ENDIAN -#define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */ -#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */ -#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */ +#if BYTE_ORDER == BIG_ENDIAN +# define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */ +# define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */ +# define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */ #else /* BYTE_ORDER == LITTLE_ENDIAN */ -#define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */ -#define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */ -#define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */ +# define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */ +# define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */ +# define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */ #endif /* IPv6 options */ @@ -175,7 +176,7 @@ struct ip6_opt_router }; /* Router alert values (in network byte order) */ -#if BYTE_ORDER == BIG_ENDIAN +#if BYTE_ORDER == BIG_ENDIAN # define IP6_ALERT_MLD 0x0000 # define IP6_ALERT_RSVP 0x0001 # define IP6_ALERT_AN 0x0002 diff --git a/localedata/ChangeLog b/localedata/ChangeLog index 8fb2d58464..c8c53b193e 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,10 @@ +2006-05-26 Ulrich Drepper + + * SUPPORTED (SUPPORTED-LOCALES): Add as_IN.UTF-8 and or_IN.UTF-8. + * locales/as_IN: New file. + * locales/or_IN: New file. + Patch by Masahide Washizawa . + 2006-05-02 Ulrich Drepper [BZ #1203] diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED index f801fe263f..e06ce3a768 100644 --- a/localedata/SUPPORTED +++ b/localedata/SUPPORTED @@ -47,6 +47,7 @@ ar_TN/ISO-8859-6 \ ar_YE.UTF-8/UTF-8 \ ar_YE/ISO-8859-6 \ az_AZ.UTF-8/UTF-8 \ +as_IN.UTF-8/UTF-8 \ be_BY.UTF-8/UTF-8 \ be_BY/CP1251 \ be_BY@latin/UTF-8 \ @@ -285,6 +286,7 @@ oc_FR/ISO-8859-1 \ om_ET/UTF-8 \ om_KE.UTF-8/UTF-8 \ om_KE/ISO-8859-1 \ +or_IN/UTF-8 \ pa_IN/UTF-8 \ pa_PK/UTF-8 \ pl_PL.UTF-8/UTF-8 \ diff --git a/localedata/locales/as_IN b/localedata/locales/as_IN new file mode 100644 index 0000000000..9a30d658bd --- /dev/null +++ b/localedata/locales/as_IN @@ -0,0 +1,728 @@ +comment_char % +escape_char / + +% Assamese locale for India. +% Contributed by Masahide Washizawa + +%%%%%%%%%%%%% +LC_IDENTIFICATION +title "Assamese language locale for India" +source "IBM AP Linux Technology Center, Yamato Software Laboratory" +address "1623-14, Shimotsuruma, Yamato-shi, Kanagawa-ken, 242-8502, Japan" +contact "" +email "bug-glibc@gnu.org" +tel "" +fax "" +language "Assamese" +territory "India" +revision "1.0" +date "2006-05-25" +% +category "as_IN:2000";LC_IDENTIFICATION +category "as_IN:2000";LC_CTYPE +category "as_IN:2000";LC_COLLATE +category "as_IN:2000";LC_TIME +category "as_IN:2000";LC_NUMERIC +category "as_IN:2000";LC_MONETARY +category "as_IN:2000";LC_MESSAGES +category "as_IN:2000";LC_PAPER +category "as_IN:2000";LC_NAME +category "as_IN:2000";LC_ADDRESS +category "as_IN:2000";LC_TELEPHONE +END LC_IDENTIFICATION + +%%%%%%%%%%%%% +LC_CTYPE +copy "i18n" +END LC_CTYPE + +%%%%%%%%%%%%% +LC_COLLATE + +% Define collation weights as symbols +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol + +order_start forward;forward;forward;forward + + +% collation weights in order + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +% assignment of characters to weights + + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;"";"";IGNORE + IGNORE;"";"";IGNORE + IGNORE;"";"";IGNORE + IGNORE;"";"";IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;;;IGNORE + "";"";"";IGNORE + "";"";"";IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE +% FIXME ;;;IGNORE +% (Bengali sign avagraha) is defined from Unicode4.0 + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + "";;"";IGNORE +UNDEFINED IGNORE;IGNORE;IGNORE;%... + +order_end +END LC_COLLATE + +%%%%%%%%%%%%% +LC_NUMERIC +copy "en_IN" +END LC_NUMERIC + +%%%%%%%%%%%%% +LC_MONETARY +int_curr_symbol "" +currency_symbol "" +mon_decimal_point "" +mon_thousands_sep "" +mon_grouping 3;2 +positive_sign "" +negative_sign "" +int_frac_digits 2 +frac_digits 2 +p_cs_precedes 1 +p_sep_by_space 1 +n_cs_precedes 1 +n_sep_by_space 1 +p_sign_posn 1 +n_sign_posn 1 +int_p_cs_precedes 1 +int_p_sep_by_space 1 +int_n_cs_precedes 1 +int_n_sep_by_space 1 +int_p_sign_posn 1 +int_n_sign_posn 1 +END LC_MONETARY + +%%%%%%%%%%%%% +LC_TIME +abday "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "" +day "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "" +abmon "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "" +mon "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "" +% d_fmt "%e-%m-%Y" +d_fmt "" +% t_fmt "%I.%M.%S %p" +t_fmt "" +% d_t_fmt"%e %B, %Y %I.%M.%S %p %Z" +d_t_fmt "" +am_pm "";"" +% t_fmt_ampm "%I.%M.%S %p" +t_fmt_ampm "" +END LC_TIME + +%%%%%%%%%%%%% +LC_MESSAGES +yesstr "" +nostr "" +yesexpr "" +noexpr "" +END LC_MESSAGES + +%%%%%%%%%%%%% +LC_PAPER +copy "hi_IN" +END LC_PAPER + +%%%%%%%%%%%%% +LC_NAME +% This is the ISO_IEC TR14652 Locale definition for the +% LC_NAME category. +% +name_fmt "/ +" +name_gen "" +name_mr "" +name_mrs "" +name_miss "" +name_ms "" +END LC_NAME + +%%%%%%%%%%%%% +LC_ADDRESS +% This is the ISO_IEC TR14652 Locale definition for the +% LC_ADDRESS +postal_fmt "/ +" +END LC_ADDRESS + +%%%%%%%%%%%%% +LC_TELEPHONE +% This is the ISO_IEC TR14652 Locale definition for the +tel_int_fmt "" +int_prefix "" +int_select "" +END LC_TELEPHONE + +%%%%%%%%%%%%% +LC_MEASUREMENT +copy "hi_IN" +END LC_MEASUREMENT diff --git a/localedata/locales/or_IN b/localedata/locales/or_IN new file mode 100644 index 0000000000..7929b2b13f --- /dev/null +++ b/localedata/locales/or_IN @@ -0,0 +1,807 @@ +comment_char % +escape_char / + +% Oriya locale for India. +% Contributed by Masahide Washizawa + +%%%%%%%%%%%%% +LC_IDENTIFICATION +title "Oriya language locale for India" +source "IBM AP Linux Technology Center, Yamato Software Laboratory" +address "1623-14, Shimotsuruma, Yamato-shi, Kanagawa-ken, 242-8502, Japan" +contact "" +email "bug-glibc@gnu.org" +tel "" +fax "" +language "Oriya" +territory "India" +revision "1.0" +date "2006-05-25" +% +category "or_IN:2004";LC_IDENTIFICATION +category "or_IN:2004";LC_CTYPE +category "or_IN:2004";LC_COLLATE +category "or_IN:2004";LC_TIME +category "or_IN:2004";LC_NUMERIC +category "or_IN:2004";LC_MONETARY +category "or_IN:2004";LC_MESSAGES +category "or_IN:2004";LC_PAPER +category "or_IN:2004";LC_NAME +category "or_IN:2004";LC_ADDRESS +category "or_IN:2004";LC_TELEPHONE +END LC_IDENTIFICATION + +%%%%%%%%%%%%% +LC_CTYPE +copy "i18n" +END LC_CTYPE + +%%%%%%%%%%%%% +LC_COLLATE + +collating-element from "" +collating-element from "" +collating-element from "" + +% Define collation weights as symbols + +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol + +order_start forward;forward;forward;forward + + +% collation weights in order + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +% assignment of characters to weights + + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + IGNORE;IGNORE;IGNORE; + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;"";"";IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + "";;"";IGNORE + "";;"";"" + "";;"";"" + "";;"";"" + "";;"";"" + "";;"";IGNORE +% FIXME ORIYA_LETTER_WA "";;"";IGNORE +% FIXME ORIYA_LETTER_VA "";;"";IGNORE +% ORIYA_LETTER_WA and ORIYA_LETTER_VA are not defined in unicode 3.0 + "";;"";IGNORE + "";;"";IGNORE + "";;"";IGNORE + "";;"";IGNORE + "";;"";IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE + ;;;IGNORE +UNDEFINED IGNORE;IGNORE;IGNORE;%... + +order_end +END LC_COLLATE + +%%%%%%%%%%%%% +LC_NUMERIC +decimal_point "" +thousands_sep "" +grouping 3;2 +END LC_NUMERIC + +%%%%%%%%%%%%% +LC_MONETARY +int_curr_symbol "" +currency_symbol "" +mon_decimal_point "" +mon_thousands_sep "" +mon_grouping 3;2 +positive_sign "" +negative_sign "" +int_frac_digits 2 +frac_digits 2 +p_cs_precedes 1 +p_sep_by_space 1 +n_cs_precedes 1 +n_sep_by_space 1 +p_sign_posn 1 +n_sign_posn 1 +int_p_cs_precedes 1 +int_p_sep_by_space 1 +int_n_cs_precedes 1 +int_n_sep_by_space 1 +int_p_sign_posn 1 +int_n_sign_posn 1 +END LC_MONETARY + +%%%%%%%%%%%%% +LC_TIME +abday "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "" +day "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "" +abmon "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "" +mon "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "" +% d_fmt "%Od-%Om-%Oy" +d_fmt "" +% t_fmt "%OI:%OM:%OS %p" +t_fmt "" +% d_t_fmt "%Oe %B %Oy %OI:%OM:%OS %p %Z" +d_t_fmt "" +am_pm "";"" +% t_fmt_ampm "%OI:%OM:%OS %p" +t_fmt_ampm "" +alt_digits "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "" +END LC_TIME + +%%%%%%%%%%%%% +LC_MESSAGES +% FIXME These need support for the translated words +yesexpr "" +noexpr "" +END LC_MESSAGES + +%%%%%%%%%%%%% +LC_PAPER +copy "hi_IN" +END LC_PAPER + +%%%%%%%%%%%%% +LC_NAME +% This is the ISO_IEC TR14652 Locale definition for the +% LC_NAME category. +% +name_fmt "/ +" +name_gen "" +name_mr "" +name_mrs "" +name_miss "" +name_ms "" +END LC_NAME + +%%%%%%%%%%%%% +LC_ADDRESS +% This is the ISO_IEC TR14652 Locale definition for the +% LC_ADDRESS +postal_fmt "/ +" +END LC_ADDRESS + +%%%%%%%%%%%%% +LC_TELEPHONE +% This is the ISO_IEC TR14652 Locale definition for the +tel_int_fmt "" +int_prefix "" +int_select "" +END LC_TELEPHONE + +%%%%%%%%%%%%% +LC_MEASUREMENT +copy "hi_IN" +END LC_MEASUREMENT diff --git a/nis/nis_addmember.c b/nis/nis_addmember.c index bbe1c23977..5e342ad0d0 100644 --- a/nis/nis_addmember.c +++ b/nis/nis_addmember.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1998, 1999, 2004 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998, 1999, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1997. @@ -28,13 +28,12 @@ nis_addmember (const_nis_name member, const_nis_name group) { size_t grouplen = strlen (group); char buf[grouplen + 14 + NIS_MAXNAMELEN]; - char leafbuf[grouplen + 2]; char domainbuf[grouplen + 2]; nis_result *res, *res2; nis_error status; char *cp, *cp2; - cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1)); + cp = rawmemchr (nis_leaf_of_r (group, buf, sizeof (buf) - 1), '\0'); cp = stpcpy (cp, ".groups_dir"); cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1); if (cp2 != NULL && cp2[0] != '\0') @@ -42,30 +41,35 @@ nis_addmember (const_nis_name member, const_nis_name group) *cp++ = '.'; stpcpy (cp, cp2); } - res = nis_lookup (buf, FOLLOW_LINKS|EXPAND_NAME); + res = nis_lookup (buf, FOLLOW_LINKS | EXPAND_NAME); if (NIS_RES_STATUS (res) != NIS_SUCCESS) { status = NIS_RES_STATUS (res); nis_freeresult (res); return status; } - if ((NIS_RES_NUMOBJ (res) != 1) || - (__type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ)) + if (NIS_RES_NUMOBJ (res) != 1 + || __type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ) { nis_freeresult (res); return NIS_INVALIDOBJ; } - NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val + u_int gr_members_len + = NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len; + + nis_name *new_gr_members_val = realloc (NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val, - (NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len + 1) - * sizeof (char *)); - if (NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val == NULL) + (gr_members_len + 1) * sizeof (nis_name)); + if (new_gr_members_val == NULL) goto nomem_out; - NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val[NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len] = strdup (member); - if (NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val[NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len] == NULL) + + NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val + = new_gr_members_val; + + new_gr_members_val[gr_members_len] = strdup (member); + if (new_gr_members_val[gr_members_len] == NULL) { - free (NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val); nomem_out: nis_freeresult (res); return NIS_NOMEMORY; diff --git a/nis/nis_callback.c b/nis/nis_callback.c index 7c76f99b6b..e0acd9683a 100644 --- a/nis/nis_callback.c +++ b/nis/nis_callback.c @@ -360,8 +360,7 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *, { if (cb->xprt) svc_destroy (cb->xprt); - if (cb->serv) - xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv); + xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv); free (cb); } if (!nomsg) diff --git a/nis/nis_removemember.c b/nis/nis_removemember.c index 21fe13aedf..2e45b4fb79 100644 --- a/nis/nis_removemember.c +++ b/nis/nis_removemember.c @@ -28,15 +28,12 @@ nis_removemember (const_nis_name member, const_nis_name group) { size_t grouplen = strlen (group); char buf[grouplen + 14 + NIS_MAXNAMELEN]; - char leafbuf[grouplen + 2]; char domainbuf[grouplen + 2]; - nis_name *newmem; nis_result *res, *res2; nis_error status; char *cp, *cp2; - unsigned long int i, j, k; - cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1)); + cp = rawmemchr (nis_leaf_of_r (group, buf, sizeof (buf) - 1), '\0'); cp = stpcpy (cp, ".groups_dir"); cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1); if (cp2 != NULL && cp2[0] != '\0') @@ -44,68 +41,41 @@ nis_removemember (const_nis_name member, const_nis_name group) cp = stpcpy (cp, "."); stpcpy (cp, cp2); } - res = nis_lookup (buf, FOLLOW_LINKS|EXPAND_NAME); - if (res == NULL || NIS_RES_STATUS (res) != NIS_SUCCESS) + res = nis_lookup (buf, FOLLOW_LINKS | EXPAND_NAME); + if (res == NULL) + return NIS_NOMEMORY; + if (NIS_RES_STATUS (res) != NIS_SUCCESS) { - if (res) - { - status = NIS_RES_STATUS (res); - nis_freeresult (res); - } - else - return NIS_NOMEMORY; + status = NIS_RES_STATUS (res); + nis_freeresult (res); return status; } - if ((res->objects.objects_len != 1) || - (__type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ)) + if (NIS_RES_NUMOBJ (res) != 1 + || __type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ) { nis_freeresult (res); return NIS_INVALIDOBJ; } - newmem = - calloc (NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len, - sizeof (char *)); - if (newmem == NULL) - { - nis_freeresult (res); - return NIS_NOMEMORY; - } + nis_name *gr_members_val + = NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_val; + u_int gr_members_len + = NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len; - k = NIS_RES_OBJECT (res)[0].GR_data.gr_members.gr_members_len; - j = 0; - for (i = 0; i < NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len; - ++i) - { - if (strcmp (NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_val[i], - member) != 0) - { - newmem[j] = NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_val[i]; - ++j; - } - else - { - free (NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_val[i]); - --k; - } - } - free (NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val); - assert (k <= NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len); - /* This realloc() call always decreases the size. This cannot - fail. We still have the test but do not recover memory - (i.e., we overwrite the input pointer). */ - nis_name *newp = realloc (newmem, k * sizeof (char*)); - if (newp == NULL) - { - free (newmem); - nis_freeresult (res); - return NIS_NOMEMORY; - } - newmem = newp; + u_int j = 0; + for (u_int i = 0; i < gr_members_len; ++i) + if (strcmp (gr_members_val[i], member) != 0) + gr_members_val[j++] = gr_members_val[i]; + else + free (gr_members_val[i]); - NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val = newmem; - NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len = k; + /* There is no need to reallocate the gr_members_val array. We + just adjust the size to match the number of strings still in + it. Yes, xdr_array will use mem_free with a size parameter + but this is mapped to a simple free call which determines the + size of the block by itself. */ + NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len = j; cp = stpcpy (buf, NIS_RES_OBJECT (res)->zo_name); *cp++ = '.'; diff --git a/nscd/cache.c b/nscd/cache.c index 787f8b46f5..be9be2aa4f 100644 --- a/nscd/cache.c +++ b/nscd/cache.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1998, 1999, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (c) 1998, 1999, 2003-2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. @@ -190,13 +190,34 @@ cache_add (int type, const void *key, size_t len, struct datahead *packet, free the data structures since some hash table entries share the same data. */ void -prune_cache (struct database_dyn *table, time_t now) +prune_cache (struct database_dyn *table, time_t now, int fd) { size_t cnt = table->head->module; /* If this table is not actually used don't do anything. */ if (cnt == 0) - return; + { + if (fd != -1) + { + /* Reply to the INVALIDATE initiator. */ + int32_t resp = 0; + writeall (fd, &resp, sizeof (resp)); + } + return; + } + + /* This function can be called from the cleanup thread but also in + response to an invalidate command. Make sure only one thread is + running. When not serving INVALIDATE request, no need for the + second to wait around. */ + if (fd == -1) + { + if (pthread_mutex_trylock (&table->prunelock) != 0) + /* The work is already being done. */ + return; + } + else + pthread_mutex_lock (&table->prunelock); /* If we check for the modification of the underlying file we invalidate the entries also in this case. */ @@ -367,6 +388,14 @@ prune_cache (struct database_dyn *table, time_t now) } while (cnt > 0); + if (fd != -1) + { + /* Reply to the INVALIDATE initiator that the cache has been + invalidated. */ + int32_t resp = 0; + writeall (fd, &resp, sizeof (resp)); + } + if (first <= last) { struct hashentry *head = NULL; @@ -455,4 +484,6 @@ prune_cache (struct database_dyn *table, time_t now) /* Run garbage collection if any entry has been removed or replaced. */ if (any) gc (table); + + pthread_mutex_unlock (&table->prunelock); } diff --git a/nscd/connections.c b/nscd/connections.c index 8bd9a66be8..307337bffe 100644 --- a/nscd/connections.c +++ b/nscd/connections.c @@ -100,6 +100,7 @@ struct database_dyn dbs[lastdb] = { [pwddb] = { .lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP, + .prunelock = PTHREAD_MUTEX_INITIALIZER, .enabled = 0, .check_file = 1, .persistent = 0, @@ -117,6 +118,7 @@ struct database_dyn dbs[lastdb] = }, [grpdb] = { .lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP, + .prunelock = PTHREAD_MUTEX_INITIALIZER, .enabled = 0, .check_file = 1, .persistent = 0, @@ -134,6 +136,7 @@ struct database_dyn dbs[lastdb] = }, [hstdb] = { .lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP, + .prunelock = PTHREAD_MUTEX_INITIALIZER, .enabled = 0, .check_file = 1, .persistent = 0, @@ -813,9 +816,10 @@ close_sockets (void) static void -invalidate_cache (char *key) +invalidate_cache (char *key, int fd) { dbtype number; + int32_t resp; if (strcmp (key, "passwd") == 0) number = pwddb; @@ -829,10 +833,19 @@ invalidate_cache (char *key) res_init (); } else - return; + { + resp = EINVAL; + writeall (fd, &resp, sizeof (resp)); + return; + } if (dbs[number].enabled) - prune_cache (&dbs[number], LONG_MAX); + prune_cache (&dbs[number], LONG_MAX, fd); + else + { + resp = 0; + writeall (fd, &resp, sizeof (resp)); + } } @@ -1089,7 +1102,7 @@ cannot handle old request version %d; current version is %d"), else if (uid == 0) { if (req->type == INVALIDATE) - invalidate_cache (key); + invalidate_cache (key, fd); else termination_handler (0); } @@ -1435,7 +1448,7 @@ handle_request: request received (Version = %d)"), req.version); /* The pthread_cond_timedwait() call timed out. It is time to clean up the cache. */ assert (my_number < lastdb); - prune_cache (&dbs[my_number], time (NULL)); + prune_cache (&dbs[my_number], time (NULL), -1); if (clock_gettime (timeout_clock, &prune_ts) == -1) /* Should never happen. */ @@ -1908,14 +1921,14 @@ sighup_handler (int signum) { /* Prune the password database. */ if (dbs[pwddb].enabled) - prune_cache (&dbs[pwddb], LONG_MAX); + prune_cache (&dbs[pwddb], LONG_MAX, -1); /* Prune the group database. */ if (dbs[grpdb].enabled) - prune_cache (&dbs[grpdb], LONG_MAX); + prune_cache (&dbs[grpdb], LONG_MAX, -1); /* Prune the host database. */ if (dbs[hstdb].enabled) - prune_cache (&dbs[hstdb], LONG_MAX); + prune_cache (&dbs[hstdb], LONG_MAX, -1); } diff --git a/nscd/nscd.c b/nscd/nscd.c index 917163af78..03359f3c05 100644 --- a/nscd/nscd.c +++ b/nscd/nscd.c @@ -336,9 +336,6 @@ parse_opt (int key, char *arg, struct argp_state *state) exit (EXIT_FAILURE); request_header req; - ssize_t nbytes; - struct iovec iov[2]; - if (strcmp (arg, "passwd") == 0) req.key_len = sizeof "passwd"; else if (strcmp (arg, "group") == 0) @@ -351,17 +348,38 @@ parse_opt (int key, char *arg, struct argp_state *state) req.version = NSCD_VERSION; req.type = INVALIDATE; + struct iovec iov[2]; iov[0].iov_base = &req; iov[0].iov_len = sizeof (req); iov[1].iov_base = arg; iov[1].iov_len = req.key_len; - nbytes = TEMP_FAILURE_RETRY (writev (sock, iov, 2)); + ssize_t nbytes = TEMP_FAILURE_RETRY (writev (sock, iov, 2)); + + if (nbytes != iov[0].iov_len + iov[1].iov_len) + { + int err = errno; + close (sock); + error (EXIT_FAILURE, err, _("write incomplete")); + } + + /* Wait for ack. Older nscd just closed the socket when + prune_cache finished, silently ignore that. */ + int32_t resp = 0; + nbytes = TEMP_FAILURE_RETRY (read (sock, &resp, sizeof (resp))); + if (nbytes != 0 && nbytes != sizeof (resp)) + { + int err = errno; + close (sock); + error (EXIT_FAILURE, err, _("cannot read invalidate ACK")); + } close (sock); - exit (nbytes != iov[0].iov_len + iov[1].iov_len - ? EXIT_FAILURE : EXIT_SUCCESS); + if (resp != 0) + error (EXIT_FAILURE, resp, _("invalidation failed")); + + exit (0); } case 't': diff --git a/nscd/nscd.h b/nscd/nscd.h index 8b95630807..5c2ff3a95b 100644 --- a/nscd/nscd.h +++ b/nscd/nscd.h @@ -58,6 +58,7 @@ typedef enum struct database_dyn { pthread_rwlock_t lock; + pthread_mutex_t prunelock; int enabled; int check_file; @@ -184,7 +185,7 @@ extern struct datahead *cache_search (request_type, void *key, size_t len, extern int cache_add (int type, const void *key, size_t len, struct datahead *packet, bool first, struct database_dyn *table, uid_t owner); -extern void prune_cache (struct database_dyn *table, time_t now); +extern void prune_cache (struct database_dyn *table, time_t now, int fd); /* pwdcache.c */ extern void addpwbyname (struct database_dyn *db, int fd, request_header *req, diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index a35b8662d5..185957be6a 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -1668,7 +1668,7 @@ gaiconf_init (void) if (strcmp (cmd, "label") == 0) { struct in6_addr prefix; - unsigned long int bits = 128; + unsigned long int bits; unsigned long int val; char *endp; @@ -1677,6 +1677,7 @@ gaiconf_init (void) nullbitsp = &labellist_nullbits; new_elem: + bits = 128; __set_errno (0); cp = strchr (val1, '/'); if (cp != NULL) -- cgit v1.2.3