Blame SOURCES/autofs-5.1.0-beta1-allow-empty-value-in-macro-selectors.patch

306fa1
autofs-5.1.0-beta1 - allow empty value in macro selectors
306fa1
306fa1
From: Ian Kent <raven@themaw.net>
306fa1
306fa1
Some map selectors (this case is olny considering macro selectors) may
306fa1
be given the comparison value left blank, possibly with the intent the
306fa1
selector will not match so a mount will not be attempted, such as when
306fa1
the delay option is also given.
306fa1
306fa1
autofs doesn't implement the delay option but it shouldn't fail to parse
306fa1
these locations so that a valid locations in the list can be tried.
306fa1
---
306fa1
 CHANGELOG           |    1 +
306fa1
 modules/amd_parse.y |   14 ++++++++++++++
306fa1
 modules/parse_amd.c |    9 +++++++--
306fa1
 3 files changed, 22 insertions(+), 2 deletions(-)
306fa1
306fa1
--- autofs-5.0.7.orig/CHANGELOG
306fa1
+++ autofs-5.0.7/CHANGELOG
306fa1
@@ -125,6 +125,7 @@
306fa1
 - fix multi entry ldap option handling.
306fa1
 - cleanup options in amd_parse.c
306fa1
 - allow empty value for some map options.
306fa1
+- allow empty value in macro selectors.
306fa1
 
306fa1
 25/07/2012 autofs-5.0.7
306fa1
 =======================
306fa1
--- autofs-5.0.7.orig/modules/amd_parse.y
306fa1
+++ autofs-5.0.7/modules/amd_parse.y
306fa1
@@ -200,12 +200,26 @@ selection: SELECTOR IS_EQUAL SELECTOR_VA
306fa1
 			YYABORT;
306fa1
 		}
306fa1
 	}
306fa1
+	| SELECTOR IS_EQUAL
306fa1
+	{
306fa1
+		if (!make_selector($1, "", NULL, SEL_COMP_EQUAL)) {
306fa1
+			amd_notify($1);
306fa1
+			YYABORT;
306fa1
+		}
306fa1
+	}
306fa1
 	| SELECTOR NOT_EQUAL SELECTOR_VALUE
306fa1
 	{
306fa1
 		if (!make_selector($1, $3, NULL, SEL_COMP_NOTEQUAL)) {
306fa1
 			amd_notify($1);
306fa1
 			YYABORT;
306fa1
 		}
306fa1
+	}
306fa1
+	| SELECTOR NOT_EQUAL
306fa1
+	{
306fa1
+		if (!make_selector($1, "", NULL, SEL_COMP_EQUAL)) {
306fa1
+			amd_notify($1);
306fa1
+			YYABORT;
306fa1
+		}
306fa1
 	}
306fa1
 	| SELECTOR LBRACKET SEL_ARG_VALUE RBRACKET
306fa1
 	{
306fa1
--- autofs-5.0.7.orig/modules/parse_amd.c
306fa1
+++ autofs-5.0.7/modules/parse_amd.c
306fa1
@@ -350,8 +350,13 @@ static int eval_selector(unsigned int lo
306fa1
 			break;
306fa1
 
306fa1
 		case SEL_FLAG_NUM:
306fa1
-			res = atoi(v->val);
306fa1
-			val = atoi(s->comp.value);
306fa1
+			if (!*s->comp.value) {
306fa1
+				res = 1;
306fa1
+				val = 0;
306fa1
+			} else {
306fa1
+				res = atoi(v->val);
306fa1
+				val = atoi(s->comp.value);
306fa1
+			}
306fa1
 			if (s->compare & SEL_COMP_EQUAL && res == val) {
306fa1
 				debug(logopt, MODPREFIX
306fa1
 				      "matched selector %s(%s) equal to %s",