X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=openssl.c;h=d27f91878d3f47dfcd2310a2367c090a528cedfb;hp=e6973103ed057c4208d469564eb15f50941df5ea;hb=a473a2a85dbf5325b270a906e85785ba4b032503;hpb=691c4f59e98481dd056abbab8b86d5a4294481a5 diff --git a/openssl.c b/openssl.c index e6973103..d27f9187 100644 --- a/openssl.c +++ b/openssl.c @@ -1764,6 +1764,15 @@ static int generate_host_certificate(struct client_state *csp) 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? */ @@ -1802,25 +1811,6 @@ static int generate_host_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 */