[evolution/gnome-2-28] Revert "Bug 585301 - Use camel_init() to initialize NSS consistently"



commit 7cff68e5b7a24e84e8730969cb0b6d11c4c97e5e
Author: David Woodhouse <David Woodhouse intel com>
Date:   Fri Jun 11 10:22:29 2010 +0100

    Revert "Bug 585301 - Use camel_init() to initialize NSS consistently"
    
    This reverts commit 9216623032a595371b6784caf6cc310a7ca7832c, which was
    accidentally pushed to the wrong repository.
    
    Sorry!

 smime/lib/e-cert-db.c |   36 ++++++++++++++++++++++++++++++------
 1 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/smime/lib/e-cert-db.c b/smime/lib/e-cert-db.c
index 7453f4a..fc976bf 100644
--- a/smime/lib/e-cert-db.c
+++ b/smime/lib/e-cert-db.c
@@ -48,9 +48,6 @@
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
 
-
-#include <camel/camel.h>        /* FIXME: this is where camel_init is defined; it shouldn't include everything else */
-
 /* private NSS defines used by PSM */
 /* (must be declated before cert.h) */
 #define CERT_NewTempCertificate __CERT_NewTempCertificate
@@ -158,10 +155,37 @@ pk11_password (PK11SlotInfo* slot, PRBool retry, gpointer  arg)
 static void
 initialize_nss (void)
 {
-	/* Use camel_init() to initialise NSS consistently... */
-	camel_init(e_get_user_data_dir(), TRUE);
+	gchar *evolution_dir_path;
+	gboolean success;
+
+#ifdef G_OS_WIN32
+	/* NSS wants filenames in system codepage */
+	evolution_dir_path = g_win32_locale_filename_from_utf8 (e_get_user_data_dir ());
+#else
+	evolution_dir_path = g_strdup (e_get_user_data_dir ());
+#endif
+
+	/* we initialize NSS here to make sure it only happens once */
+	success = (SECSuccess == NSS_InitReadWrite (evolution_dir_path));
+	if (!success) {
+		success = (SECSuccess == NSS_Init (evolution_dir_path));
+		if (success)
+			g_warning ("opening cert databases read-only");
+	}
+	if (!success) {
+		success = (SECSuccess == NSS_NoDB_Init (evolution_dir_path));
+		if (success)
+			g_warning ("initializing security library without cert databases.");
+	}
+	g_free (evolution_dir_path);
+
+	if (!success) {
+		g_warning ("Failed all methods for initializing NSS");
+		return;
+	}
+
+	NSS_SetDomesticPolicy();
 
-	/* ... except for the bits we only seem to do here. FIXME */
 	PK11_SetPasswordFunc(pk11_password);
 
 	/* Enable ciphers for PKCS#12 */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]