From b0633536f2b5e11a1a1ab032bad38218c31173db Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 30 Jul 2002 19:16:11 +0000 Subject: New source file implementing a very basic certificate database. This is 2002-07-30 Jeffrey Stedfast * camel-certdb.c: New source file implementing a very basic certificate database. This is mostly just here because the Mozilla NSS certdb seems to not be working for everyone's Evolution install (works fine for me and Ettore but not many other people). * camel-tcp-stream-ssl.c (ssl_bad_cert): If we have this certificate in our own CamelCertDB, then get the trust value from that and only prompt the user if the trust is unknown. * camel-tcp-stream-openssl.c (ssl_verify): Same. * camel.c (camel_init): Create our default certdb. svn path=/trunk/; revision=17642 --- camel/camel.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'camel/camel.c') 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; } -- cgit v1.2.3