aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/mountd/mountd.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c
index 36b3659ea4871..d119bb9199d6b 100644
--- a/usr.sbin/mountd/mountd.c
+++ b/usr.sbin/mountd/mountd.c
@@ -3434,10 +3434,16 @@ parsecred(char *namelist, struct xucred *cr)
/*
* Compress out duplicate.
*/
- cr->cr_ngroups = ngroups - 1;
cr->cr_groups[0] = groups[0];
- for (cnt = 2; cnt < ngroups; cnt++)
- cr->cr_groups[cnt - 1] = groups[cnt];
+ if (ngroups > 1 && groups[0] == groups[1]) {
+ cr->cr_ngroups = ngroups - 1;
+ for (cnt = 2; cnt < ngroups; cnt++)
+ cr->cr_groups[cnt - 1] = groups[cnt];
+ } else {
+ cr->cr_ngroups = ngroups;
+ for (cnt = 1; cnt < ngroups; cnt++)
+ cr->cr_groups[cnt] = groups[cnt];
+ }
return;
}
/*