-LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline)
- {
- CONF ctmp;
- int ret;
-
- if (default_CONF_method == NULL)
- default_CONF_method = NCONF_default();
-
- default_CONF_method->init(&ctmp);
- ctmp.data = conf;
- ret = NCONF_load_bio(&ctmp, bp, eline);
- if (ret)
- return ctmp.data;
- return NULL;
- }
-
-STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section)
- {
- if (conf == NULL)
- {
- return NULL;
- }
- else
- {
- CONF ctmp;
-
- if (default_CONF_method == NULL)
- default_CONF_method = NCONF_default();
-
- default_CONF_method->init(&ctmp);
- ctmp.data = conf;
- return NCONF_get_section(&ctmp, section);
- }
- }
-
-char *CONF_get_string(LHASH *conf,char *group,char *name)
- {
- if (conf == NULL)
- {
- return NCONF_get_string(NULL, group, name);
- }
- else
- {
- CONF ctmp;
-
- if (default_CONF_method == NULL)
- default_CONF_method = NCONF_default();
-
- default_CONF_method->init(&ctmp);
- ctmp.data = conf;
- return NCONF_get_string(&ctmp, group, name);
- }
- }
-
-long CONF_get_number(LHASH *conf,char *group,char *name)
- {
- int status;
- long result = 0;
-
- if (conf == NULL)
- {
- status = NCONF_get_number_e(NULL, group, name, &result);
- }
- else
- {
- CONF ctmp;
-
- if (default_CONF_method == NULL)
- default_CONF_method = NCONF_default();
-
- default_CONF_method->init(&ctmp);
- ctmp.data = conf;
- status = NCONF_get_number_e(&ctmp, group, name, &result);
- }
-
- if (status == 0)
- {
- /* This function does not believe in errors... */
- ERR_get_error();
- }
- return result;
- }
-
-void CONF_free(LHASH *conf)
- {
- CONF ctmp;
-
- if (default_CONF_method == NULL)
- default_CONF_method = NCONF_default();
-
- default_CONF_method->init(&ctmp);
- ctmp.data = conf;
- NCONF_free_data(&ctmp);
- }
-
-#ifndef NO_FP_API
-int CONF_dump_fp(LHASH *conf, FILE *out)
- {
- BIO *btmp;
- int ret;
-
- if(!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) {
- CONFerr(CONF_F_CONF_DUMP_FP,ERR_R_BUF_LIB);
- return 0;
- }
- ret = CONF_dump_bio(conf, btmp);
- BIO_free(btmp);
- return ret;
- }
+LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,
+ long *eline)
+{
+ CONF ctmp;
+ int ret;
+
+ CONF_set_nconf(&ctmp, conf);
+
+ ret = NCONF_load_bio(&ctmp, bp, eline);
+ if (ret)
+ return ctmp.data;
+ return NULL;
+}
+
+STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
+ const char *section)
+{
+ if (conf == NULL) {
+ return NULL;
+ } else {
+ CONF ctmp;
+ CONF_set_nconf(&ctmp, conf);
+ return NCONF_get_section(&ctmp, section);
+ }
+}
+
+char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
+ const char *name)
+{
+ if (conf == NULL) {
+ return NCONF_get_string(NULL, group, name);
+ } else {
+ CONF ctmp;
+ CONF_set_nconf(&ctmp, conf);
+ return NCONF_get_string(&ctmp, group, name);
+ }
+}
+
+long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
+ const char *name)
+{
+ int status;
+ long result = 0;
+
+ if (conf == NULL) {
+ 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);
+ }
+
+ if (status == 0) {
+ /* This function does not believe in errors... */
+ ERR_clear_error();
+ }
+ return result;
+}
+
+void CONF_free(LHASH_OF(CONF_VALUE) *conf)
+{
+ CONF ctmp;
+ CONF_set_nconf(&ctmp, conf);
+ NCONF_free_data(&ctmp);
+}
+
+#ifndef OPENSSL_NO_STDIO
+int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out)
+{
+ BIO *btmp;
+ int ret;
+
+ if ((btmp = BIO_new_fp(out, BIO_NOCLOSE)) == NULL) {
+ CONFerr(CONF_F_CONF_DUMP_FP, ERR_R_BUF_LIB);
+ return 0;
+ }
+ ret = CONF_dump_bio(conf, btmp);
+ BIO_free(btmp);
+ return ret;
+}