James Jones [Thu, 25 Feb 2021 20:53:06 +0000 (14:53 -0600)]
Correct parenthesization for rbtree_iter_done() macro (#3958)
There's also now a test in rbtree_tests.c confirming that
rbtree_iter_done(), which one must invoke when exiting
an iterator early, does unlock the tree if it has a lock.
Alan T. DeKok [Tue, 23 Feb 2021 17:03:15 +0000 (12:03 -0500)]
add assertions to shut up scan
for some incredibly frustrating reason, scan and -W errors are
substantially different on CI and on local builds, even for
the same rev of the same compiler.
James Jones [Fri, 19 Feb 2021 19:28:25 +0000 (13:28 -0600)]
Add rbtree_iter_delete() and corresponding test. (#3949)
rbtree_iter_delete() deletes the current node in an iterator
and remembers the next one; rbtree_iter_next_inorder() notices
when that's happened and uses the saved node, otherwise it
behaves as usual.
Alan T. DeKok [Fri, 19 Feb 2021 14:12:53 +0000 (09:12 -0500)]
add section / pair / data in alloc functions, not elsewhere
on review, most of the calls to cf_section_add() were wrong.
the child section was already added to the parent section by
_cf_section_alloc(). There were many, many, calls to
cf_item_add() or cf_section_add() which resulted in the
section being added twice.
However, cf_pair_alloc() and cf_data_alloc() did not add the item
to the parent.
In the interest of less code and fewer errors, we've removed
cf_section_add() and cf_pair_add(). The calls to cf_item_add()
are now done only from the alloc functions.
We still have many calls to cf_data_add(), because that function
is in fact allocating *and* adding the CONF_DATA items.
James Jones [Fri, 19 Feb 2021 12:32:08 +0000 (06:32 -0600)]
Add pre-order and post-order rbtree iterators. (#3945)
The test we have is based on static test data with the values
appropriate for pre and post iterators determined by hand. We
can generate additional test cases as desired.
Alan T. DeKok [Wed, 17 Feb 2021 17:25:12 +0000 (12:25 -0500)]
disable a number of raw tests until we fix the underlying issue
So that we don't block others who wish to do work.
It seems that commit a6055f25e52 changed various assumptions
throughout the code, which has these side effects. We need to
track down the root cause, and fix the assumptions. Then
re-enable the tests
Alan T. DeKok [Wed, 17 Feb 2021 14:21:22 +0000 (09:21 -0500)]
remove extraneous copy
v3 puts the certificates into FR_EX_TLS_INDEX_CERTS. v4 doesn't.
so there's no need to create the certs in the wrong context,
then copy them to the correct context, then delete the certs.
We can just create them in the correct context.
Move cert_vps variable into the condition in order to highlight
the fact that it's a temporary variable, used only to limit the
list of certificates being printed.
This change doesn't affect the current issues of EAP-TLS not
caching certs in session state, or it leaking the certs. But
this change is not wrong.
Nick Porter [Tue, 16 Feb 2021 18:56:04 +0000 (18:56 +0000)]
Convert lists of map_t to doubly linked lists (#3913)
* Define header of list of map_t
* Add dlist pointers to map_t structure and add macros to simplify calls
fr_map_list_init() - consistent way to initialise a dlist of map_t
fr_map_list_head() - return head of list cast to map_t * - simplifies
code when accessing elements of the head item in the list.
* Set child of map_t to be a list header and initialise list on allocation.
* Alter structures that contain lists of maps to use fr_map_list_t
* Operate directly on list head in gext
* Use fr_dlist_empty() to test for empty lists of maps
* Pass fr_map_list_t * between functions
* Use dlist functions for traversing lists rather than ->next or cursors
* Ensure all new fr_map_list_t are correctly initialised
* New version of map_sort() for fr_map_list_t
* Use dcursors in place of cursors for tracking in fr_map_list_t
* Amend calls to map_afrom_cs to pass fr_map_list_t *
* Use fr_dlist_insert_tail() to add a map_t to fr_map_list_t
* Ensure fr_map_list_t is initialised when allocating vp_list_mod_t
* Correct calls to functions which want a fr_map_list_t *
* Handle references to the first (only?) map in a structure.
* Cannot just point two map items at the start of a list now
* Correct way to remove an item from the start of fr_map_list_t