Added a missing NSS initialization error check code



Hi,

as perfectly pointed out here
https://bugs.maemo.org/show_bug.cgi?id=3411 an error check is missing
for the call to NSS_InitReadWrite. I added some code to deal with such
situation.

Br
Index: libtinymail-camel/camel-lite/camel/camel-tcp-stream-ssl.c
===================================================================
--- libtinymail-camel/camel-lite/camel/camel-tcp-stream-ssl.c	(revision 3719)
+++ libtinymail-camel/camel-lite/camel/camel-tcp-stream-ssl.c	(working copy)
@@ -298,7 +298,18 @@
 		char *str = camel_session_get_storage_path (stream->priv->session, service, NULL);
 		if (!str)
 			str = g_strdup (g_get_tmp_dir ());
-		NSS_InitReadWrite (str);
+
+		if (NSS_InitReadWrite (str) == SECFailure) {
+			/* fall back on using volatile dbs? */
+			if (NSS_NoDB_Init (str) == SECFailure) {
+				g_warning ("Failed to initialize NSS");
+				g_free (str);
+				stream->priv->session = NULL;
+				camel_stream_close (stream);
+				camel_object_unref (stream);
+				return NULL;
+			}
+		}
 		has_init = TRUE;
 		g_free (str);
 	}


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