On Wed, 18 Aug 2004, Geoff Mishkin wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > > Hash: SHA1 > > > > > > I have a situation that requires me to have embedded spaces in the > > > options field of my automounter map. To make things trickier, the map > > > has to be generated with an executable map. I am using shfs and have to > > > use it's cmd mount option to force it to connect using a specific private > > > key file. This requires there to be embedded spaces in the options > > > field, like this: > > > > > > - -fstype=shfs,cmd="ssh -i /usr/keys/<username> <username>@<host>" > > > > > > Which causes the automounter to complain bitterly. Most of the > > > information I've found is for having spaces in share names or mount > > > points, but the advice given doesn't work in the options field. I've > > > tried all kinds of quotes, backslashing, etc. I'd greatly appriciate > > > help.
On second thoughts if you are willing to try a patch then do this. >From the autofs v4 directory on kernel.org obtain the patches: autofs-4.1.3-strict.patch autofs-4.1.3-mtab_lock.patch autofs-4.1.3-non_block_ping.patch autofs-4.1.3-bad_chdir.patch and then apply the attached patch and let me know how it goes. Ian
diff -Nur autofs-4.1.3.orig/modules/mount_nfs.c autofs-4.1.3/modules/mount_nfs.c --- autofs-4.1.3.orig/modules/mount_nfs.c 2004-06-05 13:49:33.000000000 +0800 +++ autofs-4.1.3/modules/mount_nfs.c 2004-06-05 14:17:59.000000000 +0800 @@ -347,7 +347,7 @@ int local, err; int nosymlink = 0; - debug(MODPREFIX " root=%s name=%s what=%s, fstype=%s, options=%s", + debug(MODPREFIX "root=%s name=%s what=%s, fstype=%s, options=%s", root, name, what, fstype, options); whatstr = alloca(strlen(what) + 1); diff -Nur autofs-4.1.3.orig/modules/parse_sun.c autofs-4.1.3/modules/parse_sun.c --- autofs-4.1.3.orig/modules/parse_sun.c 2004-06-05 13:49:33.000000000 +0800 +++ autofs-4.1.3/modules/parse_sun.c 2004-06-05 14:17:59.000000000 +0800 @@ -618,7 +618,7 @@ { struct parse_context *ctxt = (struct parse_context *) context; char *pmapent, *options; - const char *p, *q; + const char *p; int mapent_len, rv; int optlen; @@ -688,6 +688,12 @@ } path = dequote(p, l = chunklen(p, 0)); + if (!path) { + error(MODPREFIX "out of memory"); + free(myoptions); + free(options); + return 1; + } pathlen = strlen(path); p += l; @@ -712,21 +718,11 @@ } while (*p == '-'); } - q = p; - while (*q && *q != '/') { - l = chunklen(q, 1); - q += l; - q = skipspace(q); - } - l = q - p; - - loc = dequote(p, l); - loclen = strlen(loc); - - if (loc == NULL || path == NULL) { + loc = dequote(p, l = chunklen(p, 1)); + if (!loc) { error(MODPREFIX "out of memory"); - free(loc); free(path); + free(myoptions); free(options); return 1; } @@ -734,6 +730,39 @@ p += l; p = skipspace(p); + while (*p && *p != '/') { + char *ent; + + ent = dequote(p, l = chunklen(p, 1)); + if (!ent) { + error(MODPREFIX "out of memory"); + free(path); + free(myoptions); + free(options); + return 1; + } + + loc = realloc(loc, strlen(loc) + l + 2); + if (!loc) { + error(MODPREFIX "out of memory"); + free(ent); + free(path); + free(myoptions); + free(options); + return 1; + } + + strcat(loc, " "); + strcat(loc, ent); + + free(ent); + + p += l; + p = skipspace(p); + } + + loclen = strlen(loc); + debug(MODPREFIX "multimount: %.*s on %.*s with options %s", loclen, loc, pathlen, path, myoptions); @@ -763,15 +792,7 @@ if (*p == ':') p++; /* Sun escape for entries starting with / */ - q = p; - while (*q) { - l = chunklen(q, 1); - q += l; - q = skipspace(q); - } - l = q - p; - - loc = dequote(p, l); + loc = dequote(p, chunklen(p, 1)); loclen = strlen(loc); if (loc == NULL) {
_______________________________________________ autofs mailing list [EMAIL PROTECTED] http://linux.kernel.org/mailman/listinfo/autofs