From 2da82ca26261d3772c9c54d28c3195a7735f169f Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 15 Mar 2001 01:59:00 +0000 Subject: So it turns out that NSS_Init *isn't* idempotent, so we have to protect 2001-03-14 Jeffrey Stedfast * camel.c (camel_init): So it turns out that NSS_Init *isn't* idempotent, so we have to protect against initializing it more than once(contrary to what their design specs suggest). * camel-session.c (camel_session_get_service): Use camel_exception_is_set() - Makes no difference but it's more consistant with how we normally do it. * camel-provider.h (CAMEL_URL_ALLOW_SSL): We don't need this. * providers/imap/camel-imap-provider.c: Define the imaps provider. (camel_provider_module_init): Register the imaps provider. * camel-provider.c (camel_provider_init): Only add the protocol to the hash table if it's non empty. Also, g_strdup() the filename into the hash table. * providers/imap/camel-imap-store.c (camel_imap_store_init): Eek! So the service's URL isn't set until after this is initialized. This means we can't check for SSL here. (imap_connect): Set the SSL options here instead. svn path=/trunk/; revision=8718 --- camel/camel.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'camel/camel.c') diff --git a/camel/camel.c b/camel/camel.c index 38ad4a9a09..5b102473e6 100644 --- a/camel/camel.c +++ b/camel/camel.c @@ -27,8 +27,8 @@ #include "camel.h" #include #ifdef HAVE_NSS -#include -#include +#include +#include #include #include #endif /* HAVE_NSS */ @@ -36,7 +36,7 @@ gboolean camel_verbose_debug = FALSE; gint -camel_init (const char *certdb) +camel_init (const char *certdb_dir, gboolean nss_init) { #ifdef ENABLE_THREADS #ifdef G_THREADS_ENABLED @@ -52,15 +52,17 @@ camel_init (const char *certdb) unicode_init (); #ifdef HAVE_NSS - PR_Init (PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 10); - - if (NSS_Init ("/home/fejj/.mozilla/default") == SECFailure) { - g_warning ("Failed to initialize NSS"); - return -1; + if (nss_init) { + PR_Init (PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 10); + + if (NSS_Init ("/home/fejj/.mozilla/default") == SECFailure) { + g_warning ("Failed to initialize NSS"); + return -1; + } + + NSS_SetDomesticPolicy (); } - NSS_SetDomesticPolicy (); - SSL_OptionSetDefault (SSL_ENABLE_SSL2, PR_TRUE); SSL_OptionSetDefault (SSL_ENABLE_SSL3, PR_TRUE); SSL_OptionSetDefault (SSL_ENABLE_TLS, PR_TRUE); -- cgit v1.2.3