diff options
Diffstat (limited to 'libc/nss')
-rw-r--r-- | libc/nss/db-Makefile | 2 | ||||
-rw-r--r-- | libc/nss/getent.c | 6 | ||||
-rw-r--r-- | libc/nss/makedb.c | 2 | ||||
-rw-r--r-- | libc/nss/nss_files/files-XXX.c | 2 | ||||
-rw-r--r-- | libc/nss/nss_files/files-alias.c | 4 | ||||
-rw-r--r-- | libc/nss/nss_files/files-initgroups.c | 4 | ||||
-rw-r--r-- | libc/nss/nss_files/files-key.c | 2 | ||||
-rw-r--r-- | libc/nss/nss_files/files-netgrp.c | 4 | ||||
-rw-r--r-- | libc/nss/nsswitch.c | 2 |
9 files changed, 17 insertions, 11 deletions
diff --git a/libc/nss/db-Makefile b/libc/nss/db-Makefile index 13259c188..f86ba12ba 100644 --- a/libc/nss/db-Makefile +++ b/libc/nss/db-Makefile @@ -59,7 +59,7 @@ $(VAR_DB)/group.db: /etc/group } \ delete grmems; } } \ END { for (mem in members) \ - printf ":%s $s %s\n", mem, mem, members[mem]; }' $^ | \ + printf ":%s %s %s\n", mem, mem, members[mem]; }' $^ | \ $(MAKEDB) -o $@ - @echo "done." diff --git a/libc/nss/getent.c b/libc/nss/getent.c index fc0d685f0..c3649fcb0 100644 --- a/libc/nss/getent.c +++ b/libc/nss/getent.c @@ -524,6 +524,12 @@ initgroups_keys (int number, char *key[]) size_t grpslen = ngrps * sizeof (gid_t); gid_t *grps = alloca (grpslen); + if (number == 0) + { + fprintf (stderr, _("Enumeration not supported on %s\n"), "initgroups"); + return 3; + } + for (int i = 0; i < number; ++i) { int no = ngrps; diff --git a/libc/nss/makedb.c b/libc/nss/makedb.c index baa08bce1..e7bd8f858 100644 --- a/libc/nss/makedb.c +++ b/libc/nss/makedb.c @@ -845,7 +845,7 @@ set_file_creation_context (const char *outname, mode_t mode) /* Check if SELinux is enabled, and remember. */ if (enabled == 0) - enabled = is_selinux_enabled (); + enabled = is_selinux_enabled () ? 1 : -1; if (enabled < 0) return; diff --git a/libc/nss/nss_files/files-XXX.c b/libc/nss/nss_files/files-XXX.c index 1a6fa0ddd..8db052903 100644 --- a/libc/nss/nss_files/files-XXX.c +++ b/libc/nss/nss_files/files-XXX.c @@ -77,7 +77,7 @@ internal_setent (int stayopen) if (stream == NULL) { - stream = fopen (DATAFILE, "re"); + stream = fopen (DATAFILE, "rce"); if (stream == NULL) status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL; diff --git a/libc/nss/nss_files/files-alias.c b/libc/nss/nss_files/files-alias.c index 714299aad..023021e6c 100644 --- a/libc/nss/nss_files/files-alias.c +++ b/libc/nss/nss_files/files-alias.c @@ -48,7 +48,7 @@ internal_setent (void) if (stream == NULL) { - stream = fopen ("/etc/aliases", "re"); + stream = fopen ("/etc/aliases", "rce"); if (stream == NULL) status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL; @@ -258,7 +258,7 @@ get_next_alias (const char *match, struct aliasent *result, first_unused = cp; - listfile = fopen (&cp[9], "r"); + listfile = fopen (&cp[9], "rce"); /* If the file does not exist we simply ignore the statement. */ if (listfile != NULL diff --git a/libc/nss/nss_files/files-initgroups.c b/libc/nss/nss_files/files-initgroups.c index c343b35e5..3a3b5c1e3 100644 --- a/libc/nss/nss_files/files-initgroups.c +++ b/libc/nss/nss_files/files-initgroups.c @@ -30,7 +30,7 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start, long int *size, gid_t **groupsp, long int limit, int *errnop) { - FILE *stream = fopen ("/etc/group", "re"); + FILE *stream = fopen ("/etc/group", "rce"); if (stream == NULL) { *errnop = errno; @@ -73,7 +73,7 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start, if (buffer_use_malloc || ! __libc_use_alloca (buflen + newbuflen)) { void *newbuf = realloc (buffer_use_malloc ? buffer : NULL, - buflen); + newbuflen); if (newbuf == NULL) { *errnop = ENOMEM; diff --git a/libc/nss/nss_files/files-key.c b/libc/nss/nss_files/files-key.c index fb108c809..cb3920482 100644 --- a/libc/nss/nss_files/files-key.c +++ b/libc/nss/nss_files/files-key.c @@ -33,7 +33,7 @@ extern int xdecrypt (char *, char *); static enum nss_status search (const char *netname, char *result, int *errnop, int secret) { - FILE *stream = fopen (DATAFILE, "re"); + FILE *stream = fopen (DATAFILE, "rce"); if (stream == NULL) return errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL; diff --git a/libc/nss/nss_files/files-netgrp.c b/libc/nss/nss_files/files-netgrp.c index 4b5d774fd..f70196bc7 100644 --- a/libc/nss/nss_files/files-netgrp.c +++ b/libc/nss/nss_files/files-netgrp.c @@ -1,5 +1,5 @@ /* Netgroup file parser in nss_files modules. - Copyright (C) 1996, 1997, 2000, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2000, 2004, 2005, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -63,7 +63,7 @@ _nss_files_setnetgrent (const char *group, struct __netgrent *result) return NSS_STATUS_UNAVAIL; /* Find the netgroups file and open it. */ - fp = fopen (DATAFILE, "r"); + fp = fopen (DATAFILE, "rce"); if (fp == NULL) status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL; else diff --git a/libc/nss/nsswitch.c b/libc/nss/nsswitch.c index 06995bda6..674b3d32c 100644 --- a/libc/nss/nsswitch.c +++ b/libc/nss/nsswitch.c @@ -574,7 +574,7 @@ nss_parse_file (const char *fname) size_t len; /* Open the configuration file. */ - fp = fopen (fname, "rc"); + fp = fopen (fname, "rce"); if (fp == NULL) return NULL; |