Blob Blame History Raw
autofs-5.0.8 - fix master map type check

From: Ian Kent <ikent@redhat.com>

Map type has format <type>[,<format>] but the master map type check
for old style map syntax doesn't allow for <format>.
---
 CHANGELOG       |    1 +
 daemon/lookup.c |   24 ++++++++++++++++--------
 2 files changed, 17 insertions(+), 8 deletions(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -87,6 +87,7 @@
 - pass map_source as function paramter where possible.
 - check for bind onto self in mount_bind.c.
 - fix symlink expire.
+- fix master map type check.
 
 25/07/2012 autofs-5.0.7
 =======================
--- autofs-5.0.7.orig/daemon/lookup.c
+++ autofs-5.0.7/daemon/lookup.c
@@ -171,14 +171,22 @@ int lookup_nss_read_master(struct master
 			char source[10];
 
 			memset(source, 0, 10);
-			if (!strncmp(name, "file:", 5) ||
-			    !strncmp(name, "yp:", 3) ||
-			    !strncmp(name, "nis:", 4) ||
-			    !strncmp(name, "nisplus:", 8) ||
-			    !strncmp(name, "ldap:", 5) ||
-			    !strncmp(name, "ldaps:", 6) ||
-			    !strncmp(name, "sss:", 4) ||
-			    !strncmp(name, "dir:", 4)) {
+			if ((!strncmp(name, "file", 4) &&
+				 (name[4] == ',' || name[4] == ':')) ||
+			    (!strncmp(name, "yp", 3) &&
+				 (name[3] == ',' || name[3] == ':')) ||
+			    (!strncmp(name, "nis", 3) &&
+				 (name[3] == ',' || name[3] == ':')) ||
+			    (!strncmp(name, "nisplus", 7) &&
+				 (name[7] == ',' || name[7] == ':')) ||
+			    (!strncmp(name, "ldap", 4) &&
+				 (name[4] == ',' || name[4] == ':')) ||
+			    (!strncmp(name, "ldaps", 5) &&
+				 (name[5] == ',' || name[5] == ':')) ||
+			    (!strncmp(name, "sss", 3) ||
+				 (name[3] == ',' || name[3] == ':')) ||
+			    (!strncmp(name, "dir", 3) &&
+				 (name[3] == ',' || name[3] == ':'))) {
 				strncpy(source, name, tmp - name);
 
 				/*