Blob Blame History Raw
autofs-5.1.1 - fix config old name lookup

From: Ian Kent <raven@themaw.net>

There are three cases needed to handle configuration name lookup.

First there's the configuration key name, the name match is case
insensitive so the recent case change isn't a seperate case.

But the much older configuration key names that began with "DEFAULT_"
need special handling.

There are two cases that need to be covered:
1) an old name is given but a new name needs to be located.
2) a new name is given but an old name needs to be located.

Only 1) is currently covered, so fix that in conf_lookup().

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG      |    1 +
 lib/defaults.c |   11 +++++++++++
 2 files changed, 12 insertions(+)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -190,6 +190,7 @@
 - log pipe read errors.
 - fix rwlock unlock crash.
 - fix handle_mounts() termination condition check.
+- fix config old name lookup.
 
 25/07/2012 autofs-5.0.7
 =======================
--- autofs-5.0.7.orig/lib/defaults.c
+++ autofs-5.0.7/lib/defaults.c
@@ -727,6 +727,17 @@ static struct conf_option *conf_lookup(c
 		 */
 		if (strlen(key) > 8 && !strncasecmp("DEFAULT_", key, 8))
 			co = conf_lookup_key(section, key + 8);
+		else {
+			/* A new key name has been given but the value
+			 * we seek is stored under an old key name (which
+			 * includes the "DEFAULT_" prefix or doesn't exist.
+			 */
+			char old_key[PATH_MAX + 1];
+
+			strcpy(old_key, "DEFAULT_");
+			strcat(old_key, key);
+			co = conf_lookup_key(section, old_key);
+		}
 	}
 
 	return co;