[PATCH 15/19] id: disable supplementary groups handling for older uClibc versions

Tito farmatito at tiscali.it
Wed Sep 26 11:44:51 UTC 2012


On Wednesday 26 September 2012 11:47:20 walter harms wrote:
> 
> Am 25.09.2012 21:04, schrieb Tito:
> > On Tuesday 25 September 2012 17:52:17 walter harms wrote:
> >>
> >> Am 25.09.2012 14:06, schrieb Florian Fainelli:
> >>> From: Nicolas Thill <nico at openwrt.org>
> >>>
> >>> This patch disable supplementary groups handling in id with uClibc versions
> >>> prior to v0.9.30, which are lacking the 'getgrouplist' function.
> >>>
> >>
> >>
> >> It would be better to have a grouplist function
> >> http://www.koders.com/c/fidDCC4A6314EBE0039D521932F93655B813DBC4105.aspx
> >>
> >> next would be having an "empty" grouplistfunction
> >>
> >> int getgrouplist(const char *user, gid_t group,
> >>                         gid_t *groups, int *ngroups)
> >> {
> >> 	groups=NULL;
> >> 	*ngroups=-1;
> >> 	return 0;
> >> }
> >>
> >> re,
> >>  wh
> 
> > 
> > Hi,
> > an even better solution would be to enable CONFIG_USE_BB_PWD_GRP:
> > use internal password and group functions rather than system functions,
> > that provides  getgrouplist, unless there is some reason not to do so.
> > 
> 
> 
> We already have a getgrouplist() ?
> 
> re,
>  wh

Hi,
yes, we have getgrouplist at /busybox/libpwdgrp/pwd_grp.c

int getgrouplist(const char *user, gid_t gid, gid_t *groups, int *ngroups)
{
	int ngroups_old = *ngroups;
	gid_t *group_list = getgrouplist_internal(ngroups, user, gid);

	if (*ngroups <= ngroups_old) {
		ngroups_old = *ngroups;
		memcpy(groups, group_list, ngroups_old * sizeof(groups[0]));
	} else {
		ngroups_old = -1;
	}
	free(group_list);
	return ngroups_old;
}

Ciao,
Tito


More information about the busybox mailing list