From simon@comsys.ntu-kpi.kiev.ua  Mon Aug  6 10:34:34 2012
Return-Path: <simon@comsys.ntu-kpi.kiev.ua>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 64B191065673
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  6 Aug 2012 10:34:34 +0000 (UTC)
	(envelope-from simon@comsys.ntu-kpi.kiev.ua)
Received: from comsys.kpi.ua (comsys.kpi.ua [77.47.192.42])
	by mx1.freebsd.org (Postfix) with ESMTP id B05E28FC16
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  6 Aug 2012 10:34:32 +0000 (UTC)
Received: from pm513-1.comsys.kpi.ua ([10.18.52.101] helo=pm513-1.comsys.ntu-kpi.kiev.ua)
	by comsys.kpi.ua with esmtpsa (TLSv1:AES256-SHA:256)
	(Exim 4.63)
	(envelope-from <simon@comsys.ntu-kpi.kiev.ua>)
	id 1SyKdq-0002RG-8B
	for FreeBSD-gnats-submit@freebsd.org; Mon, 06 Aug 2012 13:34:30 +0300
Received: by pm513-1.comsys.ntu-kpi.kiev.ua (Postfix, from userid 1001)
	id 3E6611CC1E; Mon,  6 Aug 2012 13:34:29 +0300 (EEST)
Message-Id: <20120806103428.GA9697@pm513-1.comsys.ntu-kpi.kiev.ua>
Date: Mon, 6 Aug 2012 13:34:29 +0300
From: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
To: FreeBSD-gnats-submit@freebsd.org
Subject: mountd: correct handling of -alldirs option and segmentation fault
 for -sec option

>Number:         170413
>Category:       bin
>Synopsis:       [patch] mountd(8): correct handling of -alldirs option and segmentation fault for -sec option
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 06 10:40:05 UTC 2012
>Closed-Date:    Mon Sep 23 13:27:54 UTC 2013
>Last-Modified:  Mon Sep 23 13:27:54 UTC 2013
>Originator:     Andrey Simonenko
>Release:        FreeBSD 10.0-CURRENT amd64
>Organization:
FreeBSD-gnats-submit@freebsd.org
>Environment:
>Description:

According to the exports(5) manual page if a line starts with a single
pathname of the root of the file system followed by the -alldirs option.
This option allows to specify that this is a file system export, does not
matter whether it is mounted right now or will be mounted in future.

mountd starting from the 1.84 revision of the usr.sbin/mountd/mountd.c
file ignores the -alldirs option (> 5 years ago).  It silently treats
the given pathname as a directory name and exports the entire file
system this directory belongs to.  Actually it has to export the given
pathname only if it is a mount point.  This is a security issue, since
mountd violates exports(5) rules.

Also the following update corrects segmentation fault if the -sec option
is given without an argument.

>How-To-Repeat:

Create the /etc/exports file with this content:

/cdrom -alldirs

Suppose /cdrom is not a mount point, now run mountd and try to mount
the <server>:/ NFS export, you will get access to the root file system.

>Fix:
 [ patch elided - gavin@ ]
>Release-Note:
>Audit-Trail:

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/170413: commit references a PR
Date: Wed, 20 Feb 2013 12:40:38 +0000 (UTC)

 Author: pluknet
 Date: Wed Feb 20 12:40:26 2013
 New Revision: 247034
 URL: http://svnweb.freebsd.org/changeset/base/247034
 
 Log:
   Check if the -sec option is given without an argument.
   
   PR:		bin/170413
   Submitted by:	Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
   MFC after:	1 week
 
 Modified:
   head/usr.sbin/mountd/mountd.c
 
 Modified: head/usr.sbin/mountd/mountd.c
 ==============================================================================
 --- head/usr.sbin/mountd/mountd.c	Wed Feb 20 12:14:49 2013	(r247033)
 +++ head/usr.sbin/mountd/mountd.c	Wed Feb 20 12:40:26 2013	(r247034)
 @@ -2235,7 +2235,7 @@ do_opt(char **cpp, char **endcpp, struct
  			ep->ex_indexfile = strdup(cpoptarg);
  		} else if (!strcmp(cpopt, "quiet")) {
  			opt_flags |= OP_QUIET;
 -		} else if (!strcmp(cpopt, "sec")) {
 +		} else if (cpoptarg && !strcmp(cpopt, "sec")) {
  			if (parsesec(cpoptarg, ep))
  				return (1);
  			opt_flags |= OP_SEC;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/170413: commit references a PR
Date: Wed, 27 Feb 2013 08:55:39 +0000 (UTC)

 Author: pluknet
 Date: Wed Feb 27 08:55:26 2013
 New Revision: 247394
 URL: http://svnweb.freebsd.org/changeset/base/247394
 
 Log:
   MFC r247034:
     Check if the -sec option is given without an argument.
   
   PR:		bin/170413
   Submitted by:	Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
 
 Modified:
   stable/9/usr.sbin/mountd/mountd.c
 Directory Properties:
   stable/9/usr.sbin/mountd/   (props changed)
 
 Modified: stable/9/usr.sbin/mountd/mountd.c
 ==============================================================================
 --- stable/9/usr.sbin/mountd/mountd.c	Wed Feb 27 08:44:03 2013	(r247393)
 +++ stable/9/usr.sbin/mountd/mountd.c	Wed Feb 27 08:55:26 2013	(r247394)
 @@ -2238,7 +2238,7 @@ do_opt(char **cpp, char **endcpp, struct
  			ep->ex_indexfile = strdup(cpoptarg);
  		} else if (!strcmp(cpopt, "quiet")) {
  			opt_flags |= OP_QUIET;
 -		} else if (!strcmp(cpopt, "sec")) {
 +		} else if (cpoptarg && !strcmp(cpopt, "sec")) {
  			if (parsesec(cpoptarg, ep))
  				return (1);
  			opt_flags |= OP_SEC;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/170413: commit references a PR
Date: Wed, 27 Feb 2013 08:57:14 +0000 (UTC)

 Author: pluknet
 Date: Wed Feb 27 08:56:57 2013
 New Revision: 247395
 URL: http://svnweb.freebsd.org/changeset/base/247395
 
 Log:
   MFC r247034:
     Check if the -sec option is given without an argument.
   
   PR:		bin/170413
   Submitted by:	Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
 
 Modified:
   stable/8/usr.sbin/mountd/mountd.c
 Directory Properties:
   stable/8/usr.sbin/mountd/   (props changed)
 
 Modified: stable/8/usr.sbin/mountd/mountd.c
 ==============================================================================
 --- stable/8/usr.sbin/mountd/mountd.c	Wed Feb 27 08:55:26 2013	(r247394)
 +++ stable/8/usr.sbin/mountd/mountd.c	Wed Feb 27 08:56:57 2013	(r247395)
 @@ -2229,7 +2229,7 @@ do_opt(char **cpp, char **endcpp, struct
  			ep->ex_indexfile = strdup(cpoptarg);
  		} else if (!strcmp(cpopt, "quiet")) {
  			opt_flags |= OP_QUIET;
 -		} else if (!strcmp(cpopt, "sec")) {
 +		} else if (cpoptarg && !strcmp(cpopt, "sec")) {
  			if (parsesec(cpoptarg, ep))
  				return (1);
  			opt_flags |= OP_SEC;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: gavin 
State-Changed-When: Mon Sep 23 13:24:08 UTC 2013 
State-Changed-Why:  
Submitter requests that this PR be closed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=170413 
>Unformatted:
