1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-10-27 20:36:18 +00:00

Reuse old SSL key if loading a new one failed

This commit is contained in:
michi 2020-02-14 12:44:10 +00:00 committed by Alexander Barton
parent c411643d45
commit e7cb9b1a00
2 changed files with 12 additions and 2 deletions

View File

@ -311,8 +311,18 @@ ConnSSL_InitLibrary( void )
return false;
}
if (!ConnSSL_LoadServerKey_openssl(newctx))
if (!ConnSSL_LoadServerKey_openssl(newctx)) {
/* Failed to read new key but an old ssl context
* already exists -> reuse old context */
if (ssl_ctx) {
SSL_CTX_free(newctx);
Log(LOG_WARNING,
"Re-Initializing of SSL failed, using old keys!");
return true;
}
/* No preexisting old context -> error. */
goto out;
}
if (SSL_CTX_set_cipher_list(newctx, Conf_SSLOptions.CipherList) == 0) {
Log(LOG_ERR, "Failed to apply OpenSSL cipher list \"%s\"!",

View File

@ -132,7 +132,7 @@ Rehash(void)
if (!ConnSSL_InitLibrary())
Log(LOG_WARNING,
"Re-Initializing of SSL failed, using old keys!");
"Re-Initializing of SSL failed!");
/* Start listening on sockets */
Conn_InitListeners( );