autofs-5.0.6 - fix improve mount location error reporting
From: Ian Kent <raven@themaw.net>
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(+)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -19,6 +19,7 @@
- add piddir to configure.
- add systemd unit support.
- remove empty command line arguments (passed by systemd).
+- fix improve mount location error reporting.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/modules/parse_sun.c
+++ autofs-5.0.6/modules/parse_sun.c
@@ -868,6 +868,20 @@ static int validate_location(unsigned in
* 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);