Cyrus IMAPd 2.3.10 Released

Hajimu UMEMOTO ume at mahoroba.org
Fri Oct 26 12:14:26 EDT 2007


Hi,

>>>>> On Thu, 25 Oct 2007 23:03:35 -0400
>>>>> Ken Murchison <murch at andrew.cmu.edu> said:

murch> John Capo wrote:
> On Thu, October 25, 2007 21:10, John Capo wrote:
>> Quoting Ken Murchison (murch at andrew.cmu.edu):
>>
>>> Simon Matter wrote:
>>>
>>>>> On the Linux box, all fresh compilations aside from the sasl 2.1.15 binaries:
>>>>>
>>>> I once posted to the list that 2.3.9 needs at least cyrus-sasl-2.1.19. As a package
>>>> maintainer I know that :)
>>> Did you ever figure out why?  I'm not surprised that code in Cyrus somehow depends on
>>> a change in SASL, but I can't seem to find anything in the CVS logs or diffs that
>>> would be the cause.
>> This is what I had to do for cmd_login to work in 2.3.9.
>>
>>
>> /* authstate already created by mysasl_proxy_policy() */
>> /* Not when using login and allowplaintext.  imapd_authstate is NULL  TM Login fix */
>> if (imapd_authstate == NULL)
>>     imapd_authstate = auth_newstate(imapd_userid);
>>
>> But 2.3.10 cores :-(
> 
> Its coring in getgrouplist() probably because the 3rd argyument is NULL.
> 
>     /* get number of groups user is member of into ngroups */
>     getgrouplist(identifier, gid, NULL, &ngroups);
> 
> BSD man page does not indicate that NULL args are OK.
> 
>   int
>   getgrouplist(const char *name, int basegid, int *groups, int *ngroups);
> 
>  The resulting group list is returned in the integer array pointed to by
>  groups.  The caller specifies the size of the groups array in the integer
>  pointed to by ngroups; the actual number of groups found is returned in
>  ngroups.


murch> See if this fixes the getgrouplist() problem:

murch> --- auth_unix.c.~1.46.~	2007-09-27 16:02:45.000000000 -0400
murch> +++ auth_unix.c	2007-10-25 23:02:15.000000000 -0400
murch> @@ -225,7 +225,7 @@
murch>       struct group *grp;
murch>   #ifdef HAVE_GETGROUPLIST
murch>       gid_t gid, *groupids = NULL;
murch> -    int ret, ngroups = 0;
murch> +    int ret, ngroups = 10;
murch>   #else
murch>       char **mem;
murch>   #endif
murch> @@ -248,10 +248,7 @@
murch>   #ifdef HAVE_GETGROUPLIST
murch>       gid = pwd ? pwd->pw_gid : (gid_t) -1;

murch> -    /* get number of groups user is member of into ngroups */
murch> -    getgrouplist(identifier, gid, NULL, &ngroups);
murch> -
murch> -    /* get the actual group ids */
murch> +    /* get the group ids */
murch>       do {
murch>   	groupids = (gid_t *)xrealloc((gid_t *)groupids,
murch>   				     ngroups * sizeof(gid_t));

The NGROUPS is defined in sys/param.h on BSDs as:

	#define	NGROUPS		NGROUPS_MAX	/* max number groups */

The NGROUPS_MAX is defined in sys/syslimits.h as:

	#define	NGROUPS_MAX	   16	/* max supplemental group id's */

and, sys/syslimits.h is included from sys/param.h.  So, you should use
this instead of a magic number, IMHO.

FYI: Though FreeBSD's getgrouplist() doesn't accept NULL for `groups',
it seems NetBSD's one accepts NULL.

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