* 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>
+
+ * 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
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)?
+#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;
- 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;
+ }
+ 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)
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: