diff options
Diffstat (limited to 'camel/camel.c')
-rw-r--r-- | camel/camel.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/camel/camel.c b/camel/camel.c index 25807b5aac..7b250a14b1 100644 --- a/camel/camel.c +++ b/camel/camel.c @@ -36,6 +36,7 @@ #endif /* HAVE_NSS */ #include "camel.h" +#include "camel-certdb.h" #include "camel-mime-utils.h" gboolean camel_verbose_debug = FALSE; @@ -44,15 +45,26 @@ gboolean camel_verbose_debug = FALSE; static void camel_shutdown (void) { + CamelCertDB *certdb; + NSS_Shutdown (); PR_Cleanup (); + + certdb = camel_certdb_get_default (); + if (certdb) { + camel_certdb_save (certdb); + camel_object_unref (certdb); + } } #endif /* HAVE_NSS */ gint camel_init (const char *configdir, gboolean nss_init) { + CamelCertDB *certdb; + char *path; + #ifdef ENABLE_THREADS #ifdef G_THREADS_ENABLED /*g_thread_init (NULL);*/ @@ -68,7 +80,7 @@ camel_init (const char *configdir, gboolean nss_init) camel_object_get_type(); camel_mime_utils_init(); - + #ifdef HAVE_NSS if (nss_init) { PR_Init (PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 10); @@ -92,5 +104,18 @@ camel_init (const char *configdir, gboolean nss_init) SSL_OptionSetDefault (SSL_V2_COMPATIBLE_HELLO, PR_TRUE /* maybe? */); #endif /* HAVE_NSS */ + path = g_strdup_printf ("%s/camel-cert.db", configdir); + certdb = camel_certdb_new (); + camel_certdb_set_filename (certdb, path); + g_free (path); + + /* if we fail to load, who cares? it'll just be a volatile certdb */ + camel_certdb_load (certdb); + + /* set this certdb as the default db */ + camel_certdb_set_default (certdb); + + camel_object_unref (certdb); + return 0; } |