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

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