summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlteo <>2014-04-18 18:08:36 +0000
committerlteo <>2014-04-18 18:08:36 +0000
commit1b2cddf6963bfb4ec771103f4208d23d80db7e5e (patch)
tree97dbdc4c06bb4c00b2ab1b83a9414ec6a3388a3d /src
parenta7f3dcb706493d11b733db28ed4a9f4ba0365dc9 (diff)
downloadopenbsd-1b2cddf6963bfb4ec771103f4208d23d80db7e5e.tar.gz
openbsd-1b2cddf6963bfb4ec771103f4208d23d80db7e5e.tar.bz2
openbsd-1b2cddf6963bfb4ec771103f4208d23d80db7e5e.zip
Use the cleaned up asprintf-based make_config_name() to make the name of
the config file instead of the malloc/BUF_strlcpy/BUF_strlcat calls with no return value checks (that make_config_name() also used to do prior to being cleaned up). ok beck@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/src/apps/ca.c13
-rw-r--r--src/lib/libssl/src/apps/srp.c13
2 files changed, 8 insertions, 18 deletions
diff --git a/src/lib/libssl/src/apps/ca.c b/src/lib/libssl/src/apps/ca.c
index f7b73189de..1d75018732 100644
--- a/src/lib/libssl/src/apps/ca.c
+++ b/src/lib/libssl/src/apps/ca.c
@@ -91,7 +91,6 @@
91 91
92 92
93#define BASE_SECTION "ca" 93#define BASE_SECTION "ca"
94#define CONFIG_FILE "openssl.cnf"
95 94
96#define ENV_DEFAULT_CA "default_ca" 95#define ENV_DEFAULT_CA "default_ca"
97 96
@@ -539,14 +538,10 @@ ca_main(int argc, char **argv)
539 if (configfile == NULL) 538 if (configfile == NULL)
540 configfile = getenv("SSLEAY_CONF"); 539 configfile = getenv("SSLEAY_CONF");
541 if (configfile == NULL) { 540 if (configfile == NULL) {
542 const char *s = X509_get_default_cert_area(); 541 if ((tofree = make_config_name()) == NULL) {
543 size_t len; 542 BIO_printf(bio_err, "error making config file name\n");
544 543 goto err;
545 len = strlen(s) + sizeof(CONFIG_FILE) + 1; 544 }
546 tofree = malloc(len);
547 BUF_strlcpy(tofree, s, len);
548 BUF_strlcat(tofree, "/", len);
549 BUF_strlcat(tofree, CONFIG_FILE, len);
550 configfile = tofree; 545 configfile = tofree;
551 } 546 }
552 BIO_printf(bio_err, "Using configuration from %s\n", configfile); 547 BIO_printf(bio_err, "Using configuration from %s\n", configfile);
diff --git a/src/lib/libssl/src/apps/srp.c b/src/lib/libssl/src/apps/srp.c
index a7bdcef0c9..bdd3017251 100644
--- a/src/lib/libssl/src/apps/srp.c
+++ b/src/lib/libssl/src/apps/srp.c
@@ -72,7 +72,6 @@
72 72
73 73
74#define BASE_SECTION "srp" 74#define BASE_SECTION "srp"
75#define CONFIG_FILE "openssl.cnf"
76 75
77#define ENV_RANDFILE "RANDFILE" 76#define ENV_RANDFILE "RANDFILE"
78 77
@@ -413,14 +412,10 @@ srp_main(int argc, char **argv)
413 if (configfile == NULL) 412 if (configfile == NULL)
414 configfile = getenv("SSLEAY_CONF"); 413 configfile = getenv("SSLEAY_CONF");
415 if (configfile == NULL) { 414 if (configfile == NULL) {
416 const char *s = X509_get_default_cert_area(); 415 if ((tofree = make_config_name()) == NULL) {
417 size_t len; 416 BIO_printf(bio_err, "error making config file name\n");
418 417 goto err;
419 len = strlen(s) + sizeof(CONFIG_FILE) + 1; 418 }
420 tofree = malloc(len);
421 BUF_strlcpy(tofree, s, len);
422 BUF_strlcat(tofree, "/", len);
423 BUF_strlcat(tofree, CONFIG_FILE, len);
424 configfile = tofree; 419 configfile = tofree;
425 } 420 }
426 VERBOSE BIO_printf(bio_err, "Using configuration from %s\n", configfile); 421 VERBOSE BIO_printf(bio_err, "Using configuration from %s\n", configfile);