Since mnt_flags was upgraded to 64bits there has been a quirk in "struct export_args", since
it holds a copy of mnt_flags in ex_flags, which is an "int" (32bits).
This happens to currently work, since all the flag bits used in ex_flags are defined in the low
order 32bits. However, new export flags cannot be defined.
Also, ex_anon is a "struct xucred", which limits it to 16 additional groups.
This patch revises "struct export_args" to make ex_flags 64bits and replaces ex_anon with
ex_uid, ex_ngroups and ex_groups (which points to a groups list, so it can be malloc'd up to NGROUPS
in size.
This requires that the VFS_CHECKEXP() arguments change, so I also modified the last "secflavors"
argument to be an array pointer, so that the secflavors could be copied in VFS_CHECKEXP() while
the export entry is locked. (Without this patch VFS_CHECKEXP() returns a pointer to the secflavors
array and then it is used after being unlocked, which is potentially a problem if the exports entry
is changed. In practice this does not occur when mountd is run with "-S", but I think it is worth fixing.)
For mountd.c, I replaced "struct xucred" with a locally defined "struct expcred" that handles NGROUPS
groups. As coded in this patch, this does make the "exportlist" and "grouplist" structures about 4K larger,
but keeps the patch pretty straightforward.
I have also coded a version that has a small 16 entry groups list and then malloc's an array for larger
groups lists. This keeps the above structures from growing, but makes the code more complex
(and I'm not sure I got it right;-) because it must free() the malloc'd group arrays at the correct places.
If you think doing this is preferable, I can pursue this variant of the mountd patch.