|
|
306fa1 |
autofs-5.1.0-beta1 - fix old style key lookup
|
|
|
306fa1 |
|
|
|
306fa1 |
From: Ian Kent <ikent@redhat.com>
|
|
|
306fa1 |
|
|
|
306fa1 |
Old (old) style configuration keys all started with DEFAULT_ but
|
|
|
306fa1 |
the configuration entry lookup requires the has of the lower case
|
|
|
306fa1 |
name. So trying to these old style names failes because thet don't
|
|
|
306fa1 |
has to the same value.
|
|
|
306fa1 |
|
|
|
306fa1 |
So change the key lookup to strip the DEFAULT_ string and retry
|
|
|
306fa1 |
the lookup so valid entries hash properly.
|
|
|
306fa1 |
---
|
|
|
306fa1 |
CHANGELOG | 1 +
|
|
|
306fa1 |
lib/defaults.c | 33 +++++++++++++++++++++------------
|
|
|
306fa1 |
2 files changed, 22 insertions(+), 12 deletions(-)
|
|
|
306fa1 |
|
|
|
306fa1 |
--- autofs-5.0.7.orig/CHANGELOG
|
|
|
306fa1 |
+++ autofs-5.0.7/CHANGELOG
|
|
|
306fa1 |
@@ -116,6 +116,7 @@
|
|
|
306fa1 |
- fix map format init in lookup_init().
|
|
|
306fa1 |
- fix incorrect max key length in defaults get_hash().
|
|
|
306fa1 |
- fix xfn sets incorrect lexer state.
|
|
|
306fa1 |
+- fix old style key 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 |
@@ -673,33 +673,42 @@ static u_int32_t get_hash(const char *ke
|
|
|
306fa1 |
return hash(lkey, size);
|
|
|
306fa1 |
}
|
|
|
306fa1 |
|
|
|
306fa1 |
-static struct conf_option *conf_lookup(const char *section, const char *key)
|
|
|
306fa1 |
+static struct conf_option *conf_lookup_key(const char *section, const char *key)
|
|
|
306fa1 |
{
|
|
|
306fa1 |
struct conf_option *co;
|
|
|
306fa1 |
u_int32_t key_hash;
|
|
|
306fa1 |
unsigned int size = CFG_TABLE_SIZE;
|
|
|
306fa1 |
|
|
|
306fa1 |
- if (!key || !section)
|
|
|
306fa1 |
- return NULL;
|
|
|
306fa1 |
-
|
|
|
306fa1 |
- if (strlen(key) > PATH_MAX)
|
|
|
306fa1 |
- return NULL;
|
|
|
306fa1 |
-
|
|
|
306fa1 |
key_hash = get_hash(key, size);
|
|
|
306fa1 |
for (co = config->hash[key_hash]; co != NULL; co = co->next) {
|
|
|
306fa1 |
if (strcasecmp(section, co->section))
|
|
|
306fa1 |
continue;
|
|
|
306fa1 |
if (!strcasecmp(key, co->name))
|
|
|
306fa1 |
break;
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ return co;
|
|
|
306fa1 |
+}
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+static struct conf_option *conf_lookup(const char *section, const char *key)
|
|
|
306fa1 |
+{
|
|
|
306fa1 |
+ struct conf_option *co;
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ if (!key || !section)
|
|
|
306fa1 |
+ return NULL;
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ if (strlen(key) > PATH_MAX)
|
|
|
306fa1 |
+ return NULL;
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ co = conf_lookup_key(section, key);
|
|
|
306fa1 |
+ if (!co) {
|
|
|
306fa1 |
/*
|
|
|
306fa1 |
* Strip "DEFAULT_" and look for config entry for
|
|
|
306fa1 |
* backward compatibility with old style config names.
|
|
|
306fa1 |
+ * Perhaps this should be a case sensitive compare?
|
|
|
306fa1 |
*/
|
|
|
306fa1 |
- if (strlen(key) <= 8)
|
|
|
306fa1 |
- continue;
|
|
|
306fa1 |
- if (!strncasecmp("DEFAULT_", key, 8) &&
|
|
|
306fa1 |
- !strcasecmp(key + 8, co->name))
|
|
|
306fa1 |
- break;
|
|
|
306fa1 |
+ if (strlen(key) > 8 && !strncasecmp("DEFAULT_", key, 8))
|
|
|
306fa1 |
+ co = conf_lookup_key(section, key + 8);
|
|
|
306fa1 |
}
|
|
|
306fa1 |
|
|
|
306fa1 |
return co;
|