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

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