diff options
author | neilbrown <neilbrown> | 2001-09-12 02:14:43 +0000 |
---|---|---|
committer | neilbrown <neilbrown> | 2001-09-12 02:14:43 +0000 |
commit | 8d53a2630763f8f639d2de2ddd26282bff1c7cad (patch) | |
tree | ebc32858dd34a671807c64f7b5b1f85c763d653f | |
parent | 5b9179e1d135ef4341516465222eaf9efb84c5f3 (diff) | |
download | nfs-utils-8d53a2630763f8f639d2de2ddd26282bff1c7cad.tar.gz nfs-utils-8d53a2630763f8f639d2de2ddd26282bff1c7cad.tar.xz nfs-utils-8d53a2630763f8f639d2de2ddd26282bff1c7cad.zip |
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
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | support/nfs/exports.c | 9 | ||||
-rw-r--r-- | support/nfs/xio.c | 20 | ||||
-rw-r--r-- | utils/exportfs/exports.man | 5 |
4 files changed, 40 insertions, 3 deletions
@@ -1,5 +1,14 @@ 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 change from 2000-08-02: It causes problems if someone exports to both a hostname and IP addresses. nfs-utils must be diff --git a/support/nfs/exports.c b/support/nfs/exports.c index dbb2da0..eb1bf2c 100644 --- a/support/nfs/exports.c +++ b/support/nfs/exports.c @@ -135,12 +135,19 @@ putexportent(struct exportent *ep) { FILE *fp; int *id, i; + char *esc=ep->e_path; 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)? diff --git a/support/nfs/xio.c b/support/nfs/xio.c index cfdb1d1..9bb5100 100644 --- a/support/nfs/xio.c +++ b/support/nfs/xio.c @@ -83,14 +83,32 @@ xfunlock(int 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 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; + 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) diff --git a/utils/exportfs/exports.man b/utils/exportfs/exports.man index 8d08667..4b31ccf 100644 --- a/utils/exportfs/exports.man +++ b/utils/exportfs/exports.man @@ -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 -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: |