Don't ignore config_name parameter passed to OPENSSL_config(). Use
[openssl.git] / crypto / conf / conf_mod.c
index 46af48280f6fd767bcbe56b9037fe241cb73e721..e40cc50dd67e8ead61832f834b6fc7d4491659a7 100644 (file)
@@ -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)
                {
@@ -231,7 +232,7 @@ static int module_run(const CONF *cnf, char *name, char *value,
                if (!(flags & CONF_MFLAGS_SILENT))
                        {
                        char rcode[DECIMAL_SIZE(ret)+1];
-                       CONFerr(CONF_F_CONF_MODULE_RUN, CONF_R_MODULE_INITIALIZATION_ERROR);
+                       CONFerr(CONF_F_MODULE_RUN, CONF_R_MODULE_INITIALIZATION_ERROR);
                        BIO_snprintf(rcode, sizeof rcode, "%-8d", ret);
                        ERR_add_error_data(6, "module=", name, ", value=", value, ", retcode=", rcode);
                        }
@@ -581,8 +582,14 @@ int CONF_parse_list(const char *list_, int sep, int nospc,
        {
        int ret;
        const char *lstart, *tmpend, *p;
-       lstart = list_;
 
+       if(list_ == NULL)
+               {
+               CONFerr(CONF_F_CONF_PARSE_LIST, CONF_R_LIST_CANNOT_BE_NULL);
+               return 0;
+               }
+
+       lstart = list_;
        for(;;)
                {
                if (nospc)