X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=ssl.c;h=13203de96e7440c441b6a049868214b210ef1228;hp=46b8fd4bb44030e6634ed40dd3715ed4c976c62e;hb=93fa546bb8a67cd3ea7c092fdc42368706f61fa0;hpb=0fc07e07a74872fb3347dc762372ba7c843d5a52 diff --git a/ssl.c b/ssl.c index 46b8fd4b..13203de9 100644 --- a/ssl.c +++ b/ssl.c @@ -1348,6 +1348,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 */