]> code.citadel.org Git - citadel.git/blobdiff - webcit/crypto.c
Remove the intermediate buffer in serv_puts()
[citadel.git] / webcit / crypto.c
index 77ba8947c210847b98fe290cfa51835a99cfb323..c3d80e3ab6707cbaf1eab7f7c411f56775425820 100644 (file)
@@ -63,7 +63,7 @@ void init_ssl(void)
        if (!SSLCritters) {
                lprintf(1, "citserver: can't allocate memory!!\n");
                /* Nothing's been initialized, just die */
-               exit(1);
+               exit(WC_EXIT_SSL);
        } else {
                int a;
 
@@ -73,7 +73,7 @@ void init_ssl(void)
                                lprintf(1,
                                        "citserver: can't allocate memory!!\n");
                                /** Nothing's been initialized, just die */
-                               exit(1);
+                               exit(WC_EXIT_SSL);
                        }
                        pthread_mutex_init(SSLCritters[a], NULL);
                }
@@ -197,13 +197,13 @@ void init_ssl(void)
                                        */
 
                                        X509_NAME_add_entry_by_txt(name, "O",
-                                               MBSTRING_ASC, "FIXME.FIXME.org", -1, -1, 0);
+                                               MBSTRING_ASC, "Organization name", -1, -1, 0);
 
                                        X509_NAME_add_entry_by_txt(name, "OU",
                                                MBSTRING_ASC, "Citadel server", -1, -1, 0);
 
                                        X509_NAME_add_entry_by_txt(name, "CN",
-                                               MBSTRING_ASC, "FIXME.FIXME.org", -1, -1, 0);
+                                               MBSTRING_ASC, "*", -1, -1, 0);
                                
                                        X509_REQ_set_subject_name(req, name);
 
@@ -356,9 +356,7 @@ int starttls(int sock) {
                return(4);
        }
        BIO_set_close(newssl->rbio, BIO_NOCLOSE);
-       bits =
-           SSL_CIPHER_get_bits(SSL_get_current_cipher(newssl),
-                               &alg_bits);
+       bits = SSL_CIPHER_get_bits(SSL_get_current_cipher(newssl), &alg_bits);
        lprintf(5, "SSL/TLS using %s on %s (%d of %d bits)\n",
                SSL_CIPHER_get_name(SSL_get_current_cipher(newssl)),
                SSL_CIPHER_get_version(SSL_get_current_cipher(newssl)),
@@ -385,9 +383,15 @@ void endtls(void)
        lprintf(5, "Ending SSL/TLS\n");
        SSL_shutdown(THREADSSL);
        ctx = SSL_get_SSL_CTX(THREADSSL);
-       if (ctx != NULL) {
-               SSL_CTX_free(ctx);
-       }
+
+       /** I don't think this is needed, and it crashes the server anyway
+        *
+        *      if (ctx != NULL) {
+        *              lprintf(9, "Freeing CTX at %x\n", (int)ctx );
+        *              SSL_CTX_free(ctx);
+        *      }
+        */
+
        SSL_free(THREADSSL);
        pthread_setspecific(ThreadSSL, NULL);
 }