HomeFreeBSD

cred: crsetgroups(): Throw away old groups before crextend()

Description

cred: crsetgroups(): Throw away old groups before crextend()

Now that crextend() asserts that groups are not set (rightfully so,
since it may change the backing storage without copying the content of
the old one), have crsetgroups() throw away the old groups before
calling it, as it installs an entirely new set anyway.

This allows to reuse unshared credentials by resetting their groups set,
as NFS exports actually do.

Reported by: cy
Tested by: cy
Fixes: ea26c0e79752 ("cred: crextend(): Harden, simplify")
Pointy hat to: olce

While here, as I forgot these credits in commit 5169d4307eb9 ("nfs: Fallback to
GID_NOGROUP on no groups"):
Tested by: cy, David Wolfskill (panics caused by mountd(8))
Tested by: kib (MINIMAL/custom kernel compile breakup)

(cherry picked from commit 169a10853a50f9bbb037492e6f2737cce10f6b99)

Approved by: markj (mentor)

Details

Provenance
olceAuthored on Sun, Nov 3, 6:04 PM
Parents
rG4bef138e8d91: nfs: Fallback to GID_NOGROUP on no groups
Branches
Unknown
Tags
Unknown