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

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