]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
2001-09-12 NeilBrown <neilb@cse.unsw.edu.au>
authorneilbrown <neilbrown>
Wed, 12 Sep 2001 02:14:43 +0000 (02:14 +0000)
committerneilbrown <neilbrown>
Wed, 12 Sep 2001 02:14:43 +0000 (02:14 +0000)
* support/nfs/exports.c (putexportent): \octal quote any spaces
etc in a path name
* support/nfs/xio.c (xgettok): recognise double-quote and
\octal quoting in path names
* utils/exportfs/exports.man: document quoting conventions
for path names

ChangeLog
support/nfs/exports.c
support/nfs/xio.c
utils/exportfs/exports.man

index 95832a132d5cc47e47bd7bda045be429590d6e54..2dc842f1d79d1479f3ff89cd8458c0c86dfcd2d8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2001-09-12 NeilBrown <neilb@cse.unsw.edu.au>
+
+       * support/nfs/exports.c (putexportent): \octal quote any spaces
+       etc in a path name
+       * support/nfs/xio.c (xgettok): recognise double-quote and
+       \octal quoting in path names
+       * utils/exportfs/exports.man: document quoting conventions
+       for path names
+       
 2001-09-12 NeilBrown <neilb@cse.unsw.edu.au>
 
        * utils/mountd/auth.c (auth_authenticate_internal): Reverse
 2001-09-12 NeilBrown <neilb@cse.unsw.edu.au>
 
        * utils/mountd/auth.c (auth_authenticate_internal): Reverse
index dbb2da03be8980363cc242e43215baaee079e6d9..eb1bf2c8db165bbd761603c4d06be5f74e569fa1 100644 (file)
@@ -135,12 +135,19 @@ putexportent(struct exportent *ep)
 {
        FILE    *fp;
        int     *id, i;
 {
        FILE    *fp;
        int     *id, i;
+       char    *esc=ep->e_path;
 
        if (!efp)
                return;
 
        fp = efp->x_fp;
 
        if (!efp)
                return;
 
        fp = efp->x_fp;
-       fprintf(fp, "%s\t%s(", ep->e_path, ep->e_hostname);
+       for (i=0; esc[i]; i++)
+               if (iscntrl(esc[i]) || esc[i] == '"' || esc[i] == '\\'|| isspace(esc[i]))
+                       fprintf(fp, "\\%03o", esc[i]);
+               else
+                       fprintf(fp, "%c", esc[i]);
+
+       fprintf(fp, "\t%s(", ep->e_hostname);
        fprintf(fp, "%s,", (ep->e_flags & NFSEXP_READONLY)? "ro" : "rw");
        fprintf(fp, "%ssync,", (ep->e_flags & NFSEXP_ASYNC)? "a" : "");
        fprintf(fp, "%swdelay,", (ep->e_flags & NFSEXP_GATHERED_WRITES)?
        fprintf(fp, "%s,", (ep->e_flags & NFSEXP_READONLY)? "ro" : "rw");
        fprintf(fp, "%ssync,", (ep->e_flags & NFSEXP_ASYNC)? "a" : "");
        fprintf(fp, "%swdelay,", (ep->e_flags & NFSEXP_GATHERED_WRITES)?
index cfdb1d1256b2c6b16a80d7b0f4dcbf0a95250dcb..9bb5100d09f4e392f12a6816ead5c62e17df1c54 100644 (file)
@@ -83,14 +83,32 @@ xfunlock(int fd)
        close(fd);
 }
 
        close(fd);
 }
 
+#define isoctal(x) (isdigit(x) && ((x)<'8'))
 int
 xgettok(XFILE *xfp, char sepa, char *tok, int len)
 {
        int     i = 0;
        int     c = 0;
 int
 xgettok(XFILE *xfp, char sepa, char *tok, int len)
 {
        int     i = 0;
        int     c = 0;
+       int     quoted=0;
 
 
-       while (i < len && (c = xgetc(xfp)) != EOF && c != sepa && !isspace(c))
+       while (i < len && (c = xgetc(xfp)) != EOF &&
+              (quoted || (c != sepa && !isspace(c)))) {
+               if (c == '"') {
+                       quoted = !quoted;
+                       continue;
+               }
                tok[i++] = c;
                tok[i++] = c;
+               if (i >= 4 &&
+                   tok[i-4] == '\\' &&
+                   isoctal(tok[i-3]) &&
+                   isoctal(tok[i-2]) &&
+                   isoctal(tok[i-1]) &&
+                   ((tok[i]=0),
+                    (c = strtol(tok+i-3,NULL, 8)) < 256)) {
+                       i -= 4;
+                       tok[i++] = c;
+               }
+       }       
        if (c == '\n')
                xungetc(c, xfp);
        if (!i)
        if (c == '\n')
                xungetc(c, xfp);
        if (!i)
index 8d0866788170f04823658f183117ec52301671fb..4b31ccf9c03e1316f3483a8d7cf3810a29ee7f91 100644 (file)
@@ -22,7 +22,10 @@ contains an export point and a list of machine or netgroup names allowed
 to mount the file system at that point.  An optional parenthesized list
 of export parameters may follow each machine name.  Blank lines are
 ignored, and a # introduces a comment to the end of the line. Entries may
 to mount the file system at that point.  An optional parenthesized list
 of export parameters may follow each machine name.  Blank lines are
 ignored, and a # introduces a comment to the end of the line. Entries may
-be continued across newlines using a backslash.
+be continued across newlines using a backslash. If export name contains spaces
+it should be quoted using double-quotes. You can also specify spaces
+or any other unusual characters in the export path name using a
+backslash followed by the character code as 3 octal digits.
 .PP
 .SS Machine Name Formats
 NFS clients may be specified in a number of ways:
 .PP
 .SS Machine Name Formats
 NFS clients may be specified in a number of ways: