]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
If redis returns an array keep the values separate
authorNick Porter <nick@portercomputing.co.uk>
Thu, 27 Mar 2025 16:59:01 +0000 (16:59 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Thu, 27 Mar 2025 16:59:54 +0000 (16:59 +0000)
If the xlat just returns a FR_TYPE_GROUP, then the values get smushed
together before being assigned to the LHS of an assignment.

src/modules/rlm_redis/rlm_redis.c

index a393f98a94b4a32ca24ecc1c59adc2e0c5b668df..726cf59fa00f093a4727b34b9145ab9ebd8e3e3c 100644 (file)
@@ -552,7 +552,14 @@ static xlat_action_t redis_lua_func_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out,
                action = XLAT_ACTION_FAIL;
                goto finish;
        }
-       fr_dcursor_append(out, vb_out);
+
+       if (vb_out->type == FR_TYPE_GROUP) {
+               fr_value_box_t  *child_vb = NULL;
+               while ((child_vb = fr_value_box_list_pop_head(&vb_out->vb_group))) fr_dcursor_append(out, child_vb);
+               talloc_free(vb_out);
+       } else {
+               fr_dcursor_append(out, vb_out);
+       }
 
 finish:
        fr_redis_reply_free(&reply);
@@ -767,7 +774,14 @@ reply_parse:
                action = XLAT_ACTION_FAIL;
                goto finish;
        }
-       fr_dcursor_append(out, vb_out);
+
+       if (vb_out->type == FR_TYPE_GROUP) {
+               fr_value_box_t  *child_vb = NULL;
+               while ((child_vb = fr_value_box_list_pop_head(&vb_out->vb_group))) fr_dcursor_append(out, child_vb);
+               talloc_free(vb_out);
+       } else {
+               fr_dcursor_append(out, vb_out);
+       }
 
 finish:
        fr_redis_reply_free(&reply);