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

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