This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] nsswitch: Add group merging support
- From: Andreas Schwab <schwab at linux-m68k dot org>
- To: Stephen Gallagher <sgallagh at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 06 Jan 2016 23:40:52 +0100
- Subject: Re: [PATCH] nsswitch: Add group merging support
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 10 dot 1601041541410 dot 24114 at digraph dot polyomino dot org dot uk> <1451929217-18055-1-git-send-email-sgallagh at redhat dot com>
Stephen Gallagher <sgallagh@redhat.com> writes:
> diff --git a/grp/getgrgid_r.c b/grp/getgrgid_r.c
> index 05d4d772d3ef0bfae8f9375387c41310885ce41a..5bd32b9881e54a46262df668542d5f925c44dd93 100644
> --- a/grp/getgrgid_r.c
> +++ b/grp/getgrgid_r.c
> @@ -16,14 +16,18 @@
> License along with the GNU C Library; if not, see
> <http://www.gnu.org/licenses/>. */
>
> #include <grp.h>
>
> +#include "grp-merge.h"
> +
>
Spurious empty line.
> +#define BUFCHECK(size) \
> + do { \
> + if (c + size > buflen) { \
> + free (members); \
> + return ERANGE; \
> + } \
> + } while(0)
Wrong brace style.
> +
> + /* Copy all of the group members to destbuf and add a pointer to each of
> + them into the 'members' array. */
> + for (i = 0; srcgrp.gr_mem[i]; i++)
> + {
> + len = sizeof (char) * (strlen (srcgrp.gr_mem[i]) + 1);
sizeof (char) is 1. Drop it.
> + /* Allocate a temporary holding area for the pointers to the member
> + contents, including space for a NULL-terminator. */
> + members = malloc (sizeof (char *) * (memcount + 1));
> + if (members == NULL)
> + return ENOMEM;
Wrong indent.
> + if (endptr)
> + *endptr = destbuf + c;
Likewise. (And several more.)
> + if (nss_next_action (*nip, status) == NSS_ACTION_MERGE)
> + {
> + /* This is a special-case. When [SUCCESS=merge] is in play,
> + _nss_next2() will skip to the next database. Due to the
> + implementation of that function, we can't know whether we're
> + in an enumeration or an individual lookup, which behaves
> + differently with regards to merging. We'll treat SUCCESS as
> + an indication to start the enumeration at this database.
> + */
No NL before */.
> + if (status == NSS_STATUS_SUCCESS
> + && nss_next_action (*nip, status) == NSS_ACTION_MERGE)
> + {
> + /* This is a special-case. When [SUCCESS=merge] is in play,
> + _nss_next2() will skip to the next database. Due to the
> + implementation of that function, we can't know whether we're
> + in an enumeration or an individual lookup, which behaves
> + differently with regards to merging. We'll treat SUCCESS as
> + an indication to return the results here.
> + */
Likewise.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."