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

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