Ian Kent a2f40b
autofs-5.0.7 - make dump maps check for duplicate indirect mounts
Ian Kent a2f40b
Ian Kent a2f40b
From: Ian Kent <raven@themaw.net>
Ian Kent a2f40b
Ian Kent a2f40b
The dumpmaps function was intended for users to find out how the configured
Ian Kent a2f40b
mounts would be seen by automount. It does a limited amount of checking and
Ian Kent a2f40b
in particular doesn't report that duplicate indirect map sources will be
Ian Kent a2f40b
ignored at runtime.
Ian Kent a2f40b
---
Ian Kent a2f40b
 CHANGELOG    |    1 +
Ian Kent a2f40b
 lib/master.c |    7 +++++++
Ian Kent a2f40b
 2 files changed, 8 insertions(+)
Ian Kent a2f40b
Ian Kent a2f40b
diff --git a/CHANGELOG b/CHANGELOG
Ian Kent a2f40b
index 4106e7f..4576d47 100644
Ian Kent a2f40b
--- a/CHANGELOG
Ian Kent a2f40b
+++ b/CHANGELOG
Ian Kent a2f40b
@@ -40,6 +40,7 @@
Ian Kent a2f40b
 - fix some automount(8) typos.
Ian Kent a2f40b
 - syncronize handle_mounts() shutdown.
Ian Kent a2f40b
 - fix submount tree not all expiring.
Ian Kent a2f40b
+- make dump maps check for duplicate indirect mounts.
Ian Kent a2f40b
 
Ian Kent a2f40b
 25/07/2012 autofs-5.0.7
Ian Kent a2f40b
 =======================
Ian Kent a2f40b
diff --git a/lib/master.c b/lib/master.c
Ian Kent a2f40b
index 64dbcb1..eca3523 100644
Ian Kent a2f40b
--- a/lib/master.c
Ian Kent a2f40b
+++ b/lib/master.c
Ian Kent a2f40b
@@ -1310,6 +1310,7 @@ int master_show_mounts(struct master *master)
Ian Kent a2f40b
 		struct master_mapent *this;
Ian Kent a2f40b
 		struct autofs_point *ap;
Ian Kent a2f40b
 		time_t now = time(NULL);
Ian Kent a2f40b
+		unsigned int count = 0;
Ian Kent a2f40b
 		int i;
Ian Kent a2f40b
 
Ian Kent a2f40b
 		this = list_entry(p, struct master_mapent, list);
Ian Kent a2f40b
@@ -1318,6 +1319,7 @@ int master_show_mounts(struct master *master)
Ian Kent a2f40b
 		ap = this->ap;
Ian Kent a2f40b
 
Ian Kent a2f40b
 		printf("\nMount point: %s\n", ap->path);
Ian Kent a2f40b
+
Ian Kent a2f40b
 		printf("\nsource(s):\n");
Ian Kent a2f40b
 
Ian Kent a2f40b
 		/*
Ian Kent a2f40b
@@ -1360,6 +1362,9 @@ int master_show_mounts(struct master *master)
Ian Kent a2f40b
 					printf("  map: %s\n", source->argv[0]);
Ian Kent a2f40b
 					i = 1;
Ian Kent a2f40b
 				}
Ian Kent a2f40b
+				if (count && ap->type == LKP_INDIRECT)
Ian Kent a2f40b
+					printf("  duplicate indirect map entry"
Ian Kent a2f40b
+					       " will be ignored at run time\n");
Ian Kent a2f40b
 				if (source->argc > 1) {
Ian Kent a2f40b
 					printf("  arguments: ");
Ian Kent a2f40b
 					for (; i < source->argc; i++)
Ian Kent a2f40b
@@ -1379,6 +1384,8 @@ int master_show_mounts(struct master *master)
Ian Kent a2f40b
 				} while ((me = cache_lookup_next(source->mc, me)));
Ian Kent a2f40b
 			}
Ian Kent a2f40b
 
Ian Kent a2f40b
+			count++;
Ian Kent a2f40b
+
Ian Kent a2f40b
 			source = source->next;
Ian Kent a2f40b
 		}
Ian Kent a2f40b