2011-03-31 09:42:07

by Sean Finney

[permalink] [raw]
Subject: [PATCH] Use a named constant for max number of managed groups, and increase it.

---
utils/mountd/cache.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 9bbbfb3..75a1052 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -37,6 +37,7 @@
#include "blkid/blkid.h"
#endif

+#define MAX_MANAGED_GROUPS 1000

enum nfsd_fsid {
FSID_DEV = 0,
@@ -127,8 +128,8 @@ void auth_unix_gid(FILE *f)
*/
int uid;
struct passwd *pw;
- gid_t glist[100], *groups = glist;
- int ngroups = 100;
+ gid_t glist[MAX_MANAGED_GROUPS], *groups = glist;
+ int ngroups = MAX_MANAGED_GROUPS;
int rv, i;
char *cp;

@@ -144,7 +145,7 @@ void auth_unix_gid(FILE *f)
rv = -1;
else {
rv = getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups);
- if (rv == -1 && ngroups >= 100) {
+ if (rv == -1 && ngroups >= MAX_MANAGED_GROUPS) {
groups = malloc(sizeof(gid_t)*ngroups);
if (!groups)
rv = -1;
--
1.7.2.3