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

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