Skip to content

Commit

Permalink
Fix handling of DNS names with '-' in them for sharenfs
Browse files Browse the repository at this point in the history
An old FreeBSD bugzilla report PR#168158 notes that DNS
names with '-'s in them cannot be used for the sharenfs
property.  This patch fixes the parsing of these DNS names.
The only negative affect this patch might have is that,
if a user has incorrectly separated options with a '-'
the sharenfs setting will no longer work once this patch
is applied.

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Rick Macklem <rmacklem@uoguelph.ca>
Closes openzfs#16529
  • Loading branch information
rmacklem authored and tonyhutter committed Nov 5, 2024
1 parent c25d514 commit 2dc8529
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/libshare/os/freebsd/nfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ translate_opts(const char *shareopts, FILE *out)
strlcpy(oldopts, shareopts, sizeof (oldopts));
newopts[0] = '\0';
s = oldopts;
while ((o = strsep(&s, "-, ")) != NULL) {
while ((o = strsep(&s, ", ")) != NULL) {
if (o[0] == '-')
o++;
if (o[0] == '\0')
continue;
for (i = 0; i < ARRAY_SIZE(known_opts); ++i) {
Expand Down

0 comments on commit 2dc8529

Please sign in to comment.