Cyrus IMAPd 2.3.10 Released
Hajimu UMEMOTO
ume at mahoroba.org
Fri Oct 26 15:04:28 EDT 2007
Hi,
>>>>> Sat, 27 Oct 2007 02:31:32 +0900,
>>>>> Hajimu UMEMOTO <ume at mahoroba.org> said:
ume> The code is suspicious to me. Isn't the test of `ret != -1' is
ume> opposite?
ume> Further, it seems that the test of `ngroups == newstate->ngroups'
ume> assumes that newstate->ngroups holds the actual number of groups
ume> found, by calling getgrouplist() in the first place.
ume> Perhaps, it should be:
ume> do {
ume> groupids = (gid_t *)xrealloc((gid_t *)groupids,
ume> ngroups * sizeof(gid_t));
ume> newstate->ngroups = ngroups; /* copy of ngroups for comparision */
ume> ret = getgrouplist(identifier, gid, groupids, &ngroups);
ume> /*
ume> * This is tricky. We do this as long as getgrouplist tells us to
ume> * realloc _and_ the number of groups changes. It tells us to realloc
ume> * also in the case of failure...
ume> */
ume> } while (ret == -1 && ngroups == newstate->ngroups);
ume> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ume> I'm not sure that we can expect `ngroups == newstate->ngroups',
ume> though.
Oops, I forgot to increase ngroups for next attempt.
Sincerely,
--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume at mahoroba.org ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/
More information about the Info-cyrus
mailing list