X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=openssl.c;h=e1655d88884daad716b3b10a9b2bb69a0736dee8;hp=72d97d99b9fbd09748c7b35f637ac94f1c5c1d5b;hb=c884f226dd358b59aa839be92c9adcd461501efc;hpb=bc691efb3976886631d4c6f91f8791fb702c459a diff --git a/openssl.c b/openssl.c index 72d97d99..e1655d88 100644 --- a/openssl.c +++ b/openssl.c @@ -1793,6 +1793,25 @@ static int generate_webpage_certificate(struct client_state *csp) } } + 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 */