diff options
| author | Casper H.S. Dik <Casper.Dik@Sun.COM> | 2009-11-20 20:58:43 +0100 |
|---|---|---|
| committer | Casper H.S. Dik <Casper.Dik@Sun.COM> | 2009-11-20 20:58:43 +0100 |
| commit | 67dbe2be0c0f1e2eb428b89088bb5667e8f0b9f6 (patch) | |
| tree | ae276da3565da2f00f984253f7b5da205d4384c5 /usr/src/ucbcmd | |
| parent | f73ae3db72a91f9f8759931a1c643c7dad785881 (diff) | |
| download | illumos-joyent-67dbe2be0c0f1e2eb428b89088bb5667e8f0b9f6.tar.gz | |
PSARC 2009/542 Increase the maximum value of NGROUPS_MAX to 1024
4088757 Customer would like to increase ngroups_max more than 32
6853435 Many files incorrectly include the private <sys/cred_impl.h>
Diffstat (limited to 'usr/src/ucbcmd')
| -rw-r--r-- | usr/src/ucbcmd/groups/groups.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/usr/src/ucbcmd/groups/groups.c b/usr/src/ucbcmd/groups/groups.c index 396e69f744..26b0d618a8 100644 --- a/usr/src/ucbcmd/groups/groups.c +++ b/usr/src/ucbcmd/groups/groups.c @@ -1,5 +1,5 @@ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -13,14 +13,13 @@ * specifies the terms and conditions for redistribution. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * groups */ #include <sys/types.h> #include <sys/param.h> +#include <alloca.h> #include <grp.h> #include <pwd.h> #include <stdio.h> @@ -36,7 +35,10 @@ main(int argc, char *argv[]) int ngroups, i; char *sep = ""; struct group *gr; - gid_t groups[NGROUPS_UMAX]; + gid_t *groups; + int maxgrp = sysconf(_SC_NGROUPS_MAX); + + groups = alloca(maxgrp * sizeof (gid_t)); if (argc > 1) { for (i = 1; i < argc; i++) @@ -44,7 +46,7 @@ main(int argc, char *argv[]) exit(0); } - ngroups = getgroups(NGROUPS_UMAX, groups); + ngroups = getgroups(maxgrp, groups); if (getpwuid(getuid()) == NULL) { (void) fprintf(stderr, "groups: could not find passwd entry\n"); exit(1); @@ -86,9 +88,9 @@ showgroups(char *user) * To avoid duplicate group entries */ if (pwgid_printed == 0) { - (void) printf("%s%s", sep, gr->gr_name); - sep = " "; - pwgid_printed = 1; + (void) printf("%s%s", sep, gr->gr_name); + sep = " "; + pwgid_printed = 1; } continue; } |
