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

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