]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_crypto.c
Moved to new module init structure.
[citadel.git] / citadel / serv_crypto.c
index ab6bd6f4c0a8fe1958c791cfb5174d4f37f16cdf..a9dd5934bc58e357ad62878c3edc20b263462d53 100644 (file)
 #include "server.h"
 #include "serv_crypto.h"
 #include "sysdep_decls.h"
-#include "serv_extensions.h"
 #include "citadel.h"
 #include "config.h"
 
 
+#include "ctdl_module.h"
+/* TODO: should we use the standard module init stuff to start this? */
+/* TODO: should we register an event handler to call destruct_ssl? */
+
 #ifdef HAVE_OPENSSL
 SSL_CTX *ssl_ctx;              /* SSL context */
 pthread_mutex_t **SSLCritters; /* Things needing locking */
@@ -49,6 +52,16 @@ static unsigned long id_callback(void)
        return (unsigned long) pthread_self();
 }
 
+void destruct_ssl(void)
+{
+       int a;
+       CtdlUnregisterProtoHook(cmd_stls, "STLS");
+       CtdlUnregisterProtoHook(cmd_gtls, "GTLS");
+       for (a = 0; a < CRYPTO_num_locks(); a++) 
+               free(SSLCritters[a]);
+       free (SSLCritters);
+}
+
 void init_ssl(void)
 {
        SSL_METHOD *ssl_method;