diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index 0682149f..24e89d05 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -1763,7 +1763,7 @@ int parse_config(const char *opt, const char *optarg, return 0; case SHRPX_OPTID_DH_PARAM_FILE: - mod_config()->tls.dh_param_file = strcopy(optarg); + mod_config()->tls.dh_param_file = optarg; return 0; case SHRPX_OPTID_SUBCERT: { diff --git a/src/shrpx_config.h b/src/shrpx_config.h index 3f5a8565..dbe8c9a5 100644 --- a/src/shrpx_config.h +++ b/src/shrpx_config.h @@ -429,7 +429,7 @@ struct TLSConfig { ImmutableString private_key_file; ImmutableString private_key_passwd; ImmutableString cert_file; - std::unique_ptr dh_param_file; + ImmutableString dh_param_file; std::unique_ptr ciphers; ImmutableString cacert; bool insecure; diff --git a/src/shrpx_ssl.cc b/src/shrpx_ssl.cc index f5d2b594..a7e00086 100644 --- a/src/shrpx_ssl.cc +++ b/src/shrpx_ssl.cc @@ -527,9 +527,9 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file #endif // OPENSSL_NO_EC - if (tlsconf.dh_param_file) { + if (!tlsconf.dh_param_file.empty()) { // Read DH parameters from file - auto bio = BIO_new_file(tlsconf.dh_param_file.get(), "r"); + auto bio = BIO_new_file(tlsconf.dh_param_file.c_str(), "r"); if (bio == nullptr) { LOG(FATAL) << "BIO_new_file() failed: " << ERR_error_string(ERR_get_error(), nullptr);