Bug 176449 - zfs(1): ZFS NFS export went wrong with special hostname character
Summary: zfs(1): ZFS NFS export went wrong with special hostname character
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 9.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-26 20:10 UTC by everytrash
Modified: 2018-05-28 19:47 UTC (History)
4 users (show)

See Also:


Attachments
Patch cddl/compat/opensolaris/misc/fsshare.c for saner options parsing (1002 bytes, patch)
2016-03-06 07:20 UTC, Martin Birgmeier
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description everytrash 2013-02-26 20:10:01 UTC
"zfs set" write a wrong entry in "etc/zfs/exports" when the command
contains a "-" character in the hostname.

Fix: 

Complement the "-" character manually into the "etc/zfs/exports" file.

--------------------------------------------------------------------
root@XXX ~ # cat /etc/zfs/exports
# !!! DO NOT EDIT THIS FILE MANUALLY !!!
/nfs    -maproot=root xxxxxx-01
--------------------------------------------------------------------

--------------------------------------------------------------------
root@XXX ~ # service mountd reload
--------------------------------------------------------------------

--------------------------------------------------------------------
root@XXX ~ # showmount -e
Exports list on localhost:
/nfs                               xxxxxx-01
--------------------------------------------------------------------
How-To-Repeat: --------------------------------------------------------------------
root@XXX ~ # zfs set sharenfs="-maproot=root xxxxxx-01" tank/nfs
--------------------------------------------------------------------

--------------------------------------------------------------------
root@XXX ~ # cat /etc/zfs/exports
# !!! DO NOT EDIT THIS FILE MANUALLY !!!
/nfs    -maproot=root xxxxxx 01 
--------------------------------------------------------------------

--------------------------------------------------------------------
root@XXX ~ # showmount -e
Exports list on localhost:
--------------------------------------------------------------------
Comment 1 Harrison Grundy 2014-12-16 15:19:21 UTC
Still occurs on 10_RELEASE
Comment 2 everytrash 2016-01-18 07:16:49 UTC
Any new information? It's almost 3 years now :)
Comment 3 Martin Birgmeier 2016-03-06 07:20:59 UTC
Created attachment 167756 [details]
Patch cddl/compat/opensolaris/misc/fsshare.c for saner options parsing

Please use the attached patch.

-- Martin
Comment 4 eborisch+FreeBSD 2016-03-07 16:44:11 UTC
Duplicate of bug #168158?
Comment 5 Martin Birgmeier 2016-11-03 19:12:18 UTC
May I suggest that my patch be committed and then this issue closed?

-- Martin
Comment 6 eborisch+FreeBSD 2016-11-03 22:46:19 UTC
(In reply to Martin Birgmeier from comment #5)

Is there a case my (smaller) patch doesn't handle?

https://bz-attachments.freebsd.org/attachment.cgi?id=158168
(Attached to bug #168158)
Comment 7 Martin Birgmeier 2016-11-04 15:52:38 UTC
It's been a while... if I remember correctly I wanted to preserve options not in the list of known options but already starting with a dash.

-- Martin
Comment 8 eborisch+FreeBSD 2016-11-05 01:42:38 UTC
(In reply to Martin Birgmeier from comment #7)

The current behavior strips leading dashes from un-recognized options.

Input                  = -foo -ro  mapall test_host test-host
current output         =  foo -ro -mapall test_host test host
w/patch in bug #168158 =  foo -ro -mapall test_host test-host
w/patch in bug #176449 = -foo -ro -mapall test_host test-host

So the other patch is minimal change (only fixes preserving dashes inside host names) while the patch here also passes unrecognized options with leading dashes.

Not sure which is preferred in this case; stripping the dash is likely not optimal from a security point of view, as -foo becomes the hostname foo... Should it perhaps remove strings that look like options but aren't recognized? Or pass them as (invalid) arguments into exports?
Comment 9 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:47:33 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.