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

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