This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Re: setgroups
Corinna Vinschen wrote:
> > Here is setgroups.
>
> Why did you add a class cygsidarray while there's already a class
> cygsidlist?
>
> I'm sorry but it would really be helpful if you could add a few
> words about what you did. The patch is not that small and
> contains more than just a new function setgroups()... E. g. what
> is the rational to divide get_group_sidlist into three functions?
The idea is that setgroups finds the group sids in /etc/group and stores
them in a structure in cygheap->user. That structure must be cmalloc'ed,
hence the new class. The primary group sid is also stored there,
which requires minor changes in internal_getlogin and setegid.
setgroups returns an error if sids are not in /etc/group.
When seteuid is called, create_token checks if setgroups was called.
+ If not, it does exactly as before and calls the former get_group_sidlist,
which is broken into get_initgroups_sidlist and get_token_group_sidlist
for software reuse reasons (see below).
+ If setgroups has been called, create_token calls get_setgroups_sidlist,
which copies the group sids from the cygheap to the temporary cygsidlist
and which also calls get_token_group_sidlist (reuse software).
Sorry if this is too terse, I'd be happy to answer more questions.
Pierre