Only generate CSR if it is determined that we will
[citadel.git] / webcit / crypto.c
index 1515ff39762e4a195f00d1435947dd4151d00acf..76c80d4de8df5aad59ab963bc62c7e4208655a6c 100644 (file)
@@ -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");
 
                /**