From aaron@meta.lo-res.org  Sat Jan 12 03:19:02 2002
Return-Path: <aaron@meta.lo-res.org>
Received: from meta.lo-res.org (meta.lo-res.org [195.58.189.92])
	by hub.freebsd.org (Postfix) with ESMTP id D513A37B419
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 12 Jan 2002 03:19:00 -0800 (PST)
Received: (from aaron@localhost)
	by meta.lo-res.org (8.11.6/8.11.6) id g0CBItn49632;
	Sat, 12 Jan 2002 12:18:55 +0100 (CET)
	(envelope-from aaron)
Message-Id: <200201121118.g0CBItn49632@meta.lo-res.org>
Date: Sat, 12 Jan 2002 12:18:55 +0100 (CET)
From: aaron <aaron@lo-res.org>
Reply-To: aaron <aaron@lo-res.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: mount_nfs  has trouble with embedded ':' in path
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         33809
>Category:       bin
>Synopsis:       [patch] mount_nfs(8) has trouble with embedded ':' in path
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 12 03:20:01 PST 2002
>Closed-Date:    
>Last-Modified:  Thu Jun 23 18:05:08 UTC 2011
>Originator:     aaron
>Release:        FreeBSD 4.5-PRERELEASE i386
>Organization:
lo-res
>Environment:
System: FreeBSD meta.lo-res.org 4.5-PRERELEASE FreeBSD 4.5-PRERELEASE #4: Sun Dec 30 17:36:27 CET 2001 root@meta.lo-res.org:/usr/people/scratch/usr/people/src/sys/meta i386


	
>Description:
      try mounting a nfs share where the path contains a ':'

      root@www:~>mount_nfs 10.1.2.3:/u2/ftp/priv/mp3/Welle\:Erdball /mnt
      mount_nfs: bad net address 10.1.2.3:/u2/ftp/priv/mp3/Welle

      With all common ways to escape ':' in the shell it does not work
      Seems like mount_nfs cuts off the path at the first (even escaped)
      ':'. 
>How-To-Repeat:
	Create a directory on your nfs server containing a ':'.
        export it, kill -HUP mountd
        Try to mount it on a client machine.

>Fix:

	
       When taking a look at /usr/src/sbin/mount_nfs/ \
       mount_nfs.c the problem seems to be at line 593:

       [ function: getnfsargs() ]
                 if ((delimp = strrchr(spec, ':')) != NULL) {
                               ^^^^^^^^^^ this gives a '\:' no chance.
        Neither does it take into account that I might have specified
        the path enclosed with single quotes "'" (e.g.
         mount_nfs hostname.com:'/my/path:rest/' /mnt


       A possible (probably not very good) solution seems to be to use
        strchr() (match for first occurence of ':'). At least this
       would fit to our common belief that the share name is seperated
       from the host name by the leftmost ':'.

       I tested it and it works. However I did not check for side effects.

       Hope it helped and was precise enough.
       Keep on ! great project

--- mount_nfs.orig.c    Sat Jan 12 12:11:01 2002
+++ mount_nfs.c Sat Jan 12 12:11:47 2002
@@ -590,10 +590,10 @@
        size_t len;
        static char nam[MNAMELEN + 1];

-       if ((delimp = strrchr(spec, ':')) != NULL) {
+       if ((delimp = strchr(spec, ':')) != NULL) {
                hostp = spec;
                spec = delimp + 1;
-       } else if ((delimp = strrchr(spec, '@')) != NULL) {
+       } else if ((delimp = strchr(spec, '@')) != NULL) {
                warnx("path@server syntax is deprecated, use server:path");
                hostp = delimp + 1;
        } else {




>Release-Note:
>Audit-Trail:

From: David Malone <dwmalone@walton.maths.tcd.ie>
To: aaron <aaron@lo-res.org>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/33809: mount_nfs  has trouble with embedded ':' in path
Date: Sat, 12 Jan 2002 14:37:34 +0000

 On Sat, Jan 12, 2002 at 12:18:55PM +0100, aaron wrote:
 >        When taking a look at /usr/src/sbin/mount_nfs/ \
 >        mount_nfs.c the problem seems to be at line 593:
 > 
 >        [ function: getnfsargs() ]
 >                  if ((delimp = strrchr(spec, ':')) != NULL) {
 >                                ^^^^^^^^^^ this gives a '\:' no chance.
 >         Neither does it take into account that I might have specified
 >         the path enclosed with single quotes "'" (e.g.
 >          mount_nfs hostname.com:'/my/path:rest/' /mnt
 
 If you put quotes or escape the colon on the command line, then
 this will have been interpreted by your shell before mount_nfs is
 run and so mount_nfs does not have to understand this. The reason
 the last ':' is used is probably so that IPv6 addresses can be used
 with mount_nfs (this would work in -current, but probably not on
 stable).
 
 I'm not sure what the best way to resolve this is - it may be "don't
 use paths with colons in them". Another possibility would be to add
 an extra flag to mount_nfs which lets you give the host name/address
 seperately from the path.
 
 	David.

From: "JCandelario" <jorge@megapage.net>
To: <freebsd-gnats-submit@FreeBSD.org>, <aaron@lo-res.org>
Cc:  
Subject: Re: bin/33809: mount_nfs  has trouble with embedded ':' in path
Date: Thu, 14 Feb 2002 15:39:22 -0400

 This is a multi-part message in MIME format.
 
 ------=_NextPart_000_0003_01C1B56D.C66ED6E0
 Content-Type: text/plain;
 	charset="iso-8859-1"
 Content-Transfer-Encoding: quoted-printable
 
 Not using ":" may not be optional.  Trying mount_nfs on a 'dos-like' =
 server requires the ":" to identify the drive to be mounted on =
 multi-drive systems.  Using strchr solved the problem for me; an extra =
 flag sound like an alternative.
 
 Jorge.
 
 ------=_NextPart_000_0003_01C1B56D.C66ED6E0--
 
Responsible-Changed-From-To: freebsd-bugs->mux 
Responsible-Changed-By: mux 
Responsible-Changed-When: Thu Apr 18 14:50:26 PDT 2002 
Responsible-Changed-Why:  
I will take care of this problem (related to PR/37230). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=33809 
Responsible-Changed-From-To: mux->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Jun 23 18:04:42 UTC 2011 
Responsible-Changed-Why:  
mux has returned his commit bit for safekeeping. 

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