]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Modify mountd.c so that it does not always malloc 4K for the map credentials.
authorRick Macklem <rmacklem@FreeBSD.org>
Sat, 10 Oct 2020 00:01:40 +0000 (00:01 +0000)
committerRick Macklem <rmacklem@FreeBSD.org>
Sat, 10 Oct 2020 00:01:40 +0000 (00:01 +0000)
commit2ffad162f3e81947060c96651a6a8e2b03fbd1e2
tree5a8de0b6aa880924b2bb3d43dbbf77a86b76a3de
parentc2c6fb90e050da355c44d11654162f8af8d456d3
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