From d318fb79d291b491b07ee073a0d352f14729786c Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Mon, 9 Apr 2007 11:45:54 +0000 Subject: [PATCH] Don't ignore config_name parameter passed to OPENSSL_config(). Use "openssl_conf" in config file if config_name variable is missing. --- crypto/conf/conf.h | 1 + crypto/conf/conf_mod.c | 9 +++++---- crypto/conf/conf_sap.c | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/crypto/conf/conf.h b/crypto/conf/conf.h index 9909374e84..a8ac256e52 100644 --- a/crypto/conf/conf.h +++ b/crypto/conf/conf.h @@ -115,6 +115,7 @@ typedef void conf_finish_func(CONF_IMODULE *md); #define CONF_MFLAGS_SILENT 0x4 #define CONF_MFLAGS_NO_DSO 0x8 #define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 +#define CONF_MFLAGS_DEFAULT_SECTION 0x20 int CONF_set_default_method(CONF_METHOD *meth); void CONF_set_nconf(CONF *conf,LHASH *hash); diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c index 7c9b42f767..e40cc50dd6 100644 --- a/crypto/conf/conf_mod.c +++ b/crypto/conf/conf_mod.c @@ -126,17 +126,18 @@ int CONF_modules_load(const CONF *cnf, const char *appname, { STACK_OF(CONF_VALUE) *values; CONF_VALUE *vl; - char *vsection; + char *vsection = NULL; int ret, i; if (!cnf) return 1; - if (appname == NULL) - appname = "openssl_conf"; + if (appname) + vsection = NCONF_get_string(cnf, NULL, appname); - vsection = NCONF_get_string(cnf, NULL, appname); + if (!appname || (!vsection && (flags & CONF_MFLAGS_DEFAULT_SECTION))) + vsection = NCONF_get_string(cnf, NULL, "openssl_conf"); if (!vsection) { diff --git a/crypto/conf/conf_sap.c b/crypto/conf/conf_sap.c index e15c2e5546..9c53bac1a8 100644 --- a/crypto/conf/conf_sap.c +++ b/crypto/conf/conf_sap.c @@ -88,8 +88,8 @@ void OPENSSL_config(const char *config_name) ERR_clear_error(); - if (CONF_modules_load_file(NULL, NULL, - CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) + if (CONF_modules_load_file(NULL, config_name, + CONF_MFLAGS_DEFAULT_SECTION|CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) { BIO *bio_err; ERR_load_crypto_strings();