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

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