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

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