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(-)

diff --git a/CHANGELOG b/CHANGELOG
index a45ca6a..fb2f2d6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 ??/??/20?? autofs-5.0.9
 =======================
 - fix undefined authtype_requires_creds err if ldap enabled but without sasl.
+- fix master map type check.
 
 17/10/2013 autofs-5.0.8
 =======================
diff --git a/daemon/lookup.c b/daemon/lookup.c
index e3d9536..7fea942 100644
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -171,14 +171,22 @@ int lookup_nss_read_master(struct master *master, time_t age)
 			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);
 
 				/*