freebsd-src/usr.sbin/mountd
Dan Mcgregor 7c5146da12 mountd: Add support for spaces in exported directories
The previous code would correctly parse strings including quotation
marks (") or backslash (/), but the tests when creating the export
includes them in the final string. This prevents exporting paths
with embedded spaces, for example "/exports/with space". Trying
results in log lines resembling:

mountd[1337]: bad exports list line '/exports/with\ space':
    /exports/with\ space: lstat() failed: No such file or directory.

Turns out that when creating its exports list, zfs escapes strings
in a format compatible with vis(3). Since I expect that zfs sharenfs
is the dominating use case for generating an exports list, use
strunvis(3) to parse the export path. The result is lines like the
following allowing spaces:

/exports/with\040space -network 192.168.0 -mask 255.255.255.0

A man page update will be done as a separate commit.

MFC after:	1 month
Reviewed by:	rmacklem
Differential Revision:	https://reviews.freebsd.org/D42432
2023-11-04 15:07:56 -07:00
..
exports.5 Remove $FreeBSD$: one-line nroff pattern 2023-08-16 11:55:15 -06:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
mountd.8 Remove $FreeBSD$: one-line nroff pattern 2023-08-16 11:55:15 -06:00
mountd.c mountd: Add support for spaces in exported directories 2023-11-04 15:07:56 -07:00
netgroup.5 Remove $FreeBSD$: one-line nroff pattern 2023-08-16 11:55:15 -06:00
pathnames.h Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:23 -06:00