From jaakko@saunalahti.fi  Tue Apr 28 17:40:02 2009
Return-Path: <jaakko@saunalahti.fi>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 054281065677
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 28 Apr 2009 17:40:02 +0000 (UTC)
	(envelope-from jaakko@saunalahti.fi)
Received: from gw02.mail.saunalahti.fi (gw02.mail.saunalahti.fi [195.197.172.116])
	by mx1.freebsd.org (Postfix) with ESMTP id B6CB08FC14
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 28 Apr 2009 17:40:01 +0000 (UTC)
	(envelope-from jaakko@saunalahti.fi)
Received: from ws64.jh.dy.fi (a91-153-125-115.elisa-laajakaista.fi [91.153.125.115])
	by gw02.mail.saunalahti.fi (Postfix) with ESMTP id 22DCF13963D
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 28 Apr 2009 20:22:59 +0300 (EEST)
Received: from ws64.jh.dy.fi (localhost [127.0.0.1])
	by ws64.jh.dy.fi (8.14.3/8.14.3) with ESMTP id n3SHMxms010239
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 28 Apr 2009 20:22:59 +0300 (EEST)
	(envelope-from jaakko@ws64.jh.dy.fi)
Received: (from jaakko@localhost)
	by ws64.jh.dy.fi (8.14.3/8.14.3/Submit) id n3SHMxuw010238;
	Tue, 28 Apr 2009 20:22:59 +0300 (EEST)
	(envelope-from jaakko)
Message-Id: <200904281722.n3SHMxuw010238@ws64.jh.dy.fi>
Date: Tue, 28 Apr 2009 20:22:59 +0300 (EEST)
From: Jaakko Heinonen <jh@saunalahti.fi>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] mount_nfs(8) option parsing bug
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         134069
>Category:       bin
>Synopsis:       [patch] mount_nfs(8) option parsing bug
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    jh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 28 17:50:00 UTC 2009
>Closed-Date:    Thu Nov 26 19:14:31 UTC 2009
>Last-Modified:  Thu Nov 26 19:14:31 UTC 2009
>Originator:     Jaakko Heinonen
>Release:        FreeBSD 8.0-CURRENT
>Organization:
>Environment:
FreeBSD 8.0-CURRENT r191616

	
>Description:
mount_nfs(8) doesn't parse options specified with -o correctly if an            
option with value is preceded by an option without value.

The bug was introduced in r183008.

>How-To-Repeat:
# mount_nfs -o rdirplus,acdirmax=0 localhost:/dir /mnt                          
mount_nfs: /mnt, illegal acdirmax: : Invalid argument

>Fix:
--- mount_nfs-option-parsing.diff begins here ---
Index: sbin/mount_nfs/mount_nfs.c
===================================================================
--- sbin/mount_nfs/mount_nfs.c	(revision 190637)
+++ sbin/mount_nfs/mount_nfs.c	(working copy)
@@ -265,16 +265,16 @@ main(int argc, char *argv[])
 				char *pnextopt = NULL;
 				char *val = "";
 				pass_flag_to_nmount = 1;
-				pval = strchr(opt, '=');
 				pnextopt = strchr(opt, ',');
-				if (pval != NULL) {
-					*pval = '\0';
-					val = pval + 1;
-				}
 				if (pnextopt) {
 					*pnextopt = '\0';
 					pnextopt++;
 				}
