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

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