libjail: fix handling of allow.mount.fusefs in jailparam_init

fusefs is inconsistently named. The kernel module is named "fuse", but the
mount helper is named "mount_fusefs" and the jail(8) parameter is named
"allow.mount.fusefs". Special case it in libjail.

Reviewed by:	jamie
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D17929
This commit is contained in:
Alan Somers 2018-11-10 03:10:22 +00:00
parent 86af1d0241
commit 98f8234b13
1 changed files with 11 additions and 3 deletions

View File

@ -1050,10 +1050,18 @@ kldload_param(const char *name)
kl = kldload(name);
else if (strncmp(name, "allow.mount.", 12) == 0) {
/* Load the matching filesystem */
kl = kldload(name + 12);
const char *modname;
if (strcmp("fusefs", name + 12) == 0 ||
strcmp("nofusefs", name + 12) == 0) {
modname = "fuse";
} else {
modname = name + 12;
}
kl = kldload(modname);
if (kl < 0 && errno == ENOENT &&
strncmp(name + 12, "no", 2) == 0)
kl = kldload(name + 14);
strncmp(modname, "no", 2) == 0)
kl = kldload(modname + 2);
} else {
errno = ENOENT;
return (-1);