*/
if (!PEM_write_bio_X509(bio, crt))
{
- log_ssl_errors(LOG_LEVEL_ERROR, "PEM_write_X509() failed");
+ log_ssl_errors(LOG_LEVEL_ERROR, "PEM_write_bio_X509() failed");
ret = -1;
goto exit;
}
len = BIO_get_mem_data(bio, &bio_mem_data);
if (len <= 0)
{
- log_error(LOG_LEVEL_ERROR, "BIO_get_mem_data() returned %d "
+ log_error(LOG_LEVEL_ERROR, "BIO_get_mem_data() returned %ld "
"while gathering certificate information", len);
ret = -1;
goto exit;
* Parameters :
* 1 : csp = Current client state (buffers, headers, etc...)
*
- * Returns : 1 => Error while creating hash
+ * Returns : -1 => Error while creating hash
* 0 => Hash created successfully
*
*********************************************************************/
return -1;
}
+ if (enforce_sane_certificate_state(cert_opt.output_file,
+ cert_opt.subject_key))
+ {
+ freez(cert_opt.output_file);
+ freez(cert_opt.subject_key);
+
+ return -1;
+ }
+
if (file_exists(cert_opt.output_file) == 1)
{
/* The file exists, but is it valid? */
}
}
- if (file_exists(cert_opt.output_file) == 0 &&
- file_exists(cert_opt.subject_key) == 1)
- {
- log_error(LOG_LEVEL_ERROR,
- "A website key already exists but there's no matching certificate. "
- "Removing %s before creating a new key and certificate.",
- cert_opt.subject_key);
- if (unlink(cert_opt.subject_key))
- {
- log_error(LOG_LEVEL_ERROR, "Failed to unlink %s: %E",
- cert_opt.subject_key);
-
- freez(cert_opt.output_file);
- freez(cert_opt.subject_key);
-
- return -1;
- }
- }
-
/*
* Create key for requested host
*/
}
+#ifdef FEATURE_GRACEFUL_TERMINATION
/*********************************************************************
*
* Function : ssl_release
{
if (ssl_inited == 1)
{
+#if OPENSSL_VERSION_NUMBER >= 0x1000200fL
+#ifndef LIBRESSL_VERSION_NUMBER
#ifndef OPENSSL_NO_COMP
SSL_COMP_free_compression_methods();
+#endif
+#endif
#endif
CONF_modules_free();
CONF_modules_unload(1);
CRYPTO_cleanup_all_ex_data();
}
}
-
+#endif /* def FEATURE_GRACEFUL_TERMINATION */