summaryrefslogtreecommitdiffstats
path: root/crypto/conf/conf_lib.c
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2020-09-30 13:50:34 +0200
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>2020-10-08 16:57:34 +0200
commit55c61473b52aff9fd5217aec543b3d25beea0531 (patch)
treef13404802a058fa10cfe9b2d486149bca9ad0fc4 /crypto/conf/conf_lib.c
parent02a2567173a451d8d00c276e6d8c1d1cb171234d (diff)
Correct and simplify use of ERR_clear_error() etc. for loading DSO libs
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13045)
Diffstat (limited to 'crypto/conf/conf_lib.c')
-rw-r--r--crypto/conf/conf_lib.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c
index 4cc698400c..54ba692462 100644
--- a/crypto/conf/conf_lib.c
+++ b/crypto/conf/conf_lib.c
@@ -101,6 +101,7 @@ STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
return NULL;
} else {
CONF ctmp;
+
CONF_set_nconf(&ctmp, conf);
return NCONF_get_section(&ctmp, section);
}
@@ -113,6 +114,7 @@ char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
return NCONF_get_string(NULL, group, name);
} else {
CONF ctmp;
+
CONF_set_nconf(&ctmp, conf);
return NCONF_get_string(&ctmp, group, name);
}
@@ -129,6 +131,7 @@ long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
status = NCONF_get_number_e(NULL, group, name, &result);
} else {
CONF ctmp;
+
CONF_set_nconf(&ctmp, conf);
status = NCONF_get_number_e(&ctmp, group, name, &result);
}
@@ -162,6 +165,7 @@ int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out)
int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out)
{
CONF ctmp;
+
CONF_set_nconf(&ctmp, conf);
return NCONF_dump_bio(&ctmp, out);
}
@@ -329,6 +333,18 @@ int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
return 1;
}
+long _CONF_get_number(const CONF *conf, const char *section,
+ const char *name)
+{
+ int status;
+ long result = 0;
+
+ ERR_set_mark();
+ status = NCONF_get_number_e(conf, section, name, &result);
+ ERR_pop_to_mark();
+ return status == 0 ? 0L : result;
+}
+
#ifndef OPENSSL_NO_STDIO
int NCONF_dump_fp(const CONF *conf, FILE *out)
{