NetBSD Problem Report #10608

Received: (qmail 19549 invoked from network); 16 Jul 2000 14:02:13 -0000
Message-Id: <200007161358.e6GDweC00606@starfruit.itojun.org>
Date: Sun, 16 Jul 2000 22:58:40 +0900 (JST)
From: itojun@itojun.org
Reply-To: itojun@itojun.org
To: gnats-bugs@gnats.netbsd.org
Cc: sommerfeld@netbsd.org, ichiro@ichiro.org
Subject: mountd(8) ignores -noresvport/-noresvmnt if there's no host specified
X-Send-Pr-Version: 3.95

>Number:         10608
>Category:       bin
>Synopsis:       mountd(8) ignores -noresvport/-noresvmnt if there's no host specified
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 16 14:03:00 +0000 2000
>Closed-Date:    
>Last-Modified:  
>Originator:     Jun-ichiro itojun Hagino
>Release:        latest current
>Organization:
	itojun.org
>Environment:
System: NetBSD starfruit.itojun.org 1.5B NetBSD 1.5B (STARFRUIT) #60: Sun Jul 16 20:30:21 JST 2000 itojun@starfruit.itojun.org:/usr/home/itojun/NetBSD/src/sys/arch/i386/compile/STARFRUIT i386


>Description:
	if we specify a line in exports(5) like below (with no host
	specification - meaning everyone can mount), mountd(8) will fail
	to use the specified -noresvport/-noresvmnt on mount request.
		/usr -ro -noresvport -noresvmnt

	The problem happens when the last condition in the following
	portion of usr.sbin/mountd/mountd.c is used:
		   (defset && scan_tree(ep->ex_defdir, saddr) == 0 &&
		   scan_tree(ep->ex_dirl, saddr) == 0))) {
	The portion is used when no hostname is specified on exports(5)
	line.  The code does not set the export flags in the export list
	database into variable "hostset".  hostset will be zero on port
	number check.  as a result, mountd does not permit mount request
	from non-privileged port.

from line 593:
		if (ep && (chk_host(ep->ex_defdir, saddr, &defset,
		   &hostset) || ((dp = dirp_search(ep->ex_dirl, dirpath)) &&
		   chk_host(dp, saddr, &defset, &hostset)) ||
		   (defset && scan_tree(ep->ex_defdir, saddr) == 0 &&
		   scan_tree(ep->ex_dirl, saddr) == 0))) {
			if (sport >= IPPORT_RESERVED &&
			    !(hostset & DP_NORESMNT)) {
				syslog(LOG_NOTICE,
				    "Refused mount RPC from host %s port %d",
				    numerichost, sport);
				svcerr_weakauth(transp);
				goto out;
			}

>How-To-Repeat:
	put a line like this (with no host specified) into /etc/exports.
		/usr -ro -noresvport -noresvmnt
	try to mount the partition from Solaris8 nfs client, which uses
	non-privileged source tcp/udp port.  see the mount attempt fails
	"you did not use the privileged port" error.

	NOTE: it is not possible to repeat the problem from netbsd
	nfs client, as netbsd nfs client always use privileged source
	port for mount request - "mount_nfs -p" only changes nfs source
	port, not the mount source port.

>Fix:
	- workaronud: use privileged port from solaris nfs client.
	- workaround: specify some hostname in exports(5) line.
	- scan_tree() should propagate export flags upto "hostset" varaible
	  somehow.
	- mountd(8) code for handling exports(5) options is rather complex.
	  it may be better to clean it up from scratch.
>Release-Note:
>Audit-Trail:
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.