Hi,

During testing of a mountd.c patch I have, I found an "old bug" where the
mountd.c code assumed that getgrouplist() would always duplicate
cr_groups[0] in cr_groups[1].

If I read the commit logs correctly, this was always the case until
r174547 (only 12years ago), which switched getgrouplist() to
use __getgroupmembership().
Kirk fixed the deduplication code in gr_addgid() in r328304 so that
gr_addgid() would not deduplicate cr_groups[0,1].
However, the case where the "user" is not also listed in the group
database for the same group as their gid in the password database
will not be duplicated.
--> It also implies that getgrouplist() can return with ngroups == 1,
      with only the basegid in it.

So, is getgrouplist(3) always returning with cr_groups[0] and cr_groups[1]
duplicated required behaviour?

If the duplication is not required, then I can easily fix mountd to
check for the non-duplicated case.
I will probably patch it anyhow, since the one line change will be
harmless even if getgrouplist() is changed to always return the
duplicate of cr_groups[0] in cr_groups[1].

rick

_______________________________________________
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to