From: Art Cancro Date: Tue, 23 Oct 2007 15:55:44 +0000 (+0000) Subject: Only generate CSR if it is determined that we will X-Git-Tag: v7.86~2927 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=a14993160a97c3092d3bd6d015b06021a8ed6171 Only generate CSR if it is determined that we will need it in the next step to generate a self-signed certificate. --- diff --git a/citadel/modules/crypto/serv_crypto.c b/citadel/modules/crypto/serv_crypto.c index a9dd5934b..820153126 100644 --- a/citadel/modules/crypto/serv_crypto.c +++ b/citadel/modules/crypto/serv_crypto.c @@ -198,9 +198,11 @@ void init_ssl(void) } /* - * Generate a CSR if we don't have one. + * If there is no certificate file on disk, we will be generating a self-signed certificate + * in the next step. Therefore, if we have neither a CSR nor a certificate, generate + * the CSR in this step so that the next step may commence. */ - if (access(file_crpt_file_csr, R_OK) != 0) { + if ( (access(file_crpt_file_cer, R_OK) != 0) && (access(file_crpt_file_csr, R_OK) != 0) ) { lprintf(CTDL_INFO, "Generating a certificate signing request.\n"); /* diff --git a/webcit/crypto.c b/webcit/crypto.c index 1515ff397..76c80d4de 100644 --- a/webcit/crypto.c +++ b/webcit/crypto.c @@ -152,10 +152,12 @@ void init_ssl(void) } } - /** - * Generate a CSR if we don't have one. + /* + * If there is no certificate file on disk, we will be generating a self-signed certificate + * in the next step. Therefore, if we have neither a CSR nor a certificate, generate + * the CSR in this step so that the next step may commence. */ - if (access(CTDL_CSR_PATH, R_OK) != 0) { + if ( (access(CTDL_CER_PATH, R_OK) != 0) && (access(CTDL_CSR_PATH, R_OK) != 0) ) { lprintf(5, "Generating a certificate signing request.\n"); /**