diff mbox

Use a named constant for max number of managed groups, and increase it.

Message ID E1Q5EOD-0001a7-IQ@seldlx2151.corpusers.net (mailing list archive)
State New, archived
Headers show

Commit Message

Sean Finney March 29, 2011, 7:48 a.m. UTC
None
diff mbox

Patch

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;