Only generate CSR if it is determined that we will
[citadel.git] / citadel / modules / crypto / serv_crypto.c
index a9dd5934bc58e357ad62878c3edc20b263462d53..820153126fceef45b3d7170b58e28f6631ff95f6 100644 (file)
@@ -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");
 
                /*