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/ChangeLog | 8 ++++++++ camel/camel.c | 24 ++++++++++++++++++++++-- camel/camel.h | 4 +++- 3 files changed, 33 insertions(+), 3 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index c0b391e099..9fea64d53c 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,11 @@ +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. + 2001-03-13 Jeffrey Stedfast * camel-folder.c (camel_folder_copy_message_to): Don't allow the 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 */ +} diff --git a/camel/camel.h b/camel/camel.h index 6de1ae6462..fc50f3eb35 100644 --- a/camel/camel.h +++ b/camel/camel.h @@ -68,7 +68,9 @@ extern "C" { #include #include -gint camel_init (void); +gint camel_init (const char *certdb); + +void camel_shutdown (void); #ifdef __cplusplus } -- cgit v1.2.3