Assign default security flavor when converting old export args

vfs_export requires security flavors be explicitly listed when
exporting as of r360900.

Use the default AUTH_SYS flavor when converting old export args to
ensure compatibility with the legacy mount syscall.

Reported by:	rmacklem
Reviewed by:	rmacklem
Approved by:	mav (mentor)
MFC after:	3 days
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D25045
This commit is contained in:
Ryan Moeller 2020-06-01 18:43:51 +00:00
parent 9ec71596c0
commit 1cfffed85d

View File

@ -2343,10 +2343,22 @@ kernel_vmount(int flags, ...)
return (error);
}
/*
* Convert the old export args format into new export args.
*
* The old export args struct does not have security flavors. Otherwise, the
* structs are identical. The default security flavor 'sys' is applied when
* the given args export the filesystem.
*/
void
vfs_oexport_conv(const struct oexport_args *oexp, struct export_args *exp)
{
bcopy(oexp, exp, sizeof(*oexp));
exp->ex_numsecflavors = 0;
if (exp->ex_flags & MNT_EXPORTED) {
exp->ex_numsecflavors = 1;
exp->ex_secflavors[0] = AUTH_SYS;
} else {
exp->ex_numsecflavors = 0;
}
}