Rearrange config file loading to allow splitting across files
authorJennifer Richards <jennifer@painless-security.com>
Fri, 8 Sep 2017 23:59:27 +0000 (19:59 -0400)
committerJennifer Richards <jennifer@painless-security.com>
Fri, 8 Sep 2017 23:59:27 +0000 (19:59 -0400)
commit7a6dc59919519fc7a7927301da0c079298258c92
tree1212953e27f91cb4804b0da09f0c375cde2b63f6
parentb4ee245fa96d0667751ac55058da9a31b33fd3bc
Rearrange config file loading to allow splitting across files

Prior to this commit, configuration files were loaded one-by-one,
parsing all the sections of each file before moving to the next. This
caused problems unless the files were arranged so that realms were
defined before they were referred to by communities when the files
were read in lexical order. This commit rearranges this so that all
files are first parsed into internal JSON structures, then the first
section of all these structures is parsed, the second section of all
structures is parsed, etc. This eliminates the dependency on file
order that caused the bug.

Also fixed a memory leak: the JSON structures were not being properly
freed after being parsed. These should now be freed.
common/tr_config.c
include/tr_config.h
tr/tr_cfgwatch.c