autofs-5.0.6 - fix improve mount location error reporting From: Ian Kent The validate_location() function is meant to check for a small subset of map location errors only but the "improve mount location error reporting" patch inverted a logic test which has made the scope of the test greater causing false positive fails. So add a check for those special cases and return success instead. --- CHANGELOG | 1 + modules/parse_sun.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 11d2cbf..b6802b9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -21,6 +21,7 @@ - add systemd unit support. - remove empty command line arguments (passed by systemd). - fix rpc build error. +- fix improve mount location error reporting. 28/06/2011 autofs-5.0.6 ----------------------- diff --git a/modules/parse_sun.c b/modules/parse_sun.c index 13b8af8..e9d94c7 100644 --- a/modules/parse_sun.c +++ b/modules/parse_sun.c @@ -868,6 +868,20 @@ static int validate_location(unsigned int logopt, char *loc) * have ":", "[" and "]". */ if (!check_colon(ptr)) { + char *esc; + /* + * Don't forget cases where a colon is present but + * not followed by a "/" or, if there is no colon at + * all, we don't know if it is actually invalid since + * it may be a map name by itself, for example. + */ + if (!strchr(ptr, ':') || + ((esc = strchr(ptr, '\\')) && *(esc + 1) == ':') || + !strncmp(ptr, "file:", 5) || !strncmp(ptr, "yp:", 3) || + !strncmp(ptr, "nis:", 4) || !strncmp(ptr, "nisplus:", 8) || + !strncmp(ptr, "ldap:", 5) || !strncmp(ptr, "ldaps:", 6) || + !strncmp(ptr, "dir:", 4)) + return 1; error(logopt, "expected colon delimeter not found in location %s", loc);