From patchwork Tue Mar 29 07:48:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Finney X-Patchwork-Id: 678771 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2V9g9le012050 for ; Thu, 31 Mar 2011 09:42:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757027Ab1CaJmI (ORCPT ); Thu, 31 Mar 2011 05:42:08 -0400 Received: from seldrel01.sonyericsson.com ([212.209.106.2]:13028 "EHLO seldrel01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752884Ab1CaJmH (ORCPT ); Thu, 31 Mar 2011 05:42:07 -0400 Message-ID: From: Sean Finney Date: Tue, 29 Mar 2011 09:48:36 +0200 Subject: [PATCH] Use a named constant for max number of managed groups, and increase it. To: linux-nfs@vger.kernel.org MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 31 Mar 2011 09:42:09 +0000 (UTC) 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;