diff --git a/CHANGELOG b/CHANGELOG index 5d8e58b..9f4e4b4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,7 @@ - cthon map parser corrections. - cthon multi-map locking fix and current race corrections. - cthon shutdown expire fix. +- cthon more map parser corrections. 13/7/2006 autofs-5.0.1 rc1 -------------------------- diff --git a/modules/lookup_file.c b/modules/lookup_file.c index a515d70..6306084 100644 --- a/modules/lookup_file.c +++ b/modules/lookup_file.c @@ -242,6 +242,7 @@ static int read_one(FILE *f, char *key, if (nch != EOF && isblank(nch)) { state = st_badent; ungetc(nch, f); + gotten = got_nothing; error(LOGOPT_ANY, MODPREFIX "bad map entry \"%s...\" for key " "\"%s\"", mapent, key); diff --git a/modules/parse_sun.c b/modules/parse_sun.c index ca80bad..7656bb4 100644 --- a/modules/parse_sun.c +++ b/modules/parse_sun.c @@ -677,7 +677,7 @@ add_offset_entry(struct autofs_point *ap "added multi-mount offset %s -> %s", path, m_mapent); else debug(ap->logopt, MODPREFIX - "syntax error in offset %s -> %s", path, loc); + "syntax error or dupliate offset %s -> %s", path, loc); return ret; } @@ -782,7 +782,7 @@ static int parse_mapent(const char *ent, { char buf[MAX_ERR_BUF]; const char *p; - char *myoptions, *loc; + char *tmp, *myoptions, *loc; int l; p = ent; @@ -1066,29 +1066,22 @@ int parse_mount(struct autofs_point *ap, /* It's a multi-mount; deal with it */ do { - char *path, *myoptions, *loc; + char *tmp, *path, *myoptions, *loc; int status; - if (myoptions == NULL) { - char *estr = strerror_r(errno, buf, MAX_ERR_BUF); - error(ap->logopt, MODPREFIX "multi strdup: %s", estr); - parse_sun_cleanup(mc, name, options, NULL, NULL); - return 1; - } - if (*p != '/') { l = 0; - path = dequote("/", 1, ap->logopt); + tmp = dequote("/", 1, ap->logopt); debug(ap->logopt, - MODPREFIX "dequote(\"/\") -> %s", path); + MODPREFIX "dequote(\"/\") -> %s", tmp); } else { l = chunklen(p, 0); - path = dequote(p, l, ap->logopt); + tmp = dequote(p, l, ap->logopt); debug(ap->logopt, MODPREFIX - "dequote(\"%.*s\") -> %s", l, p, path); + "dequote(\"%.*s\") -> %s", l, p, tmp); } - if (!path) { + if (!tmp) { error(ap->logopt, MODPREFIX "out of memory"); cache_readlock(mc); cache_multi_lock(mc); @@ -1099,17 +1092,19 @@ int parse_mount(struct autofs_point *ap, return 1; } - if (!*path) { + path = sanitize_path(tmp, strlen(tmp)); + if (!path) { error(ap->logopt, MODPREFIX "invalid path"); cache_readlock(mc); cache_multi_lock(mc); cache_delete_offset_list(mc, name); cache_multi_unlock(mc); cache_unlock(mc); - free(path); + free(tmp); free(options); return 1; } + free(tmp); p += l; p = skipspace(p);