Blame SOURCES/autofs-5.1.1-fix-config-old-name-lookup.patch

019928
autofs-5.1.1 - fix config old name lookup
019928
019928
From: Ian Kent <raven@themaw.net>
019928
019928
There are three cases needed to handle configuration name lookup.
019928
019928
First there's the configuration key name, the name match is case
019928
insensitive so the recent case change isn't a seperate case.
019928
019928
But the much older configuration key names that began with "DEFAULT_"
019928
need special handling.
019928
019928
There are two cases that need to be covered:
019928
1) an old name is given but a new name needs to be located.
019928
2) a new name is given but an old name needs to be located.
019928
019928
Only 1) is currently covered, so fix that in conf_lookup().
019928
019928
Signed-off-by: Ian Kent <raven@themaw.net>
019928
---
019928
 CHANGELOG      |    1 +
019928
 lib/defaults.c |   11 +++++++++++
019928
 2 files changed, 12 insertions(+)
019928
019928
--- autofs-5.0.7.orig/CHANGELOG
019928
+++ autofs-5.0.7/CHANGELOG
019928
@@ -190,6 +190,7 @@
019928
 - log pipe read errors.
019928
 - fix rwlock unlock crash.
019928
 - fix handle_mounts() termination condition check.
019928
+- fix config old name lookup.
019928
 
019928
 25/07/2012 autofs-5.0.7
019928
 =======================
019928
--- autofs-5.0.7.orig/lib/defaults.c
019928
+++ autofs-5.0.7/lib/defaults.c
019928
@@ -727,6 +727,17 @@ static struct conf_option *conf_lookup(c
019928
 		 */
019928
 		if (strlen(key) > 8 && !strncasecmp("DEFAULT_", key, 8))
019928
 			co = conf_lookup_key(section, key + 8);
019928
+		else {
019928
+			/* A new key name has been given but the value
019928
+			 * we seek is stored under an old key name (which
019928
+			 * includes the "DEFAULT_" prefix or doesn't exist.
019928
+			 */
019928
+			char old_key[PATH_MAX + 1];
019928
+
019928
+			strcpy(old_key, "DEFAULT_");
019928
+			strcat(old_key, key);
019928
+			co = conf_lookup_key(section, old_key);
019928
+		}
019928
 	}
019928
 
019928
 	return co;