]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_crypto.c
* compatibility with Berkeley DB < 3.3
[citadel.git] / citadel / serv_crypto.c
index 317457de81b4e928796d4bc3e572acaba020f26c..b082ca0b182f4679d6a5626dfa4b9b5b3de67076 100644 (file)
@@ -1,5 +1,6 @@
 /* $Id$ */
 
+#include <string.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include "sysdep.h"
 SSL_CTX *ssl_ctx;                              /* SSL context */
 pthread_mutex_t **SSLCritters;                 /* Things needing locking */
 
+static unsigned long id_callback(void) {
+       return pthread_self();
+}
 
 void init_ssl(void)
 {
        SSL_METHOD *ssl_method;
        DH *dh;
+
+       if (!access("/var/run/egd-pool", F_OK))
+               RAND_egd("/var/run/egd-pool");
        
        if (!RAND_status()) {
                lprintf(2, "PRNG not adequately seeded, won't do SSL/TLS\n");
@@ -93,7 +100,7 @@ void init_ssl(void)
 #endif
 #endif
        CRYPTO_set_locking_callback(ssl_lock);
-       CRYPTO_set_id_callback(pthread_self);
+       CRYPTO_set_id_callback(id_callback);
 
        /* Load DH parameters into the context */
        dh = DH_new();
@@ -246,7 +253,7 @@ void cmd_stls(char *params)
                                ERR_reason_error_string(ERR_get_error()));
                return;
        }
-       cprintf("%d \n", OK);
+       cprintf("%d \n", CIT_OK);
        retval = SSL_accept(CC->ssl);
        if (retval < 1) {
                /*
@@ -285,7 +292,7 @@ void cmd_gtls(char *params)
                return;
        }
        bits = SSL_CIPHER_get_bits(SSL_get_current_cipher(CC->ssl), &alg_bits);
-       cprintf("%d %s|%s|%d|%d\n", OK,
+       cprintf("%d %s|%s|%d|%d\n", CIT_OK,
                SSL_CIPHER_get_version(SSL_get_current_cipher(CC->ssl)),
                SSL_CIPHER_get_name(SSL_get_current_cipher(CC->ssl)),
                alg_bits, bits);
@@ -300,7 +307,7 @@ void cmd_gtls(char *params)
  */
 void endtls(void)
 {
-       lprintf(7, "Ending SSL/TLS%s\n");
+       lprintf(7, "Ending SSL/TLS\n");
 
        if (!CC->ssl) {
                CC->redirect_ssl = 0;