return;
}
+ fr_assert(fr_type_is_structural(vp->vp_type));
+
fr_pair_list_foreach(&vp->vp_group, child) {
pair_mutable(child);
}
if (fr_type_is_leaf(vp->vp_type)) {
if (fr_edit_list_save_pair_value(el, vp) < 0) return -1;
} else {
+ fr_assert(fr_type_is_structural(vp->vp_type));
+
if (fr_edit_list_free_pair_children(el, vp) < 0) return -1;
}
break;
if (fr_type_is_leaf(tmpl_attr_tail_da(current->lhs.vpt)->type)) {
if (apply_edits_to_leaf(request, state, current) < 0) return -1;
} else {
+ fr_assert(fr_type_is_structural(tmpl_attr_tail_da(current->lhs.vpt)->type));
+
if (apply_edits_to_list(request, state, current) < 0) return -1;
}
child->check_lhs = check_lhs_value;
child->expanded_lhs = expanded_lhs_value;
} else {
+ fr_assert(fr_type_is_structural(tmpl_attr_tail_da(current->lhs.vpt)->type));
+
child->ctx = current->lhs.vp ? (TALLOC_CTX *) current->lhs.vp : (TALLOC_CTX *) child;
child->check_lhs = check_lhs_nested;
child->expanded_lhs = expanded_lhs_attribute;
return expand_rhs(request, state, current);
}
+ fr_assert(fr_type_is_structural(tmpl_attr_tail_da(current->lhs.vpt)->type));
+
/*
* We have a parent, so we know that attribute exist. Which means that we don't need to call a
* cursor function to create this VP.
continue;
}
+ fr_assert(fr_type_is_structural(vp->vp_type));
+
if (unlang_foreach_pair_copy(child, vp, vp->da) < 0) return -1;
}
*/
}
} else {
+ fr_assert(fr_type_is_structural(vp->vp_type));
+
/*
* @todo - copy the pairs back?
*/
goto done;
}
+ fr_assert(fr_type_is_structural(da->type));
+
switch (da->type) {
/*
* All of these are essentially the same.
memset(&vp->data, 0xff, sizeof(vp->data));
#endif
+ fr_assert(fr_type_is_structural(da->type));
+
/*
* Make sure that the pad field is initialized.
*/
if ((da->type != vp->vp_type) && (fr_value_box_cast_in_place(vp, &vp->data, da->type, da) < 0)) return -1;
} else {
- fr_assert(fr_type_is_leaf(vp->vp_type) || (fr_pair_list_num_elements(&vp->vp_group) == 0));
+ fr_assert(fr_type_is_leaf(vp->vp_type) || (fr_type_is_structural(vp->vp_type) && (fr_pair_list_num_elements(&vp->vp_group) == 0)));
fr_value_box_init(&vp->data, da->type, da, false);
}
next_sibling:
if (fr_type_is_leaf(vp->vp_type)) return vp;
+ fr_assert(fr_type_is_structural(vp->vp_type));
+
vp = fr_pair_list_iter_leaf(&vp->vp_group, NULL);
if (vp) return vp;
{
if (fr_type_is_leaf(vp->vp_type)) return vp->vp_immutable;
+ fr_assert(fr_type_is_structural(vp->vp_type));
+
fr_pair_list_foreach(&vp->vp_group, child) {
if (fr_type_is_leaf(child->vp_type)) {
if (child->vp_immutable) return true;
continue;
}
+ fr_assert(fr_type_is_structural(vp->vp_type));
+
if (fr_pair_immutable(child)) return true;
}
continue;
}
+ fr_assert(fr_type_is_structural(vp->vp_type));
+
fprintf(fp, "%s = {\n", vp->da->name);
fprintf_pair_list(fp, &vp->vp_group, depth + 1);
fprintf(fp, "%.*s}\n", depth, spaces);
if (fr_type_is_leaf(vp->vp_type)) {
fr_fprintf(fp, "%s %s %pV\n", vp->da->name, fr_tokens[vp->op], &vp->data);
} else {
+ fr_assert(fr_type_is_structural(vp->vp_type));
+
fprintf(fp, "%s = {\n", vp->da->name);
fprintf_pair_list(fp, &vp->vp_group, 1);
fprintf(fp, "}\n");
fr_pair_t *child;
fr_dcursor_t cursor;
+ fr_assert(fr_type_is_structural(vp->vp_type));
+
FR_SBUFF_IN_CHAR_RETURN(&our_out, '{', ' ');
for (child = fr_pair_dcursor_init(&cursor, &vp->vp_group);
child != NULL;
continue;
}
+ fr_assert(fr_type_is_structural(vp->vp_type));
+
if (detail_recurse(out, ht, &vp->vp_group) < 0) return -1;
}
continue;
}
+ fr_assert(fr_type_is_structural(vp->vp_type));
+
if (detail_recurse(out, ht, &vp->vp_group) < 0) goto fail;
}
return 1;
}
+ fr_assert(fr_type_is_structural(pair_data->da->type));
+
/*
* Retrieving a structural attribute returns a new table.
*/
if (fr_type_is_leaf(init_pair->da->type)) {
pair = PyObject_New(py_freeradius_pair_t, (PyTypeObject *)&py_freeradius_value_pair_def);
- } else {
+
+ } else if (fr_type_is_struct(init_pair->da->type)) {
pair = PyObject_New(py_freeradius_pair_t, (PyTypeObject *)&py_freeradius_grouping_pair_def);
+ } else {
+ PyErr_SetString(PyExc_AttributeError, "Unsupported data type");
+ return NULL;
}
if (!pair) {
PyErr_SetString(PyExc_MemoryError, "Failed to allocate PyObject");
if (fr_type_is_leaf(da->type)) {
pair = PyObject_New(py_freeradius_pair_t, (PyTypeObject *)&py_freeradius_value_pair_def);
- } else {
+ } else if (fr_type_is_structural(da->type)) {
pair = PyObject_New(py_freeradius_pair_t, (PyTypeObject *)&py_freeradius_grouping_pair_def);
+ } else {
+ PyErr_SetString(PyExc_AttributeError, "Unsupported data type");
+ return NULL;
}
if (!pair) {
PyErr_SetString(PyExc_MemoryError, "Failed to allocate PyObject");