]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
tmpl: Have tmpl_value "return" a pointer to the box
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 5 May 2020 22:38:35 +0000 (17:38 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 5 May 2020 22:40:37 +0000 (17:40 -0500)
Makes it behave more like a function

src/lib/redis/redis.c
src/lib/server/cond_eval.c
src/lib/server/map.c
src/lib/server/map_async.c
src/lib/server/tmpl.c
src/lib/server/tmpl.h
src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c
src/modules/rlm_cache/rlm_cache.c
src/modules/rlm_cache/serialize.c
src/modules/rlm_json/rlm_json.c
src/modules/rlm_redis_ippool/rlm_redis_ippool.c

index a5658e62de55c1f06eb9e3764b3b764efc637158..46c2877efed649e5d1002e1bd0e37fcf185715a8 100644 (file)
@@ -375,7 +375,7 @@ int fr_redis_tuple_from_map(TALLOC_CTX *pool, char const *out[], size_t out_len[
        switch (tmpl_value_type(map->rhs)) {
        case FR_TYPE_STRING:
        case FR_TYPE_OCTETS:
-               out[2] = tmpl_value(map->rhs).datum.ptr;
+               out[2] = tmpl_value(map->rhs)->datum.ptr;
                out_len[2] = tmpl_value_length(map->rhs);
                break;
 
@@ -383,7 +383,7 @@ int fr_redis_tuple_from_map(TALLOC_CTX *pool, char const *out[], size_t out_len[
         *      For everything else we get the string representation
         */
        default:
-               new = fr_value_box_asprint(pool, &tmpl_value(map->rhs), '\0');
+               new = fr_value_box_asprint(pool, tmpl_value(map->rhs), '\0');
                if (!new) {
                        talloc_free(key);
                        return -1;
index bb33a70d87330bc844ce6b9081bba670092e404b..be7c8aee8040847996110e8e5e3eec4d1f172cac 100644 (file)
@@ -489,7 +489,7 @@ do {\
                break;
 
        case TMPL_TYPE_DATA:
-               rhs = &tmpl_value(map->rhs);
+               rhs = tmpl_value(map->rhs);
 
                CHECK_INT_CAST(lhs, rhs);
                CAST(lhs);
@@ -630,7 +630,7 @@ int cond_eval_map(REQUEST *request, UNUSED int modreturn, UNUSED int depth, fr_c
                break;
 
        case TMPL_TYPE_DATA:
-               rcode = cond_normalise_and_cmp(request, c, &tmpl_value(map->lhs));
+               rcode = cond_normalise_and_cmp(request, c, tmpl_value(map->lhs));
                break;
 
        case TMPL_TYPE_UNPARSED:
index c56117abc8c533fe789fdf0558e5d0464998617a..f549b30209e4b69fa492d9643d83ef4b38790fc1 100644 (file)
@@ -717,7 +717,7 @@ int map_afrom_vp(TALLOC_CTX *ctx, vp_map_t **out, VALUE_PAIR *vp, vp_tmpl_rules_
                break;
        }
 
-       fr_value_box_copy(map->rhs, &tmpl_value(map->rhs), &vp->data);
+       fr_value_box_copy(map->rhs, tmpl_value(map->rhs), &vp->data);
 
        *out = map;
 
@@ -1104,14 +1104,13 @@ int map_to_vp(TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request, vp_map_t cons
                MEM(n = fr_pair_afrom_da(ctx, tmpl_da(map->lhs)));
 
                if (tmpl_da(map->lhs)->type == tmpl_value_type(map->rhs)) {
-                       if (fr_value_box_copy(n, &n->data, &tmpl_value(map->rhs)) < 0) {
+                       if (fr_value_box_copy(n, &n->data, tmpl_value(map->rhs)) < 0) {
                                rcode = -1;
                                talloc_free(n);
                                goto error;
                        }
                } else {
-                       if (fr_value_box_cast(n, &n->data, n->vp_type, n->da,
-                                          &tmpl_value(map->rhs)) < 0) {
+                       if (fr_value_box_cast(n, &n->data, n->vp_type, n->da, tmpl_value(map->rhs)) < 0) {
                                RPEDEBUG("Implicit cast failed");
                                rcode = -1;
                                talloc_free(n);
index dbbc3d13fee2994785b49fa4b53ca7623ea6f278..5479d66959a3bd0b24ac47864b4201be9670744f 100644 (file)
@@ -177,7 +177,7 @@ static inline vp_list_mod_t *list_mod_empty_string_afrom_map(TALLOC_CTX *ctx,
         *      zero length string to the specified type and
         *      see what happens...
         */
-       if (fr_value_box_cast(n->mod->rhs, &tmpl_value(n->mod->rhs),
+       if (fr_value_box_cast(n->mod->rhs, tmpl_value(n->mod->rhs),
                              mutated->cast ? mutated->cast : tmpl_da(mutated->lhs)->type,
                              tmpl_da(mutated->lhs), &empty_string) < 0) {
                talloc_free(n);
@@ -410,7 +410,7 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out,
                         *      getting the buffer value from may be freed
                         *      before this map is applied.
                         */
-                       if (fr_value_box_copy(n_mod->rhs, &tmpl_value(n_mod->rhs), &vp->data) < 0) goto error;
+                       if (fr_value_box_copy(n_mod->rhs, tmpl_value(n_mod->rhs), &vp->data) < 0) goto error;
                        fr_cursor_append(&to, n_mod);
                } while ((vp = fr_cursor_next(&from)));
 
@@ -432,7 +432,7 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out,
 
                fr_cursor_init(&values, &head);
 
-               if (fr_value_box_from_str(n->mod, &tmpl_value(n->mod->rhs), &type,
+               if (fr_value_box_from_str(n->mod, tmpl_value(n->mod->rhs), &type,
                                          tmpl_da(mutated->lhs),
                                          mutated->rhs->name, mutated->rhs->len, mutated->rhs->quote, false)) {
                        RPEDEBUG("Assigning value to \"%s\" failed", tmpl_da(mutated->lhs)->name);
@@ -596,7 +596,7 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out,
                n = list_mod_generic_afrom_map(ctx, original, mutated);
                if (!n) goto error;
 
-               vb_head = &tmpl_value(mutated->rhs);
+               vb_head = tmpl_value(mutated->rhs);
 
                for (vb = fr_cursor_init(&from, &vb_head);
                     vb;
@@ -745,8 +745,8 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out,
         *      If tmpl_value were a pointer we could
         *      assign values directly.
         */
-       fr_value_box_copy(n->mod->rhs, &tmpl_value(n->mod->rhs), head);
-       tmpl_value(n->mod->rhs).next = head->next;
+       fr_value_box_copy(n->mod->rhs, tmpl_value(n->mod->rhs), head);
+       tmpl_value(n->mod->rhs)->next = head->next;
        talloc_free(head);
 
 finish:
@@ -797,8 +797,8 @@ static VALUE_PAIR *map_list_mod_to_vps(TALLOC_CTX *ctx, vp_list_mod_t const *vlm
        /*
         *      Fast path...
         */
-       if (!vlm->mod->next && !tmpl_value(vlm->mod->rhs).next) {
-               return map_list_mod_to_vp(ctx, vlm->mod->lhs, &tmpl_value(vlm->mod->rhs));
+       if (!vlm->mod->next && !tmpl_value(vlm->mod->rhs)->next) {
+               return map_list_mod_to_vp(ctx, vlm->mod->lhs, tmpl_value(vlm->mod->rhs));
        }
 
        /*
@@ -811,7 +811,7 @@ static VALUE_PAIR *map_list_mod_to_vps(TALLOC_CTX *ctx, vp_list_mod_t const *vlm
                fr_value_box_t  *vb;
                VALUE_PAIR      *vp;
 
-               for (vb = &tmpl_value(mod->rhs);
+               for (vb = tmpl_value(mod->rhs);
                     vb;
                     vb = vb->next) {
                        vp = map_list_mod_to_vp(ctx, mod->lhs, vb);
@@ -947,7 +947,7 @@ int map_list_mod_apply(REQUEST *request, vp_list_mod_t const *vlm)
                 *      map_list_mod_debug()
                 */
                if (RDEBUG_ENABLED2) {
-                       for (vb = &tmpl_value(mod->rhs);
+                       for (vb = tmpl_value(mod->rhs);
                             vb;
                             vb = vb->next) {
                                map_list_mod_debug(request, map, mod, vb->type != FR_TYPE_INVALID ? vb : NULL);
@@ -1100,7 +1100,7 @@ int map_list_mod_apply(REQUEST *request, vp_list_mod_t const *vlm)
                 *      any of these values.
                 */
                if (tmpl_num(map->lhs) != NUM_ALL) {
-                       fr_value_box_t  *vb = &tmpl_value(vlm->mod->rhs);
+                       fr_value_box_t  *vb = tmpl_value(vlm->mod->rhs);
 
                        do {
                                if (fr_value_box_cmp(vb, &found->data) == 0) {
@@ -1118,7 +1118,7 @@ int map_list_mod_apply(REQUEST *request, vp_list_mod_t const *vlm)
                 *      matches any of these values.
                 */
                do {
-                       fr_value_box_t  *vb = &tmpl_value(vlm->mod->rhs);
+                       fr_value_box_t  *vb = tmpl_value(vlm->mod->rhs);
 
                        do {
                                if (fr_value_box_cmp(vb, &found->data) == 0) {
@@ -1205,7 +1205,7 @@ int map_list_mod_apply(REQUEST *request, vp_list_mod_t const *vlm)
                 *      Instance specific[n] filter
                 */
                if (tmpl_num(map->lhs) != NUM_ALL) {
-                       fr_value_box_t  *vb = &tmpl_value(mod->rhs);
+                       fr_value_box_t  *vb = tmpl_value(mod->rhs);
                        bool            remove = true;
 
                        do {
@@ -1220,7 +1220,7 @@ int map_list_mod_apply(REQUEST *request, vp_list_mod_t const *vlm)
                 *      All instances[*] filter
                 */
                do {
-                       fr_value_box_t  *vb = &tmpl_value(mod->rhs);
+                       fr_value_box_t  *vb = tmpl_value(mod->rhs);
                        bool            remove = true;
 
                        do {
index 8ed0958f644486622418bbe949bb7ac1286a5bdd..0c185dff4d00e38d85602194ff6c0a5a16721916 100644 (file)
@@ -557,12 +557,12 @@ int tmpl_afrom_value_box(TALLOC_CTX *ctx, vp_tmpl_t **out, fr_value_box_t *data,
                  (data->type == FR_TYPE_STRING) ? T_SINGLE_QUOTED_STRING : T_BARE_WORD);
 
        if (steal) {
-               if (fr_value_box_steal(vpt, &tmpl_value(vpt), data) < 0) {
+               if (fr_value_box_steal(vpt, tmpl_value(vpt), data) < 0) {
                        talloc_free(vpt);
                        return -1;
                }
        } else {
-               if (fr_value_box_copy(vpt, &tmpl_value(vpt), data) < 0) {
+               if (fr_value_box_copy(vpt, tmpl_value(vpt), data) < 0) {
                        talloc_free(vpt);
                        return -1;
                }
@@ -1121,11 +1121,11 @@ ssize_t tmpl_afrom_str(TALLOC_CTX *ctx, vp_tmpl_t **out,
                        binlen = (inlen - 2) / 2;
 
                        vpt = tmpl_alloc(ctx, TMPL_TYPE_DATA, in, inlen, type);
-                       tmpl_value(vpt).datum.ptr = talloc_array(vpt, uint8_t, binlen);
+                       tmpl_value(vpt)->datum.ptr = talloc_array(vpt, uint8_t, binlen);
                        tmpl_value_length_set(vpt, binlen);
                        tmpl_value_type_set(vpt, FR_TYPE_OCTETS);
 
-                       len = fr_hex2bin(tmpl_value(vpt).datum.ptr, binlen, in + 2, inlen - 2);
+                       len = fr_hex2bin(tmpl_value(vpt)->datum.ptr, binlen, in + 2, inlen - 2);
                        if (len != binlen) {
                                fr_strerror_printf("Hex string contains non-hex char");
                                talloc_free(vpt);
@@ -1323,7 +1323,7 @@ int tmpl_cast_in_place(vp_tmpl_t *vpt, fr_type_t type, fr_dict_attr_t const *enu
                /*
                 *      Why do we pass a pointer to the tmpl type? Goddamn WiMAX.
                 */
-               if (fr_value_box_from_str(vpt, &tmpl_value(vpt), &tmpl_value_type(vpt),
+               if (fr_value_box_from_str(vpt, tmpl_value(vpt), &tmpl_value_type(vpt),
                                          enumv, vpt->name, vpt->len, '\0', false) < 0) return -1;
                vpt->type = TMPL_TYPE_DATA;
                break;
@@ -1334,7 +1334,7 @@ int tmpl_cast_in_place(vp_tmpl_t *vpt, fr_type_t type, fr_dict_attr_t const *enu
 
                if (type == tmpl_value_type(vpt)) return 0;     /* noop */
 
-               if (fr_value_box_cast(vpt, &new, type, enumv, &tmpl_value(vpt)) < 0) return -1;
+               if (fr_value_box_cast(vpt, &new, type, enumv, tmpl_value(vpt)) < 0) return -1;
 
                /*
                 *      Free old value buffers
@@ -1342,14 +1342,14 @@ int tmpl_cast_in_place(vp_tmpl_t *vpt, fr_type_t type, fr_dict_attr_t const *enu
                switch (tmpl_value_type(vpt)) {
                case FR_TYPE_STRING:
                case FR_TYPE_OCTETS:
-                       talloc_free(tmpl_value(vpt).datum.ptr);
+                       talloc_free(tmpl_value(vpt)->datum.ptr);
                        break;
 
                default:
                        break;
                }
 
-               fr_value_box_copy(vpt, &tmpl_value(vpt), &new);
+               fr_value_box_copy(vpt, tmpl_value(vpt), &new);
        }
                break;
 
@@ -1373,12 +1373,12 @@ void tmpl_cast_in_place_str(vp_tmpl_t *vpt)
        fr_assert(vpt != NULL);
        fr_assert(tmpl_is_unparsed(vpt));
 
-       tmpl_value(vpt).vb_strvalue = talloc_typed_strdup(vpt, vpt->name);
-       fr_assert(tmpl_value(vpt).vb_strvalue != NULL);
+       tmpl_value(vpt)->vb_strvalue = talloc_typed_strdup(vpt, vpt->name);
+       fr_assert(tmpl_value(vpt)->vb_strvalue != NULL);
 
        vpt->type = TMPL_TYPE_DATA;
        tmpl_value_type_set(vpt, FR_TYPE_STRING);
-       tmpl_value_length_set(vpt, talloc_array_length(tmpl_value(vpt).vb_strvalue) - 1);
+       tmpl_value_length_set(vpt, talloc_array_length(tmpl_value(vpt)->vb_strvalue) - 1);
 }
 
 /** Expand a #vp_tmpl_t to a string, parse it as an attribute of type cast, create a #VALUE_PAIR from the result
@@ -1415,7 +1415,7 @@ int tmpl_cast_to_vp(VALUE_PAIR **out, REQUEST *request,
                VP_VERIFY(vp);
                fr_assert(vp->vp_type == tmpl_value_type(vpt));
 
-               fr_value_box_copy(vp, &vp->data, &tmpl_value(vpt));
+               fr_value_box_copy(vp, &vp->data, tmpl_value(vpt));
                *out = vp;
                return 0;
        }
@@ -1691,7 +1691,7 @@ ssize_t _tmpl_to_type(void *out,
                ret = tmpl_find_vp(&vp, request, vpt);
                if (ret < 0) return -2;
 
-               to_cast = &tmpl_value(vpt);
+               to_cast = tmpl_value(vpt);
                src_type = tmpl_value_type(vpt);
        }
                break;
@@ -2013,7 +2013,7 @@ ssize_t _tmpl_to_atype(TALLOC_CTX *ctx, void *out,
        {
                RDEBUG4("EXPAND TMPL DATA");
 
-               to_cast = &tmpl_value(vpt);
+               to_cast = tmpl_value(vpt);
                switch (to_cast->type) {
                case FR_TYPE_STRING:
                case FR_TYPE_OCTETS:
@@ -2307,7 +2307,7 @@ do_literal:
                break;
 
        case TMPL_TYPE_DATA:
-               return fr_value_box_snprint(out, end - out_p, &tmpl_value(vpt), fr_token_quote[vpt->quote]);
+               return fr_value_box_snprint(out, end - out_p, tmpl_value(vpt), fr_token_quote[vpt->quote]);
 
        default:
                goto empty;
@@ -2836,7 +2836,7 @@ void tmpl_verify(char const *file, int line, vp_tmpl_t const *vpt)
                 */
                switch (tmpl_value_type(vpt)) {
                case FR_TYPE_STRING:
-                       if (tmpl_value(vpt).vb_strvalue[tmpl_value_length(vpt)] != '\0') {
+                       if (tmpl_value(vpt)->vb_strvalue[tmpl_value_length(vpt)] != '\0') {
                                fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: TMPL_TYPE_DATA char buffer not \\0 "
                                                     "terminated", file, line);
                        }
index 3915e3901361dc974005bab789010028ba3cc9cc..02aa33fd8f70a212424efc78a35c31b160f7e1fc 100644 (file)
@@ -252,7 +252,7 @@ struct vp_tmpl_s {
  *
  * @{
  */
-#define tmpl_value(_tmpl)              (_tmpl)->data.literal
+#define tmpl_value(_tmpl)              (&(_tmpl)->data.literal)
 #define tmpl_value_length(_tmpl)       (_tmpl)->data.literal.datum.length
 #define tmpl_value_type(_tmpl)         (_tmpl)->data.literal.type
 
index 09663b7cf2acc51bf8722fff038490c30ad1ae63..e9af6f3b7e5d74b4c988bd86c44b073b7937df6e 100644 (file)
@@ -223,7 +223,7 @@ static cache_status_t cache_entry_find(rlm_cache_entry_t **out,
        if (tmpl_da(head->lhs) == attr_cache_created) {
                vp_map_t *map;
 
-               c->created = tmpl_value(head->rhs).vb_date;
+               c->created = tmpl_value(head->rhs)->vb_date;
 
                map = head;
                head = head->next;
@@ -236,7 +236,7 @@ static cache_status_t cache_entry_find(rlm_cache_entry_t **out,
        if (tmpl_da(head->lhs) == attr_cache_expires) {
                vp_map_t *map;
 
-               c->expires = tmpl_value(head->rhs).vb_date;
+               c->expires = tmpl_value(head->rhs)->vb_date;
 
                map = head;
                head = head->next;
@@ -302,7 +302,7 @@ static cache_status_t cache_entry_insert(UNUSED rlm_cache_config_t const *config
         */
        tmpl_init(&created_value, TMPL_TYPE_DATA, "<TEMP>", 6, T_BARE_WORD);
        tmpl_value_type(&created_value) = FR_TYPE_DATE;
-       tmpl_value(&created_value).vb_date = c->created;
+       tmpl_value(&created_value)->vb_date = c->created;
 
        /*
         *      Encode the entry expiry time
@@ -312,7 +312,7 @@ static cache_status_t cache_entry_insert(UNUSED rlm_cache_config_t const *config
         */
        tmpl_init(&expires_value, TMPL_TYPE_DATA, "<TEMP>", 6, T_BARE_WORD);
        tmpl_value_type(&expires_value) = FR_TYPE_DATE;
-       tmpl_value(&expires_value).vb_date = c->expires;
+       tmpl_value(&expires_value)->vb_date = c->expires;
        expires.next = c->maps; /* Head of the list */
 
        for (cnt = 0, map = &created; map; cnt++, map = map->next);
index aac899f18072971797f3debc646282022a6c6678..44fcb67757effc8773cadfd17197839ded1406ce 100644 (file)
@@ -385,7 +385,7 @@ static rlm_rcode_t cache_insert(rlm_cache_t const *inst, REQUEST *request, rlm_c
                        do_rhs:
                                MEM(c_map->rhs = tmpl_init(talloc(c_map, vp_tmpl_t),
                                                           TMPL_TYPE_DATA, map->rhs->name, map->rhs->len, T_BARE_WORD));
-                               if (fr_value_box_copy(c_map->rhs, &tmpl_value(c_map->rhs), &vp->data) < 0) {
+                               if (fr_value_box_copy(c_map->rhs, tmpl_value(c_map->rhs), &vp->data) < 0) {
                                        REDEBUG("Failed copying attribute value");
                                error:
                                        talloc_free(pool);
@@ -864,7 +864,7 @@ static ssize_t cache_xlat(TALLOC_CTX *ctx, char **out, UNUSED size_t freespace,
                    (tmpl_tag(map->lhs) != tmpl_tag(target)) ||
                    (tmpl_list(map->lhs) != tmpl_list(target))) continue;
 
-               *out = fr_value_box_asprint(request, &tmpl_value(map->rhs), '\0');
+               *out = fr_value_box_asprint(request, tmpl_value(map->rhs), '\0');
                ret = talloc_array_length(*out) - 1;
                break;
        }
index 63440b6f638b700ef6e20185e263f349cbaa8184..6a02017477e8f1f43433016440efa839244b7782 100644 (file)
@@ -74,7 +74,7 @@ int cache_serialize(TALLOC_CTX *ctx, char **out, rlm_cache_entry_t const *c)
                        goto error;
                }
 
-               value = fr_value_box_asprint(value_pool, &tmpl_value(map->rhs), '\'');
+               value = fr_value_box_asprint(value_pool, tmpl_value(map->rhs), '\'');
                if (!value) goto error;
 
                to_store = talloc_asprintf_append_buffer(to_store, "%s %s %s\n", attr,
@@ -151,12 +151,12 @@ int cache_deserialize(rlm_cache_entry_t *c, fr_dict_t const *dict, char *in, ssi
                 */
                if (fr_dict_attr_is_top_level(tmpl_da(map->lhs))) switch (tmpl_da(map->lhs)->attr) {
                case FR_CACHE_CREATED:
-                       c->created = tmpl_value(map->rhs).vb_date;
+                       c->created = tmpl_value(map->rhs)->vb_date;
                        talloc_free(map);
                        goto next;
 
                case FR_CACHE_EXPIRES:
-                       c->expires = tmpl_value(map->rhs).vb_date;
+                       c->expires = tmpl_value(map->rhs)->vb_date;
                        talloc_free(map);
                        goto next;
 
index dc8859f09b64328fa5c3d82ba53e7efececeb6fe..613f1129890ccf9f74521807c637b8752a834ca2 100644 (file)
@@ -368,7 +368,7 @@ static int mod_map_proc_instantiate(CONF_SECTION *cs, UNUSED void *mod_inst, voi
                                cf_log_err(cp, "Right side of map must be a string");
                                return -1;
                        }
-                       p = tmpl_value(map->rhs).vb_strvalue;
+                       p = tmpl_value(map->rhs)->vb_strvalue;
                        slen = fr_jpath_parse(cache, &cache->jpath, p, tmpl_value_length(map->rhs));
                        if (slen <= 0) goto error;
                        break;
index 78d0f117f8f058fae850d0f4c094bba3e2657aaf..4f40b641a73eaa7fd1408f4394aedbd495bde923 100644 (file)
@@ -696,21 +696,21 @@ static ippool_rcode_t redis_ippool_allocate(rlm_redis_ippool_t const *inst, REQU
                                tmp.vb_uint32 = ntohl((uint32_t)reply->element[1]->integer);
                                tmp.type = FR_TYPE_UINT32;
 
-                               if (fr_value_box_cast(NULL, &tmpl_value(ip_map.rhs), FR_TYPE_IPV4_ADDR,
+                               if (fr_value_box_cast(NULL, tmpl_value(ip_map.rhs), FR_TYPE_IPV4_ADDR,
                                                      NULL, &tmp)) {
                                        RPEDEBUG("Failed converting integer to IPv4 address");
                                        ret = IPPOOL_RCODE_FAIL;
                                        goto finish;
                                }
                        } else {
-                               tmpl_value(ip_map.rhs).vb_uint32 = ntohl((uint32_t)reply->element[1]->integer);
+                               tmpl_value(ip_map.rhs)->vb_uint32 = ntohl((uint32_t)reply->element[1]->integer);
                                tmpl_value_type(ip_map.rhs) = FR_TYPE_UINT32;
                        }
                }
                        goto do_ip_map;
 
                case REDIS_REPLY_STRING:
-                       tmpl_value(ip_map.rhs).vb_strvalue = reply->element[1]->str;
+                       tmpl_value(ip_map.rhs)->vb_strvalue = reply->element[1]->str;
                        tmpl_value_length(ip_map.rhs) = reply->element[1]->len;
                        tmpl_value_type(ip_map.rhs) = FR_TYPE_STRING;
 
@@ -749,7 +749,7 @@ static ippool_rcode_t redis_ippool_allocate(rlm_redis_ippool_t const *inst, REQU
                        tmpl_init(&range_rhs, TMPL_TYPE_DATA, "", 0, T_DOUBLE_QUOTED_STRING);
                        tmpl_value_type_set(&range_rhs, FR_TYPE_STRING);
 
-                       tmpl_value(range_map.rhs).vb_strvalue = reply->element[2]->str;
+                       tmpl_value(range_map.rhs)->vb_strvalue = reply->element[2]->str;
                        tmpl_value_length(range_map.rhs) = reply->element[2]->len;
                        tmpl_value_type(range_map.rhs) = FR_TYPE_STRING;
                        if (map_to_request(request, &range_map, map_to_vp, NULL) < 0) {
@@ -791,7 +791,7 @@ static ippool_rcode_t redis_ippool_allocate(rlm_redis_ippool_t const *inst, REQU
                        goto finish;
                }
 
-               tmpl_value(expiry_map.rhs).vb_uint32 = reply->element[3]->integer;
+               tmpl_value(expiry_map.rhs)->vb_uint32 = reply->element[3]->integer;
                tmpl_value_type(expiry_map.rhs) = FR_TYPE_UINT32;
                if (map_to_request(request, &expiry_map, map_to_vp, NULL) < 0) {
                        ret = IPPOOL_RCODE_FAIL;
@@ -900,7 +900,7 @@ static ippool_rcode_t redis_ippool_update(rlm_redis_ippool_t const *inst, REQUES
                 *      Add range ID to request
                 */
                case REDIS_REPLY_STRING:
-                       tmpl_value(range_map.rhs).vb_strvalue = reply->element[1]->str;
+                       tmpl_value(range_map.rhs)->vb_strvalue = reply->element[1]->str;
                        tmpl_value_length(range_map.rhs) = reply->element[1]->len;
                        tmpl_value_type(range_map.rhs) = FR_TYPE_STRING;
                        if (map_to_request(request, &range_map, map_to_vp, NULL) < 0) {
@@ -935,7 +935,7 @@ static ippool_rcode_t redis_ippool_update(rlm_redis_ippool_t const *inst, REQUES
                tmpl_init(&expiry_rhs, TMPL_TYPE_DATA, "", 0, T_DOUBLE_QUOTED_STRING);
                tmpl_value_type_set(&expiry_rhs, FR_TYPE_STRING);
 
-               tmpl_value(expiry_map.rhs).vb_uint32 = expires;
+               tmpl_value(expiry_map.rhs)->vb_uint32 = expires;
                tmpl_value_type(expiry_map.rhs) = FR_TYPE_UINT32;
                if (map_to_request(request, &expiry_map, map_to_vp, NULL) < 0) {
                        ret = IPPOOL_RCODE_FAIL;
@@ -1193,7 +1193,7 @@ static rlm_rcode_t mod_action(rlm_redis_ippool_t const *inst, REQUEST *request,
                                };
 
                                tmpl_value_length(&ip_rhs) = strlen(ip_str);
-                               tmpl_value(&ip_rhs).vb_strvalue = ip_str;
+                               tmpl_value(&ip_rhs)->vb_strvalue = ip_str;
                                tmpl_value_type(&ip_rhs) = FR_TYPE_STRING;
 
                                if (map_to_request(request, &ip_map, map_to_vp, NULL) < 0) return RLM_MODULE_FAIL;