summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2007-06-14 20:07:35 +0000
committerharti <harti@FreeBSD.org>2007-06-14 20:07:35 +0000
commit8016b195e6d8f54345e22680574432142a33d2e0 (patch)
tree508cff6fe4b1e4fed7e9b6d7a150c1bf7c6af2e2 /lib
parentf1a585dc5124f5a09be3b5e34d314a35be605730 (diff)
downloadFreeBSD-src-8016b195e6d8f54345e22680574432142a33d2e0.zip
FreeBSD-src-8016b195e6d8f54345e22680574432142a33d2e0.tar.gz
Use an array of size NGROUP_MAX for the getgroups() call instead of NGRP.
When NGROUP_MAX is larger than NGRP the call used to fail. Now the call succeedes, but only the first NGRP groups are actually used for authentication.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/rpc/auth_unix.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/rpc/auth_unix.c b/lib/libc/rpc/auth_unix.c
index 3fcccd4..5801015 100644
--- a/lib/libc/rpc/auth_unix.c
+++ b/lib/libc/rpc/auth_unix.c
@@ -189,15 +189,17 @@ authunix_create_default()
char machname[MAXHOSTNAMELEN + 1];
uid_t uid;
gid_t gid;
- gid_t gids[NGRPS];
+ gid_t gids[NGROUPS_MAX];
if (gethostname(machname, sizeof machname) == -1)
abort();
machname[sizeof(machname) - 1] = 0;
uid = geteuid();
gid = getegid();
- if ((len = getgroups(NGRPS, gids)) < 0)
+ if ((len = getgroups(NGROUPS_MAX, gids)) < 0)
abort();
+ if (len > NGRPS)
+ len = NGRPS;
/* XXX: interface problem; those should all have been unsigned */
return (authunix_create(machname, (int)uid, (int)gid, len,
(int *)gids));
OpenPOWER on IntegriCloud