summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-05-27 11:00:35 +0200
committerPauli <pauli@openssl.org>2021-06-02 12:40:02 +1000
commitb3c2ed7043233bd738957a7fcdf9e0734bfea937 (patch)
tree6ac0121007843e1bea0b0bf3fed25e8415221689 /test
parent6b750b89ee9ad3952b1b25e47b848abc8b60e7dd (diff)
downloadopenssl-new-b3c2ed7043233bd738957a7fcdf9e0734bfea937.tar.gz
Add NCONF_get_section_names()
And a few additional fixups to make the no-deprecated configuration to build. Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15466)
Diffstat (limited to 'test')
-rw-r--r--test/confdump.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/test/confdump.c b/test/confdump.c
index ba760f04a8..47d0de6f9a 100644
--- a/test/confdump.c
+++ b/test/confdump.c
@@ -14,27 +14,6 @@
#include <openssl/safestack.h>
#include <openssl/err.h>
-static STACK_OF(OPENSSL_CSTRING) *section_names = NULL;
-
-static void collect_section_name(CONF_VALUE *v)
-{
- /* A section is a CONF_VALUE with name == NULL */
- if (v->name == NULL)
- sk_OPENSSL_CSTRING_push(section_names, v->section);
-}
-
-static int section_name_cmp(OPENSSL_CSTRING const *a, OPENSSL_CSTRING const *b)
-{
- return strcmp(*a, *b);
-}
-
-static void collect_all_sections(const CONF *cnf)
-{
- section_names = sk_OPENSSL_CSTRING_new(section_name_cmp);
- lh_CONF_VALUE_doall(cnf->data, collect_section_name);
- sk_OPENSSL_CSTRING_sort(section_names);
-}
-
static void dump_section(const char *name, const CONF *cnf)
{
STACK_OF(CONF_VALUE) *sect = NCONF_get_section(cnf, name);
@@ -53,11 +32,12 @@ int main(int argc, char **argv)
long eline;
CONF *conf = NCONF_new(NCONF_default());
int ret = 1;
+ STACK_OF(OPENSSL_CSTRING) *section_names = NULL;
if (conf != NULL && NCONF_load(conf, argv[1], &eline)) {
int i;
- collect_all_sections(conf);
+ section_names = NCONF_get_section_names(conf);
for (i = 0; i < sk_OPENSSL_CSTRING_num(section_names); i++) {
dump_section(sk_OPENSSL_CSTRING_value(section_names, i), conf);
}