]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Modify mountd.c so that it does not always malloc 4K for the map credentials.
authorrmacklem <rmacklem@FreeBSD.org>
Sat, 10 Oct 2020 00:01:40 +0000 (00:01 +0000)
committerrmacklem <rmacklem@FreeBSD.org>
Sat, 10 Oct 2020 00:01:40 +0000 (00:01 +0000)
commitf57373275cb0d56e6d7cf21e2b68f7f305c76128
tree5a8de0b6aa880924b2bb3d43dbbf77a86b76a3de
parent0bff2b9c64df44c76e49116c5418e6f0f7879b96
Modify mountd.c so that it does not always malloc 4K for the map credentials.

r362163 upgraded mountd so that it could handle MAX_NGROUPS
groups for the anonymous user credentials (the ones provided by
-maproot and -mapall exports options).
The problem is that this resulted in every export structure growing by
about 4Kbytes, because the cr_groups field went from 16->MAX_NGROUPS.

This patch fixes this by only including a small 32 element cr_groups in the
structure and then malloc()'ng cr_groups when a larger one is needed.
The value of SMALLNGROUPS is arbitrarily set to 32, assuming most users
used by -maproot or -mapall will be in <= 32 groups.

Reviewed by: kib, freqlabs
Differential Revision: https://reviews.freebsd.org/D26521
usr.sbin/mountd/mountd.c