Blame SOURCES/autofs-5.0.7-fix-master-map-bogus-keywork-match.patch

304803
autofs-5.0.7 - fix master map bogus keywork match
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
If we have a map name in the master map that ends with a keyword
304803
of one of the map types or "multi" we mistakenly match the trailing
304803
white space and include that in the map name. This has to be wrong
304803
since we can't handle quoting in the master map and embedded white
304803
space must be escaped. It would be good if we handled quoted strings
304803
but that has proven a bit of a nightmare so far for the current
304803
tokenizer.
304803
---
304803
 CHANGELOG        |    1 +
304803
 lib/master_tok.l |   16 ++++++++++++++++
304803
 2 files changed, 17 insertions(+)
304803
304803
diff --git a/CHANGELOG b/CHANGELOG
304803
index 00eaff2..e15aa1f 100644
304803
--- a/CHANGELOG
304803
+++ b/CHANGELOG
304803
@@ -46,6 +46,7 @@
304803
 - fix interface address null check.
304803
 - dont probe rdma mounts.
304803
 - fix master map mount options matching.
304803
+- fix master map bogus keywork match.
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
diff --git a/lib/master_tok.l b/lib/master_tok.l
304803
index 8d1f1a2..a55cc76 100644
304803
--- a/lib/master_tok.l
304803
+++ b/lib/master_tok.l
304803
@@ -202,6 +202,14 @@ OPTNTOUT	(-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo
304803
 	{MULTI} {
304803
 		tlen = master_leng - 1;
304803
 		if (bptr != buff && isblank(master_text[tlen])) {
304803
+			/*
304803
+			 * We can't handle unescaped white space in map names
304803
+			 * so just eat the white space. We always have the
304803
+			 * "multi" at the beginning of the string so the while
304803
+			 * will not fall off the end.
304803
+			 */
304803
+			while (isblank(master_text[tlen - 1]))
304803
+				tlen--;
304803
 			strncat(buff, master_text, tlen);
304803
 			bptr += tlen;
304803
 			yyless(tlen);
304803
@@ -216,6 +224,14 @@ OPTNTOUT	(-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo
304803
 	{MTYPE}/{DNATTRSTR}= {
304803
 		tlen = master_leng - 1;
304803
 		if (bptr != buff && isblank(master_text[tlen])) {
304803
+			/*
304803
+			 * We can't handle unescaped white space in map names
304803
+			 * so just eat the white space. We always have the
304803
+			 * maptype keyword at the beginning of the string so
304803
+			 * the while will not fall off the end.
304803
+			 */
304803
+			while (isblank(master_text[tlen - 1]))
304803
+				tlen--;
304803
 			strncat(buff, master_text, tlen);
304803
 			bptr += tlen;
304803
 			yyless(tlen);