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

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