From: Arran Cudbard-Bell Date: Wed, 6 Oct 2021 02:05:48 +0000 (-0500) Subject: with tmpl_afrom_attr_str when we're expecting an attribute, 0 is an invalid return... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bb7cd828f502473dc533572a4b3ef33694a9568;p=thirdparty%2Ffreeradius-server.git with tmpl_afrom_attr_str when we're expecting an attribute, 0 is an invalid return code too --- diff --git a/src/lib/redis/redis.c b/src/lib/redis/redis.c index 031dbb587b..4b9ada1ba2 100644 --- a/src/lib/redis/redis.c +++ b/src/lib/redis/redis.c @@ -383,8 +383,9 @@ int fr_redis_reply_to_map(TALLOC_CTX *ctx, fr_map_list_t *out, request_t *reques RDEBUG3("Got value : %pV", fr_box_strvalue_len(value->str, value->len)); MEM(map = talloc_zero(ctx, map_t)); - slen = tmpl_afrom_attr_str(map, NULL, &map->lhs, key->str, &(tmpl_rules_t){ .dict_def = request->dict }); - if (slen < 0) { + slen = tmpl_afrom_attr_str(map, NULL, &map->lhs, key->str, + &(tmpl_rules_t){ .dict_def = request->dict }); + if (slen <= 0) { REMARKER(key->str, -slen, "%s", fr_strerror()); goto error; } diff --git a/src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c b/src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c index dd6546ecea..bd39048e7c 100644 --- a/src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c +++ b/src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c @@ -97,12 +97,12 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf) /* * These never change, so do it once on instantiation */ - if (tmpl_afrom_attr_str(driver, NULL, &driver->created_attr, "&Cache-Created", NULL) < 0) { + if (tmpl_afrom_attr_str(driver, NULL, &driver->created_attr, "&Cache-Created", NULL) <= 0) { ERROR("Cache-Created attribute not defined"); return -1; } - if (tmpl_afrom_attr_str(driver, NULL, &driver->expires_attr, "&Cache-Expires", NULL) < 0) { + if (tmpl_afrom_attr_str(driver, NULL, &driver->expires_attr, "&Cache-Expires", NULL) <= 0) { ERROR("Cache-Expires attribute not defined"); return -1; }