Blame SOURCES/autofs-5.1.7-check-for-offset-with-no-mount-location.patch

29d2b9
autofs-5.1.7 - check for offset with no mount location
29d2b9
29d2b9
From: Ian Kent <raven@themaw.net>
29d2b9
29d2b9
Offsets need to have a mount location, check for it.
29d2b9
29d2b9
Signed-off-by: Ian Kent <raven@themaw.net>
29d2b9
---
29d2b9
 CHANGELOG           |    1 +
29d2b9
 modules/parse_sun.c |   15 ++++++++++++++-
29d2b9
 2 files changed, 15 insertions(+), 1 deletion(-)
29d2b9
29d2b9
diff --git a/CHANGELOG b/CHANGELOG
29d2b9
index a9209755..42914160 100644
29d2b9
--- a/CHANGELOG
29d2b9
+++ b/CHANGELOG
29d2b9
@@ -47,6 +47,7 @@
29d2b9
 - pass root length to mount_fullpath().
29d2b9
 - remove unused function master_submount_list_empty().
29d2b9
 - move amd mounts removal into lib/mounts.c.
29d2b9
+- check for offset with no mount location.
29d2b9
 
29d2b9
 25/01/2021 autofs-5.1.7
29d2b9
 - make bind mounts propagation slave by default.
29d2b9
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
29d2b9
index b1c2611c..a81d4028 100644
29d2b9
--- a/modules/parse_sun.c
29d2b9
+++ b/modules/parse_sun.c
29d2b9
@@ -801,7 +801,20 @@ update_offset_entry(struct autofs_point *ap,
29d2b9
 
29d2b9
 	memset(m_mapent, 0, MAPENT_MAX_LEN + 1);
29d2b9
 
29d2b9
-	/* Internal hosts map may have loc == NULL */
29d2b9
+	if (!loc || !*loc) {
29d2b9
+		const char *type = ap->entry->maps->type;
29d2b9
+
29d2b9
+		/* If it's not the internal hosts map it must have a
29d2b9
+		 * mount location.
29d2b9
+		 */
29d2b9
+		if (!type || strcmp(type, "hosts")) {
29d2b9
+			error(ap->logopt,
29d2b9
+			      MODPREFIX "syntax error in offset %s -> %s",
29d2b9
+			      m_offset, loc);
29d2b9
+			return CHE_FAIL;
29d2b9
+		}
29d2b9
+	}
29d2b9
+
29d2b9
 	if (!*m_offset) {
29d2b9
 		error(ap->logopt,
29d2b9
 		      MODPREFIX "syntax error in offset %s -> %s", m_offset, loc);