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.

(cherry picked from commit 7c5146da128688ba2bb6bdad5e98716087a47281)

Details

Provenance
Dan Mcgregor <dan.mcgregor_usask.ca>Authored on Nov 4 2023, 10:07 PM
rmacklemCommitted on Dec 22 2023, 8:42 PM
Parents
rGc6e072f15c98: memfd_create: don't allocate heap memory
Branches
Unknown
Tags
Unknown