summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-07-24 05:41:25 +0000
committerUlrich Drepper <drepper@redhat.com>2000-07-24 05:41:25 +0000
commit7603ea28d333d47f8e45e33515362ec55d381877 (patch)
treebea0b39db5db660696f86369635be85811b0d165
parentcf9e9ad98feb55d11f93aa4e069c81ee06c2a6a3 (diff)
downloadglibc-7603ea28d333d47f8e45e33515362ec55d381877.tar.gz
Update.
* string/endian.h: Explain the _*_ENDIAN constant values a bit more. Patch by scarlet@mit.edu [PR libc/1799]. * io/ftwtest-sh: Add -f parameter to chmod if -R is also given. [PR libc/1792]. * argp/argp-parse.c (parser_finalize): Reverse order in which parsers are run for ARGP_KEY_END. [PR libc/1755].
-rw-r--r--ChangeLog9
-rw-r--r--README27
-rw-r--r--argp/argp-parse.c8
-rw-r--r--grp/initgroups.c23
-rw-r--r--hesiod/nss_hesiod/hesiod-grp.c34
-rw-r--r--io/ftwtest-sh6
-rw-r--r--manual/argp.texi4
-rw-r--r--nis/nss_compat/compat-initgroups.c19
-rw-r--r--nis/nss_nis/nis-initgroups.c19
-rw-r--r--string/endian.h12
10 files changed, 110 insertions, 51 deletions
diff --git a/ChangeLog b/ChangeLog
index 46fc4bdd18..71867fdb06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2000-07-23 Ulrich Drepper <drepper@redhat.com>
+ * string/endian.h: Explain the _*_ENDIAN constant values a bit
+ more. Patch by scarlet@mit.edu [PR libc/1799].
+
+ * io/ftwtest-sh: Add -f parameter to chmod if -R is also given.
+ [PR libc/1792].
+
+ * argp/argp-parse.c (parser_finalize): Reverse order in which
+ parsers are run for ARGP_KEY_END. [PR libc/1755].
+
* grp/initgroups.c (initgroups): Don't limit the possible number
of groups to NGROUPS_MAX. Allow dynamic resizing. Loop around
the setgroups call while the call fails and descrease the number
diff --git a/README b/README
index 9967469430..ec6464abb7 100644
--- a/README
+++ b/README
@@ -48,28 +48,11 @@ work anymore. Porting the library is not hard. If you are interested
in doing a port, please contact the glibc maintainers by sending
electronic mail to <bug-glibc@gnu.org>.
-The GNU C library now includes Michael Glad's Ultra Fast Crypt, which
-provides the Unix `crypt' function, plus some other entry points.
-Because of the United States export restriction on DES
-implementations, we are distributing this code separately from the
-rest of the C library. There is an extra distribution tar file just
-for crypt; it is called `glibc-crypt-2.1.91.tar.gz'. You can just
-unpack the crypt distribution along with the rest of the C library and
-build; you can also build the library without getting crypt. Users
-outside the USA can get the crypt distribution via anonymous FTP from
-ftp.gwdg.de [134.76.11.100] in the directory pub/linux/glibc, or
-another archive site outside the USA. Archive maintainers are
-encouraged to copy this distribution to their archives outside the
-USA. Please get it from ftp.gwdg.de; transferring this distribution
-from ftp.gnu.org (or any other site in the USA) to a site outside the
-USA is in violation of US export laws.
-
-Beside the separate crypt tar file there are some more add-ons which can be
-used together with GNU libc. They are designed in a way to ease the
-installation by integrating them in the libc source tree. Simply get the
-add-ons you need and use the --enable-add-ons option of the `configure'
-script to tell where the add-ons are found. Please read the FAQ file for
-more details.
+There are some add-ons which can be used together with GNU libc. They
+are designed in a way to ease the installation by integrating them in
+the libc source tree. Simply get the add-ons you need and use the
+--enable-add-ons option of the `configure' script to tell where the
+add-ons are found. Please read the FAQ file for more details.
See the file INSTALL to find out how to configure, build, install, and port
the GNU C library. You might also consider reading the WWW pages for the
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 758129aab1..0ff8a5bc23 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -1,5 +1,5 @@
/* Hierarchial argument parsing, layered over getopt
- Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@@ -615,9 +615,9 @@ parser_finalize (struct parser *parser,
group++)
if (group->args_processed == 0)
err = group_parse (group, &parser->state, ARGP_KEY_NO_ARGS, 0);
- for (group = parser->groups;
- group < parser->egroup && (!err || err==EBADKEY);
- group++)
+ for (group = parser->egroup - 1;
+ group >= parser->groups && (!err || err==EBADKEY);
+ group--)
err = group_parse (group, &parser->state, ARGP_KEY_END, 0);
if (err == EBADKEY)
diff --git a/grp/initgroups.c b/grp/initgroups.c
index 950ebfec0b..a74a703cfd 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -49,7 +49,7 @@ extern service_user *__nss_group_database;
static enum nss_status
compat_call (service_user *nip, const char *user, gid_t group, long int *start,
- long int *size, gid_t **groupsp, int *errnop)
+ long int *size, gid_t **groupsp, long int limit, int *errnop)
{
struct group grpbuf;
size_t buflen = __sysconf (_SC_GETGR_R_SIZE_MAX);
@@ -102,11 +102,22 @@ compat_call (service_user *nip, const char *user, gid_t group, long int *start,
{
/* Need a bigger buffer. */
gid_t *newgroups;
- newgroups = realloc (groups, 2 * *size * sizeof (*groups));
+ long int newsize;
+
+ if (limit > 0 && *size == limit)
+ /* We reached the maximum. */
+ goto done;
+
+ if (limit <= 0)
+ newsize = 2 * *size;
+ else
+ newsize = MIN (limit, 2 * *size);
+
+ newgroups = realloc (groups, newsize * sizeof (*groups));
if (newgroups == NULL)
goto done;
*groupsp = groups = newgroups;
- *size *= 2;
+ *size = newsize;
}
groups[*start] = grpbuf.gr_gid;
@@ -147,10 +158,12 @@ initgroups (user, group)
/* Start is one, because we have the first group as parameter. */
long int start = 1;
long int size;
+ long int limit;
gid_t *groups;
int result;
#ifdef NGROUPS_MAX
size = NGROUPS_MAX;
+ limit = -1;
#else
long int limit = __sysconf (_SC_NGROUPS_MAX);
@@ -184,14 +197,14 @@ initgroups (user, group)
if (fct == NULL)
{
status = compat_call (nip, user, group, &start, &size, &groups,
- &errno);
+ limit, &errno);
if (nss_next_action (nip, NSS_STATUS_UNAVAIL) != NSS_ACTION_CONTINUE)
break;
}
else
status = DL_CALL_FCT (fct, (user, group, &start, &size, &groups,
- &errno));
+ limit, &errno));
/* This is really only for debugging. */
if (NSS_STATUS_TRYAGAIN > status || status > NSS_STATUS_RETURN)
diff --git a/hesiod/nss_hesiod/hesiod-grp.c b/hesiod/nss_hesiod/hesiod-grp.c
index a89ed4edaf..5551d7d012 100644
--- a/hesiod/nss_hesiod/hesiod-grp.c
+++ b/hesiod/nss_hesiod/hesiod-grp.c
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/param.h>
#include "nss_hesiod.h"
@@ -165,7 +166,8 @@ internal_gid_from_group (void *context, const char *groupname, gid_t *group)
enum nss_status
_nss_hesiod_initgroups_dyn (const char *user, gid_t group, long int *start,
- long int *size, gid_t **groupsp, int *errnop)
+ long int *size, gid_t **groupsp, long int limit,
+ int *errnop)
{
enum nss_status status = NSS_STATUS_SUCCESS;
char **list = NULL;
@@ -191,11 +193,22 @@ _nss_hesiod_initgroups_dyn (const char *user, gid_t group, long int *start,
{
/* Need a bigger buffer. */
gid_t *newgroups;
- newgroups = realloc (groups, 2 * *size * sizeof (*groups));
+ long int newsize;
+
+ if (limit > 0 && *size == limit)
+ /* We reached the maximum. */
+ goto done;
+
+ if (limit <= 0)
+ newsize = 2 * *size;
+ else
+ newsize = MIN (limit, 2 * *size);
+
+ newgroups = realloc (groups, newsize * sizeof (*groups));
if (newgroups == NULL)
goto done;
*groupsp = groups = newgroups;
- *size *= 2;
+ *size = newsize;
}
groups[(*start)++] = group;
@@ -232,11 +245,22 @@ _nss_hesiod_initgroups_dyn (const char *user, gid_t group, long int *start,
{
/* Need a bigger buffer. */
gid_t *newgroups;
- newgroups = realloc (groups, 2 * *size * sizeof (*groups));
+ long int newsize;
+
+ if (limit > 0 && *size == limit)
+ /* We reached the maximum. */
+ goto done;
+
+ if (limit <= 0)
+ newsize = 2 * *size;
+ else
+ newsize = MIN (limit, 2 * *size);
+
+ newgroups = realloc (groups, newsize * sizeof (*groups));
if (newgroups == NULL)
goto done;
*groupsp = groups = newgroups;
- *size *= 2;
+ *size = newsize;
}
groups[(*start)++] = group;
diff --git a/io/ftwtest-sh b/io/ftwtest-sh
index 389c4122e8..837470da47 100644
--- a/io/ftwtest-sh
+++ b/io/ftwtest-sh
@@ -28,10 +28,10 @@ tmpdir=$tmp/ftwtest.d
[ -f ${objpfx}elf/ld.so ] && ldso=${objpfx}elf/ld.so
-trap 'chmod -R a+x $tmpdir; rm -fr $tmpdir $testout' 1 2 3 15
+trap 'chmod -fR a+x $tmpdir; rm -fr $tmpdir $testout' 1 2 3 15
if test -d $tmpdir; then
- chmod -R a+x $tmpdir
+ chmod -fR a+x $tmpdir
rm -fr $tmpdir
fi
mkdir $tmpdir
@@ -112,7 +112,7 @@ EOF
rm $testout
# For the next test everything must be readable.
-chmod -R a+x $tmpdir
+chmod -fR a+x $tmpdir
LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir $tmpdir |
sort > $testout
diff --git a/manual/argp.texi b/manual/argp.texi
index 0a5d56dc7d..8410856ae1 100644
--- a/manual/argp.texi
+++ b/manual/argp.texi
@@ -495,7 +495,9 @@ case ARGP_KEY_ARGS:
@comment argp.h
@comment GNU
@item ARGP_KEY_END
-There are no more command line arguments at all.
+There are no more command line arguments at all. The parser functions
+are called in different order (means children first) for this value
+which allows each parser to clean up its state for the parent.
@comment argp.h
@comment GNU
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
index 4d14615126..558433e0ba 100644
--- a/nis/nss_compat/compat-initgroups.c
+++ b/nis/nss_compat/compat-initgroups.c
@@ -27,6 +27,7 @@
#include <rpcsvc/yp.h>
#include <rpcsvc/ypclnt.h>
#include <rpcsvc/nis.h>
+#include <sys/param.h>
#include <nsswitch.h>
#include "nss-nis.h"
@@ -589,7 +590,8 @@ internal_getgrent_r (struct group *gr, ent_t *ent, char *buffer,
enum nss_status
_nss_compat_initgroups_dyn (const char *user, gid_t group, long int *start,
- long int *size, gid_t **groupsp, int *errnop)
+ long int *size, gid_t **groupsp, long int limit,
+ int *errnop)
{
struct group grpbuf, *g;
size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
@@ -631,11 +633,22 @@ _nss_compat_initgroups_dyn (const char *user, gid_t group, long int *start,
{
/* Need a bigger buffer. */
gid_t *newgroups;
- newgroups = realloc (groups, 2 * *size * sizeof (*groups));
+ long int newsize;
+
+ if (limit > 0 && *size == limit)
+ /* We reached the maximum. */
+ goto done;
+
+ if (limit <= 0)
+ newsize = 2 * *size;
+ else
+ newsize = MIN (limit, 2 * *size);
+
+ newgroups = realloc (groups, newsize * sizeof (*groups));
if (newgroups == NULL)
goto done;
*groupsp = groups = newgroups;
- *size *= 2;
+ *size = newsize;
}
groups[*start] = g->gr_gid;
diff --git a/nis/nss_nis/nis-initgroups.c b/nis/nss_nis/nis-initgroups.c
index ec13dbd140..cf666a4e4d 100644
--- a/nis/nss_nis/nis-initgroups.c
+++ b/nis/nss_nis/nis-initgroups.c
@@ -25,6 +25,7 @@
#include <unistd.h>
#include <rpcsvc/yp.h>
#include <rpcsvc/ypclnt.h>
+#include <sys/param.h>
#include "nss-nis.h"
@@ -138,7 +139,8 @@ internal_getgrent_r (struct group *grp, char *buffer, size_t buflen,
enum nss_status
_nss_nis_initgroups_dyn (const char *user, gid_t group, long int *start,
- long int *size, gid_t **groupsp, int *errnop)
+ long int *size, gid_t **groupsp, long int limit,
+ int *errnop)
{
struct group grpbuf, *g;
size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
@@ -181,11 +183,22 @@ _nss_nis_initgroups_dyn (const char *user, gid_t group, long int *start,
{
/* Need a bigger buffer. */
gid_t *newgroups;
- newgroups = realloc (groups, 2 * *size * sizeof (*groups));
+ long int newsize;
+
+ if (limit > 0 && *size == limit)
+ /* We reached the maximum. */
+ goto done;
+
+ if (limit <= 0)
+ newsize = 2 * *size;
+ else
+ newsize = MIN (limit, 2 * *size);
+
+ newgroups = realloc (groups, newsize * sizeof (*groups));
if (newgroups == NULL)
goto done;
*groupsp = groups = newgroups;
- *size *= 2;
+ *size = newsize;
}
groups[*start] = g->gr_gid;
diff --git a/string/endian.h b/string/endian.h
index 858ee6e51c..dcd5a4e372 100644
--- a/string/endian.h
+++ b/string/endian.h
@@ -21,11 +21,13 @@
#include <features.h>
-/* Definitions for byte order, according to significance of bytes, from low
- addresses to high addresses. The value is what you get by putting '4'
- in the most significant byte, '3' in the second most significant byte,
- '2' in the second least significant byte, and '1' in the least
- significant byte. */
+/* Definitions for byte order, according to significance of bytes,
+ from low addresses to high addresses. The value is what you get by
+ putting '4' in the most significant byte, '3' in the second most
+ significant byte, '2' in the second least significant byte, and '1'
+ in the least significant byte, and then writing down one digit for
+ each byte, starting with the byte at the lowest address at the left,
+ and proceeding to the byte with the highest address at the right. */
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321