+				pval = strchr(opt, '=');
+				if (pval != NULL) {
+					*pval = '\0';
+					val = pval + 1;
+				}
 				if (strcmp(opt, "bg") == 0) {
 					opflags |= BGRND;
 					pass_flag_to_nmount=0;
--- mount_nfs-option-parsing.diff ends here ---

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->jh 
Responsible-Changed-By: jh 
Responsible-Changed-When: Mon Oct 26 14:36:31 UTC 2009 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=134069 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/134069: commit references a PR
Date: Mon, 26 Oct 2009 14:59:13 +0000 (UTC)

 Author: jh
 Date: Mon Oct 26 14:57:33 2009
 New Revision: 198491
 URL: http://svn.freebsd.org/changeset/base/198491
 
 Log:
   Fix parsing of mount options specified with -o in case an option with
   value is preceded by an option without value (for example -o
   option1,option2=value). Options must be separated before searching for
   '='. Also compare pnextopt explicitly against NULL.
   
   PR:		bin/134069
   Approved by:	trasz (mentor)
 
 Modified:
   head/sbin/mount_nfs/mount_nfs.c
 
 Modified: head/sbin/mount_nfs/mount_nfs.c
 ==============================================================================
 --- head/sbin/mount_nfs/mount_nfs.c	Mon Oct 26 13:03:52 2009	(r198490)
 +++ head/sbin/mount_nfs/mount_nfs.c	Mon Oct 26 14:57:33 2009	(r198491)
 @@ -232,16 +232,16 @@ main(int argc, char *argv[])
  				char *pnextopt = NULL;
  				char *val = "";
  				pass_flag_to_nmount = 1;
 -				pval = strchr(opt, '=');
  				pnextopt = strchr(opt, ',');
 +				if (pnextopt != NULL) {
 +					*pnextopt = '\0';
 +					pnextopt++;
 +				}
 +				pval = strchr(opt, '=');
  				if (pval != NULL) {
  					*pval = '\0';
  					val = pval + 1;
  				}
 -				if (pnextopt) {
 -					*pnextopt = '\0';
 -					pnextopt++;
 -				}
  				if (strcmp(opt, "bg") == 0) {
  					opflags |= BGRND;
  					pass_flag_to_nmount=0;
 _______________________________________________
 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->patched 
State-Changed-By: jh 
State-Changed-When: Mon Oct 26 15:05:41 UTC 2009 
State-Changed-Why:  
Patched in head (r198491). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=134069 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/134069: commit references a PR
Date: Thu, 26 Nov 2009 18:14:21 +0000 (UTC)

 Author: jh
 Date: Thu Nov 26 18:14:03 2009
 New Revision: 199840
 URL: http://svn.freebsd.org/changeset/base/199840
 
 Log:
   MFC r198491:
   
   Fix parsing of mount options specified with -o in case an option with
   value is preceded by an option without value (for example -o
   option1,option2=value). Options must be separated before searching for
   '='. Also compare pnextopt explicitly against NULL.
   
   PR:		bin/134069
   Approved by:	trasz (mentor)
 
 Modified:
   stable/8/sbin/mount_nfs/mount_nfs.c
 Directory Properties:
   stable/8/sbin/mount_nfs/   (props changed)
 
 Modified: stable/8/sbin/mount_nfs/mount_nfs.c
 ==============================================================================
 --- stable/8/sbin/mount_nfs/mount_nfs.c	Thu Nov 26 15:50:52 2009	(r199839)
 +++ stable/8/sbin/mount_nfs/mount_nfs.c	Thu Nov 26 18:14:03 2009	(r199840)
 @@ -232,16 +232,16 @@ main(int argc, char *argv[])
  				char *pnextopt = NULL;
  				char *val = "";
  				pass_flag_to_nmount = 1;
 -				pval = strchr(opt, '=');
  				pnextopt = strchr(opt, ',');
 +				if (pnextopt != NULL) {
 +					*pnextopt = '\0';
 +					pnextopt++;
 +				}
 +				pval = strchr(opt, '=');
  				if (pval != NULL) {
  					*pval = '\0';
  					val = pval + 1;
  				}
 -				if (pnextopt) {
 -					*pnextopt = '\0';
 -					pnextopt++;
 -				}
  				if (strcmp(opt, "bg") == 0) {
  					opflags |= BGRND;
  					pass_flag_to_nmount=0;
 _______________________________________________
 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: patched->closed 
State-Changed-By: jh 
State-Changed-When: Thu Nov 26 19:14:30 UTC 2009 
State-Changed-Why:  
Fixed in all affected branches. 

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