From patchwork Wed Jun 1 18:57:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 841452 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p51IwI0k002174 for ; Wed, 1 Jun 2011 18:58:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753444Ab1FAS6R (ORCPT ); Wed, 1 Jun 2011 14:58:17 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:48073 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752942Ab1FAS6R (ORCPT ); Wed, 1 Jun 2011 14:58:17 -0400 Received: by bwz15 with SMTP id 15so307379bwz.19 for ; Wed, 01 Jun 2011 11:58:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:subject:date:message-id:x-mailer; bh=jVIyDjxA+ZgI/yMjhEhEHz/v8kkOde7eMseO/kstEog=; b=vJ5UrGAst148xMXGhmVPIQKuUwWIOGl7DPLutoBKnygPwUd/c0RYBQdu2I/PI+5Tve mDYv5piGKI6yAAuD+4iiCm+LruE5a4cIFk2budaWi+jB+PqFg9YTkSFlNH9FoBASuCXq M1xNW1e3leKMXs4EtgE4tl6+doi5ml97V5txQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer; b=RF1vl9R4hg1SFONVJHXVzG9m4coqfL/1fFq9AKZFPQ66oHPwhcy+Ggf71ZTWwKEfFP udbo633XmIftZAquYD6UiI99Xf2debb0cYXxn+rmjIH7nZdCwp+C9JYj3xrfIuMVsNMo yYBwHqI3DRPip112p0da6W+xQaZU2HxcIOc6w= Received: by 10.204.187.129 with SMTP id cw1mr5326904bkb.80.1306954696077; Wed, 01 Jun 2011 11:58:16 -0700 (PDT) Received: from localhost.localdomain ([79.126.74.219]) by mx.google.com with ESMTPS id k16sm1065345bks.13.2011.06.01.11.58.14 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Jun 2011 11:58:15 -0700 (PDT) From: Pavel Shilovsky To: linux-nfs@vger.kernel.org Subject: [PATCH] mountd: Fix missing varialble assignment in auth_unix_gid Date: Wed, 1 Jun 2011 22:57:21 +0400 Message-Id: <1306954641-2560-1-git-send-email-piastry@etersoft.ru> X-Mailer: git-send-email 1.7.1 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 (demeter2.kernel.org [140.211.167.43]); Wed, 01 Jun 2011 18:58:19 +0000 (UTC) When we get into auth_unix_gid at the second time, groups_len is not 0 and ngroups variable leave as 0. Then we use ngroups in getgrouplist that fails in this case. This patch fixes it. Signed-off-by: Pavel Shilovsky --- utils/mountd/cache.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index df6b38f..dbe20e9 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -138,7 +138,7 @@ static void auth_unix_gid(FILE *f) static gid_t *groups = NULL; static int groups_len = 0; gid_t *more_groups; - int ngroups = 0; + int ngroups; int rv, i; char *cp; @@ -147,9 +147,11 @@ static void auth_unix_gid(FILE *f) if (!groups) return; - groups_len = ngroups = INITIAL_MANAGED_GROUPS; + groups_len = INITIAL_MANAGED_GROUPS; } + ngroups = groups_len; + if (readline(fileno(f), &lbuf, &lbuflen) != 1) return;