diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2002-02-21 00:54:54 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2002-02-21 00:54:54 +0000 |
commit | 92f91ff48b320a81964d7347444683a734c53734 (patch) | |
tree | fec965550bcfdaf5347ede77755f3e1c7c6da04f /crypto/conf/conf_mod.c | |
parent | b3dfaaa143d06eb23ec0985ba37bd9ab24bee6bb (diff) |
Config file updates from stable branch
Diffstat (limited to 'crypto/conf/conf_mod.c')
-rw-r--r-- | crypto/conf/conf_mod.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c index 23e1f191da..7e88cfb625 100644 --- a/crypto/conf/conf_mod.c +++ b/crypto/conf/conf_mod.c @@ -163,18 +163,40 @@ int CONF_modules_load(const CONF *cnf, const char *appname, int CONF_modules_load_file(const char *filename, const char *appname, unsigned long flags) { + char *file; CONF *conf = NULL; int ret = 0; conf = NCONF_new(NULL); if (!conf) goto err; - if (NCONF_load(conf, filename, NULL) <= 0) + if (filename == NULL) + { + file = CONF_get1_default_config_file(); + if (!file) + goto err; + } + else + file = (char *)filename; + if (appname == NULL) + appname = "openssl_conf"; + + if (NCONF_load(conf, file, NULL) <= 0) + { + if ((flags & CONF_MFLAGS_IGNORE_MISSING_FILE) && + (ERR_GET_REASON(ERR_peek_last_error()) == CONF_R_NO_SUCH_FILE)) + { + ERR_clear_error(); + ret = 1; + } goto err; + } ret = CONF_modules_load(conf, appname, flags); err: + if (filename == NULL) + OPENSSL_free(file); NCONF_free(conf); return ret; @@ -189,7 +211,7 @@ static int module_run(const CONF *cnf, char *name, char *value, md = module_find(name); /* Module not found: try to load DSO */ - if (!md) + if (!md && !(flags & CONF_MFLAGS_NO_DSO)) md = module_load_dso(cnf, name, value, flags); if (!md) @@ -248,11 +270,6 @@ static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value, goto err; } ffunc = (conf_finish_func *)DSO_bind_func(dso, DSO_mod_finish_name); - if (!ffunc) - { - errcode = CONF_R_MISSING_FINISH_FUNCTION; - goto err; - } /* All OK, add module */ md = module_add(dso, name, ifunc, ffunc); @@ -450,7 +467,8 @@ void CONF_modules_finish(void) static void module_finish(CONF_IMODULE *imod) { - imod->pmod->finish(imod); + if (imod->pmod->finish) + imod->pmod->finish(imod); imod->pmod->links--; OPENSSL_free(imod->name); OPENSSL_free(imod->value); |