Blame SOURCES/autofs-5.0.9-amd-lookup-add-cut-handling.patch

6bbd11
autofs-5.0.9 - amd lookup add cut handling
6bbd11
6bbd11
From: Ian Kent <raven@themaw.net>
6bbd11
6bbd11
Now we have the added the selector handling we can add the cut location
6bbd11
handling.
6bbd11
---
6bbd11
 modules/parse_amd.c |   11 +++++++++++
6bbd11
 1 file changed, 11 insertions(+)
6bbd11
6bbd11
diff --git a/modules/parse_amd.c b/modules/parse_amd.c
6bbd11
index d9c7d9b..5d8617e 100644
6bbd11
--- a/modules/parse_amd.c
6bbd11
+++ b/modules/parse_amd.c
6bbd11
@@ -1425,6 +1425,7 @@ int parse_mount(struct autofs_point *ap, const char *name,
6bbd11
 	struct map_source *source;
6bbd11
 	struct mapent_cache *mc;
6bbd11
 	struct mapent *me;
6bbd11
+	unsigned int at_least_one;
6bbd11
 	struct list_head entries, *p, *head;
6bbd11
 	struct amd_entry *defaults_entry;
6bbd11
 	struct amd_entry *cur_defaults;
6bbd11
@@ -1517,6 +1518,7 @@ int parse_mount(struct autofs_point *ap, const char *name,
6bbd11
 		goto done;
6bbd11
 	}
6bbd11
 
6bbd11
+	at_least_one = 0;
6bbd11
 	head = &entries;
6bbd11
 	p = head->next;
6bbd11
 	while (p != head) {
6bbd11
@@ -1540,9 +1542,18 @@ int parse_mount(struct autofs_point *ap, const char *name,
6bbd11
 			continue;
6bbd11
 		}
6bbd11
 
6bbd11
+		if (this->flags & AMD_ENTRY_CUT && at_least_one) {
6bbd11
+			info(ap->logopt, MODPREFIX
6bbd11
+			     "at least one entry tried before cut selector, "
6bbd11
+			     "not continuing");
6bbd11
+			break;
6bbd11
+		}
6bbd11
+
6bbd11
 		if (!match_selectors(ap->logopt, this, sv))
6bbd11
 			continue;
6bbd11
 
6bbd11
+		at_least_one = 1;
6bbd11
+
6bbd11
 		update_with_defaults(cur_defaults, this, sv);
6bbd11
 		sv = expand_entry(ap, this, flags, sv);
6bbd11
 		sv = merge_entry_options(ap, this, sv);