*/
fr_pair_t *fr_pair_afrom_da_depth_nested(TALLOC_CTX *ctx, fr_pair_list_t *list, fr_dict_attr_t const *da, int start)
{
- fr_pair_t *vp;
+ fr_pair_t *vp, *key_vp = NULL;
unsigned int i;
TALLOC_CTX *cur_ctx;
fr_dict_attr_t const *find; /* DA currently being looked for */
for (i = start; i <= da->depth; i++) {
find = da_stack.da[i];
+ if (key_vp) {
+ fr_assert(find->type == FR_TYPE_STRUCT);
+ key_vp->vp_uint32 = find->attr;
+ key_vp = NULL;
+ }
+
vp = fr_pair_find_by_da(cur_list, NULL, find);
if (!vp || (vp->da == da)) {
if (fr_pair_append_by_da(cur_ctx, &vp, cur_list, find) < 0) return NULL;
if (find == da) return vp;
+ /*
+ * Create the key field, but do _not_ put the child struct into it. Instead, the child
+ * struct goes appended into this struct. However, we _do_ automatically set the value
+ * of the key field, depending on the number of the child structure.
+ */
+ if (fr_dict_attr_is_key_field(find)) {
+ key_vp = vp;
+ continue;
+ }
+
fr_assert(fr_type_is_structural(vp->da->type));
cur_ctx = vp;
# Tests which can use new conditions, but which can't use tmpl_tokenize_all_nested=yes
KEYWORD_UPDATE_TMPL_TESTS := foreach-regex xlat-dhcpv4
+# Tests which can't use pair_legacy_nested=yes
+KEYWORD_PAIR_LEGACY_TESTS := map-xlat-struct
+
#
# Migration support. Some of the tests don't run under the new
# conditions, so we don't run them under the new conditions.
else ifneq "$(findstring ${1}, $(KEYWORD_UPDATE_TMPL_TESTS))" ""
$(OUTPUT)/${1}: NEW_COND=-S use_new_conditions=yes -S forbid_update=yes
-else
+else ifneq "$(findstring ${1}, $(KEYWORD_PAIR_LEGACY_TESTS))" ""
$(OUTPUT)/${1}: NEW_COND=-S use_new_conditions=yes -S forbid_update=yes -S tmpl_tokenize_all_nested=yes
+else
+$(OUTPUT)/${1}: NEW_COND=-S use_new_conditions=yes -S forbid_update=yes -S tmpl_tokenize_all_nested=yes -S pair_legacy_nested=true
ifeq "${1}" "mschap"
$(OUTPUT)/${1}: $(BUILD_DIR)/lib/rlm_mschap.la