Don't load same config file twice.
[openssl.git] / apps / srp.c
index 1c9a9bee43e86fa8a4452c4f74c82e3b5dc5822f..14f837f3605cdd58061c11576c0d6007ba65d279 100644 (file)
  * Hudson (tjh@cryptsoft.com).
  *
  */
+
 #include <openssl/opensslconf.h>
+#ifdef OPENSSL_NO_SRP
+NON_EMPTY_TRANSLATION_UNIT
+#else
 
-#ifndef OPENSSL_NO_SRP
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <openssl/conf.h>
-#include <openssl/bio.h>
-#include <openssl/err.h>
-#include <openssl/txt_db.h>
-#include <openssl/buffer.h>
-#include <openssl/srp.h>
-#include "apps.h"
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+# include <openssl/conf.h>
+# include <openssl/bio.h>
+# include <openssl/err.h>
+# include <openssl/txt_db.h>
+# include <openssl/buffer.h>
+# include <openssl/srp.h>
+# include "apps.h"
 
 # define BASE_SECTION    "srp"
 # define CONFIG_FILE "openssl.cnf"
@@ -253,7 +256,6 @@ OPTIONS srp_options[] = {
 int srp_main(int argc, char **argv)
 {
     CA_DB *db = NULL;
-    DB_ATTR db_attr;
     CONF *conf = NULL;
     int gNindex = -1, maxgN = -1, ret = 1, errors = 0, verbose = 0, i;
     int doupdatedb = 0, mode = OPT_ERR;
@@ -357,7 +359,7 @@ int srp_main(int argc, char **argv)
         conf = app_load_config(configfile);
         if (conf == NULL)
             goto end;
-        if (!app_load_modules(conf))
+        if (configfile != default_config_file && !app_load_modules(conf))
             goto end;
 
         /* Lets get the config section we are using */
@@ -365,7 +367,7 @@ int srp_main(int argc, char **argv)
             if (verbose)
                 BIO_printf(bio_err,
                            "trying to read " ENV_DEFAULT_SRP
-                           " in \" BASE_SECTION \"\n");
+                           " in " BASE_SECTION "\n");
 
             section = NCONF_get_string(conf, BASE_SECTION, ENV_DEFAULT_SRP);
             if (section == NULL) {
@@ -398,7 +400,7 @@ int srp_main(int argc, char **argv)
         BIO_printf(bio_err, "Trying to read SRP verifier file \"%s\"\n",
                    srpvfile);
 
-    db = load_index(srpvfile, &db_attr);
+    db = load_index(srpvfile, NULL);
     if (db == NULL)
         goto end;
 
@@ -650,14 +652,6 @@ int srp_main(int argc, char **argv)
         app_RAND_write_file(randfile);
     NCONF_free(conf);
     free_index(db);
-    OBJ_cleanup();
     return (ret);
 }
-
-#else
-
-# if PEDANTIC
-static void *dummy = &dummy;
-# endif
-
 #endif