From e31313b07f2f57e3fe8b3340ae410a7a13e71607 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 13 Mar 2001 23:31:32 +0000 Subject: Since all of the Mozilla libs (including NSPR and NSS) correctly handle 2001-03-13 Jeffrey Stedfast * camel.c (camel_init): Since all of the Mozilla libs (including NSPR and NSS) correctly handle reinitializations, we might as well init both NSPR and NSS in camel_init so we can be sure of that these libs have been initialized. (camel_shutdown): New function to call the NSS cleanup stuff. svn path=/trunk/; revision=8690 --- camel/camel.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'camel/camel.c') diff --git a/camel/camel.c b/camel/camel.c index c451045c32..4aa4512722 100644 --- a/camel/camel.c +++ b/camel/camel.c @@ -28,6 +28,7 @@ #include #ifdef HAVE_NSS #include +#include #include #include #endif /* HAVE_NSS */ @@ -35,13 +36,13 @@ gboolean camel_verbose_debug = FALSE; gint -camel_init (void) +camel_init (const char *certdb) { #ifdef ENABLE_THREADS #ifdef G_THREADS_ENABLED /*g_thread_init (NULL);*/ #else /* G_THREADS_ENABLED */ - g_warning ("Threads are not supported by your version of glib\n"); + g_warning ("Threads are not supported by your version of glib"); #endif /* G_THREADS_ENABLED */ #endif /* ENABLE_THREADS */ @@ -51,6 +52,15 @@ camel_init (void) unicode_init (); #ifdef HAVE_NSS + PR_Init (PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 10); + + if (NSS_Init (certdb) == SECFailure) { + g_warning ("Failed to initialize NSS"); + return -1; + } + + NSS_SetDomesticPolicy (); + SSL_OptionSetDefault (SSL_ENABLE_SSL2, PR_TRUE); SSL_OptionSetDefault (SSL_ENABLE_SSL3, PR_TRUE); SSL_OptionSetDefault (SSL_ENABLE_TLS, PR_TRUE); @@ -59,3 +69,13 @@ camel_init (void) return 0; } + +void +camel_shutdown (void) +{ +#ifdef HAVE_NSS + NSS_Shutdown (); + + PR_Cleanup (); +#endif /* HAVE_NSS */ +} -- cgit v1.2.3