From 83c14ba264a27c09b14b4a4ea77a2bd95de7b794 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Sat, 9 Jan 2016 03:48:54 +0100 Subject: degesch: Lua: fix plugin configuration names --- degesch.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/degesch.c b/degesch.c index 8f8424a..3edbe15 100644 --- a/degesch.c +++ b/degesch.c @@ -7276,7 +7276,16 @@ plugin_config_name (struct plugin *self) begin = p; size_t len = strcspn (begin, "."); - return len ? xstrndup (begin, len) : NULL; + if (!len) + return NULL; + + // XXX: we might also allow arbitrary strings as object keys (except dots) + // taking care to use the "" syntax while serializing + char *copy = xstrndup (begin, len); + for (char *p = copy; *p; p++) + if (!config_tokenizer_is_word_char (*p)) + *p = '_'; + return copy; } // --- Lua --------------------------------------------------------------------- -- cgit v1.2.3-70-g09d2