ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Pavel Shilovsky <piastry@altlinux.org>
To: ALT Linux Team development discussions <devel@lists.altlinux.org>
Subject: Re: [devel] nfs mountd --manage-gids problem
Date: Wed, 1 Jun 2011 22:25:01 +0400
Message-ID: <BANLkTinT-sWfa_SZGymxQdceARPj_uQUyw@mail.gmail.com> (raw)
In-Reply-To: <BANLkTike4nHgAXgek5ky4c2gcN63=rRzDg@mail.gmail.com>

1 июня 2011 г. 19:11 пользователь Rinat Bikov <becase@altlinux.org> написал:
> 1 июня 2011 г. 16:20 Pavel Shilovsky написал:
>> Собственно вопроса два:
>> 1) чем может быть объяснено такое странное поведение getgrouplist со
>> статик переменными (проверял его отдельно, вне кода mountd)?
> Отладил в gdb, разобрался: ngroups у вас 0 в случае использования
> static при вызове getgrouplist :).
> А это ожидаемая длинна массива :).

Спасибо, я теперь понял в чём дело! Так как groups_len в
последующих вызовах уже не 0, то ngroups не меняется из-за условия:
 145 >-------if (groups_len == 0) {
 146 >------->-------groups = malloc(sizeof(gid_t) * INITIAL_MANAGED_GROUPS);
 147 >------->-------if (!groups)
 148 >------->------->-------return;
 149
 150 >------->-------groups_len = ngroups = INITIAL_MANAGED_GROUPS;
 151 >-------}

Видимо, можно просто наложить такой патч:
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index df6b38f..8248e9c 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -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;

--
Best regards,
Pavel Shilovsky.

  reply	other threads:[~2011-06-01 18:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-01 12:20 Pavel Shilovsky
2011-06-01 15:11 ` Rinat Bikov
2011-06-01 18:25   ` Pavel Shilovsky [this message]
2011-06-09  6:28     ` Pavel Shilovsky
2011-06-09  8:23       ` Sergey Bolshakov
2013-01-11 13:20         ` Evgeny Sinelnikov
2011-06-01 15:23 ` Rinat Bikov
2011-06-01 15:36   ` Rinat Bikov
2011-06-01 15:49 ` Rinat Bikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTinT-sWfa_SZGymxQdceARPj_uQUyw@mail.gmail.com \
    --to=piastry@altlinux.org \
    --cc=devel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git