Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Jan 2002 12:18:55 +0100 (CET)
From:      aaron <aaron@lo-res.org>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/33809: mount_nfs  has trouble with embedded ':' in path
Message-ID:  <200201121118.g0CBItn49632@meta.lo-res.org>

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

>Number:         33809
>Category:       bin
>Synopsis:       mount_nfs  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:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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