HomeFreeBSD

mountd: Add support for spaces in exported directories

Description

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

Details

Provenance
Dan Mcgregor <dan.mcgregor_usask.ca>Authored on Nov 4 2023, 10:07 PM
rmacklemCommitted on Nov 4 2023, 10:07 PM
Reviewer
rmacklem
Differential Revision
D42432: mountd: Allow spaces in directory paths
Parents
rGbb830e346bd5: tty: set IUTF8 by default
Branches
Unknown
Tags
Unknown