Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 May 2012 07:23:27 GMT
From:      Martin Birgmeier <Martin.Birgmeier@aon.at>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/168158: incorrect parsing of sharenfs options in zfs (fsshare.c)
Message-ID:  <201205200723.q4K7NRU3090017@red.freebsd.org>
Resent-Message-ID: <201205200730.q4K7U2cQ044839@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         168158
>Category:       misc
>Synopsis:       incorrect parsing of sharenfs options in zfs (fsshare.c)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 20 07:30:01 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Martin Birgmeier
>Release:        9.0.0, 8.2.0
>Organization:
MBi at home
>Environment:
FreeBSD hal.xyzzy 8.2-RELEASE FreeBSD 8.2-RELEASE #4: Sat Aug 27 09:30:11 CEST 2011     root@hal.xyzzy:/z/OBJ/FreeBSD/amd64/RELENG_8_2_0_RELEASE/src/sys/XYZZY_SMP  amd64
>Description:
The function translate_opts() in cddl/compat/opensolaris/misc/fsshare.c incorrectly transforms nfs export options. Specifically, it unconditionally separates the input string along hyphens, thereby making it impossible to have a hyphen in a host name (which is allowed, cf. http://tools.ietf.org/html/rfc952 and http://tools.ietf.org/html/rfc1123).

I am not sure whether this parsing is needed at all, as the resultant string, which is parsed by mountd(8), in its unaltered form seems to be compatible with the syntax expected by the latter. In fact, one could simply require that the string used for the sharenfs option is mountd(8) compatible and do away with the translate_opts() function entirely.

In a related vein, it is absolutely necessary to be able to specify multiple export lines for a single mount point, thereby allowing to assign different permissions to different clients. This has already been proposed a long while ago in http://www.freebsd.org/cgi/query-pr.cgi?pr=147881 but never been implemented. May I use that PR to suggest that this feature be added at the same time as fixing the bug described here.

>How-To-Repeat:
Try to execute

    zfs set sharenfs=test-host <zfs volume>

and then do a

    zfs list -o name,sharenfs <zfs colume>

>Fix:
Correct translate_opts() in cddl/compat/opensolaris/misc/fsshare.c (or get rid of it altogether).

As a workaround, I am currently using IP addresses in lieu of the affectd host names. I need to use both IPv4 and IPv6 addresses of the same host, as my network runs both IPv4 and IPv6.


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205200723.q4K7NRU3090017>