From: Amitay Isaacs Date: Thu, 25 Jul 2019 05:14:32 +0000 (+1000) Subject: ctdb-common: Fix empty value handling in conf X-Git-Tag: tdb-1.4.2~415 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=efd0c45a8b152eb4716193bea6cf95e9e0b97d8b;p=thirdparty%2Fsamba.git 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 Reviewed-by: Martin Schwenke --- 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;