Blame SOURCES/autofs-5.1.8-fail-on-empty-replicated-host-name.patch

288172
autofs-5.1.8 - fail on empty replicated host name
288172
288172
From: Ian Kent <raven@themaw.net>
288172
288172
If a mount location host (or hosts) has an empty host name it has to be
288172
a mistake so fail the automount request.
288172
288172
Signed-off-by: Ian Kent <raven@themaw.net>
288172
---
288172
 CHANGELOG           |    1 +
288172
 modules/parse_sun.c |   18 ++++++++++++++++++
288172
 2 files changed, 19 insertions(+)
288172
288172
--- autofs-5.1.4.orig/CHANGELOG
288172
+++ autofs-5.1.4/CHANGELOG
288172
@@ -105,6 +105,7 @@
288172
 - fix concat_options() error handling.
288172
 - fix minus only option handling in concat_options().
288172
 - fix incorrect path for is_mounted() in try_remount().
288172
+- fail on empty replicated host name.
288172
 
288172
 xx/xx/2018 autofs-5.1.5
288172
 - fix flag file permission.
288172
--- autofs-5.1.4.orig/modules/parse_sun.c
288172
+++ autofs-5.1.4/modules/parse_sun.c
288172
@@ -924,6 +924,12 @@ static int validate_location(unsigned in
288172
 	if (*ptr == ':')
288172
 		return 1;
288172
 
288172
+	/* Fail on replicated entry with empty first host name */
288172
+	if (*ptr == ',') {
288172
+		error(logopt, "missing first host name in location %s", loc);
288172
+		return 0;
288172
+	}
288172
+
288172
 	/*
288172
 	 * If a ':/' is present now it must be a host name, except
288172
 	 * for those special file systems like sshfs which use "#"
288172
@@ -960,6 +966,18 @@ static int validate_location(unsigned in
288172
 				      "found in location %s", *ptr, loc);
288172
 				return 0;
288172
 			}
288172
+
288172
+			/* Fail on replicated entry with empty host name */
288172
+			if (*ptr == ',') {
288172
+				char next = *(ptr + 1);
288172
+
288172
+				if (next == ',' || next == ':') {
288172
+					error(logopt,
288172
+					      "missing host name in location %s", loc);
288172
+					return 0;
288172
+				}
288172
+			}
288172
+
288172
 			ptr++;
288172
 		}
288172