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

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