From patchwork Wed Jun 1 18:49:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 841442 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 p51IojKG025827 for ; Wed, 1 Jun 2011 18:50:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753628Ab1FASun (ORCPT ); Wed, 1 Jun 2011 14:50:43 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:38884 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752509Ab1FASul (ORCPT ); Wed, 1 Jun 2011 14:50:41 -0400 Received: by bwz15 with SMTP id 15so302255bwz.19 for ; Wed, 01 Jun 2011 11:50:40 -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=j1syq9s1m7b/M5FSdgocXKInSrghdbvPTW8Za+Jzsq31MI+d3WIlD5Xq1aekZ2KCCU c9/3NSnzrWNT0gCeOpeDC83TtXkAkSlAIHars2SDB/XmZMRE8HaPersOUizu0kyzrQ9a i0tIi1Mfz2lRFFer26X2suEHAg5/ZSPxJDttM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer; b=yDU1ud/mvbAOjazdWUvm5SBYBOkJ0eyqgKzIIy6naVJEzzyPUENoO3YMa8BmcxhZWl cvRcSF/hD76nsG0byW8Xl79y7BP0Bl6iOiiwcMRwoRURq1BM1i0L2pvxrKvw+Mrx/shy bb2h+8Kut94Ics6Pk7G6xqscxCn5BX296xN/Q= Received: by 10.204.16.198 with SMTP id p6mr1605365bka.143.1306954239878; Wed, 01 Jun 2011 11:50:39 -0700 (PDT) Received: from localhost.localdomain ([79.126.74.219]) by mx.google.com with ESMTPS id k16sm1068600bks.1.2011.06.01.11.50.38 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Jun 2011 11:50:39 -0700 (PDT) From: Pavel Shilovsky To: linux-nfs@vger.kernel.org Subject: [PATCH] mountd: Fix missing varialble assigment in auth_unix_gid Date: Wed, 1 Jun 2011 22:49:54 +0400 Message-Id: <1306954194-2392-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:50:45 +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;