diff --git a/CHANGELOG b/CHANGELOG index 0fcdfd4..4aa384b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -54,6 +54,7 @@ - expand support for the "%" hack. - fix to quoting for exports gathered by hosts map. - use mount option "nosuid" for "-hosts" map unless "suid" is explicily specified. +- second attempt fixing quoting for exports gathered by hosts map. 18/06/2007 autofs-5.0.2 ----------------------- diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c index 70b13a7..1ef420e 100644 --- a/modules/lookup_hosts.c +++ b/modules/lookup_hosts.c @@ -179,14 +179,9 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void * if (*name == '/') { pthread_cleanup_push(cache_lock_cleanup, mc); mapent_len = strlen(me->mapent); - mapent = alloca(mapent_len + 3); - if (mapent) { - /* Add quotes to keep the parser happy */ - mapent[0] = '"'; - strcpy(mapent + 1, me->mapent); - mapent[mapent_len + 1] = '"'; - mapent[mapent_len + 2] = '\0'; - } + mapent = alloca(mapent_len + 1); + if (mapent) + strcpy(mapent, me->mapent); pthread_cleanup_pop(0); } cache_unlock(mc); diff --git a/modules/parse_sun.c b/modules/parse_sun.c index 9a97329..a97a7aa 100644 --- a/modules/parse_sun.c +++ b/modules/parse_sun.c @@ -878,7 +878,7 @@ static int parse_mapent(const char *ent, char *g_options, char **options, char * } if (!validate_location(loc)) { - warn(logopt, MODPREFIX "invalid location"); + warn(logopt, MODPREFIX "invalid location %s", loc); free(myoptions); free(loc); return 0; @@ -913,7 +913,7 @@ static int parse_mapent(const char *ent, char *g_options, char **options, char * if (!validate_location(ent_chunk)) { warn(logopt, - MODPREFIX "invalid location %s", ent); + MODPREFIX "invalid location %s", ent_chunk); free(ent_chunk); free(myoptions); free(loc); @@ -1344,6 +1344,23 @@ int parse_mount(struct autofs_point *ap, const char *name, int loclen; int l; + /* + * If this is an offset belonging to a multi-mount entry + * it's already been parsed (above) and any option string + * has already been stripped so just use the remainder. + */ + if (*name == '/' && + (me = cache_lookup_distinct(mc, name)) && me->multi) { + loc = strdup(p); + if (!loc) { + free(options); + warn(ap->logopt, MODPREFIX "out of memory"); + return 1; + } + loclen = strlen(p); + goto mount_it; + } + l = chunklen(p, check_colon(p)); loc = dequote(p, l, ap->logopt); if (!loc) { @@ -1361,9 +1378,9 @@ int parse_mount(struct autofs_point *ap, const char *name, } if (!validate_location(loc)) { + warn(ap->logopt, MODPREFIX "invalid location %s", loc); free(loc); free(options); - warn(ap->logopt, MODPREFIX "invalid location"); return 1; } @@ -1387,10 +1404,11 @@ int parse_mount(struct autofs_point *ap, const char *name, } if (!validate_location(ent)) { + warn(ap->logopt, + MODPREFIX "invalid location %s", loc); free(ent); free(loc); free(options); - warn(ap->logopt, MODPREFIX "invalid location"); return 1; } @@ -1424,7 +1442,7 @@ int parse_mount(struct autofs_point *ap, const char *name, MODPREFIX "entry %s is empty!", name); return 1; } - +mount_it: debug(ap->logopt, MODPREFIX "core of entry: options=%s, loc=%.*s", options, loclen, loc);