]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
with tmpl_afrom_attr_str when we're expecting an attribute, 0 is an invalid return...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 6 Oct 2021 02:05:48 +0000 (21:05 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 6 Oct 2021 02:06:00 +0000 (21:06 -0500)
src/lib/redis/redis.c
src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c

index 031dbb587bad3e6f3dbba4d8289d1ae46e022ee4..4b9ada1ba29a985dec2c1f8c7dc48e793e9701dc 100644 (file)
@@ -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;
        }
index dd6546eceaf93820859f5a0422cd247bf4252596..bd39048e7cee6434afad0b4d6133335143cda4a3 100644 (file)
@@ -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;
        }