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

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