Blob Blame History Raw
autofs-5.1.6 - fix trailing dollar sun entry expansion

From: Ian Kent <raven@themaw.net>

In modules/parse_sun.c:expandsunent() if we see "$ " or "$<NULL>" in a
the entry it can't be a macro, and the value can't be quoted since '\'
and '"' cases are handled seperately in the swicth, so treat the
character as a valid entry character.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG           |    1 +
 modules/parse_sun.c |   12 ++++++++++++
 2 files changed, 13 insertions(+)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -351,6 +351,7 @@
 - use local getmntent_r() in tree_make_mnt_list().
 - fix missing initialization of autofs_point flags.
 - also use strictexpire for offsets.
+- fix trailing dollar sun entry expansion.
 
 25/07/2012 autofs-5.0.7
 =======================
--- autofs-5.0.7.orig/modules/parse_sun.c
+++ autofs-5.0.7/modules/parse_sun.c
@@ -161,6 +161,18 @@ int expandsunent(const char *src, char *
 				}
 				src = p + 1;
 			} else {
+				/* If the '$' is folloed by a space or NULL it
+				 * can't be a macro, and the value can't be
+				 * quoted since '\' and '"' cases are handled
+				 * in other cases, so treat the $ as a valid
+				 * map entry character.
+				 */
+				if (*src == ' ' || !*src) {
+					if (dst)
+						*dst++ = ch;
+					len++;
+					break;
+				}
 				p = src;
 				while (isalnum(*p) || *p == '_')
 					p++;