summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2019-07-25 15:14:32 +1000
committerMartin Schwenke <martins@samba.org>2019-07-26 03:34:16 +0000
commitefd0c45a8b152eb4716193bea6cf95e9e0b97d8b (patch)
treef3138d8a5484b592e81c0947abee36023600464a /ctdb
parent242ea955e672799c45aba47f454900a5a52ce9f6 (diff)
downloadsamba-efd0c45a8b152eb4716193bea6cf95e9e0b97d8b.tar.gz
ctdb-common: Fix empty value handling in conf
In tini, allow_empty_value=false causes the parser to ignore the lines without '=' sign, but lines with nothing after '=' sign are allowed and cause empty string ("") to be passed as a value. This is counter-intuitive, so conf requires special handling for empty values (which are treated as invalid). Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/common/conf.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ctdb/common/conf.c b/ctdb/common/conf.c
index 3d668de3122..e849ff4322f 100644
--- a/ctdb/common/conf.c
+++ b/ctdb/common/conf.c
@@ -1130,6 +1130,14 @@ static bool conf_load_option(const char *name,
}
}
+ if (strlen(value_str) == 0) {
+ D_ERR("conf: empty value [%s] -> \"%s\"\n",
+ state->s->name,
+ name);
+ state->err = EINVAL;
+ return true;
+ }
+
tmp_ctx = talloc_new(state->conf);
if (tmp_ctx == NULL) {
state->err = ENOMEM;