Blame SOURCES/autofs-5.1.1-fix-map-format-check-in-nss_open_lookup-multi-map-module.patch

306fa1
autofs-5.1.1 - fix map format check in nss_open_lookup() multi map module
306fa1
306fa1
From: Ian Kent <raven@themaw.net>
306fa1
306fa1
The nss_open_lookup() function doesn't properly allow for map format when
306fa1
it's given with the map type.
306fa1
306fa1
Signed-off-by: Ian Kent <raven@themaw.net>
306fa1
---
306fa1
 modules/lookup_multi.c |   16 ++++++++++++----
306fa1
 1 file changed, 12 insertions(+), 4 deletions(-)
306fa1
306fa1
diff --git a/modules/lookup_multi.c b/modules/lookup_multi.c
306fa1
index 433b424..f8ebf94 100644
306fa1
--- a/modules/lookup_multi.c
306fa1
+++ b/modules/lookup_multi.c
306fa1
@@ -24,6 +24,8 @@
306fa1
 #include "automount.h"
306fa1
 #include "nsswitch.h"
306fa1
 
306fa1
+#define MAX_MAP_TYPE_STRING	20
306fa1
+
306fa1
 #define MODPREFIX "lookup(multi): "
306fa1
 
306fa1
 struct module_info {
306fa1
@@ -166,11 +168,17 @@ static struct lookup_mod *nss_open_lookup(const char *format, int argc, const ch
306fa1
 	    !strncmp(argv[0], "ldaps", 5) ||
306fa1
 	    !strncmp(argv[0], "ldap", 4) ||
306fa1
 	    !strncmp(argv[0], "sss", 3)) {
306fa1
-		const char *fmt = strchr(argv[0], ',');
306fa1
-		if (fmt)
306fa1
+		char type[MAX_MAP_TYPE_STRING];
306fa1
+		char *fmt;
306fa1
+
306fa1
+		strcpy(type, argv[0]);
306fa1
+		fmt = strchr(type, ',');
306fa1
+		if (!fmt)
306fa1
+			fmt = (char *) format;
306fa1
+		else {
306fa1
+			*fmt = '\0';
306fa1
 			fmt++;
306fa1
-		else
306fa1
-			fmt = format;
306fa1
+		}
306fa1
 		open_lookup(argv[0], MODPREFIX, fmt, argc - 1, argv + 1, &mod);
306fa1
 		return mod;
306fa1
 	}