[evolution-patches] 66342, soup libgcrypt bug



libgcrypt 1.2 apparently removed some thread-safetiness that had been in
1.1.x. This puts it back.

This does not affect our own packages (because we're still building
against 1.1.91), but may affect other distros.


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libsoup/ChangeLog,v
retrieving revision 1.444
diff -u -r1.444 ChangeLog
--- ChangeLog	26 Aug 2004 20:28:33 -0000	1.444
+++ ChangeLog	30 Sep 2004 15:29:15 -0000
@@ -1,3 +1,11 @@
+2004-09-30  Dan Winship  <danw novell com>
+
+	* libsoup/soup-gnutls.c (soup_gnutls_init): Add this, with some
+	extra initialization needed for libgcrypt 1.2 or higher. Fixes
+	66342.
+	(soup_ssl_get_client_credentials,
+	soup_ssl_get_server_credentials): Call soup_gnutls_init().
+
 2004-08-26  Dan Winship  <danw novell com>
 
 	* configure.in: Bump version to 2.2.0.
Index: libsoup/soup-gnutls.c
===================================================================
RCS file: /cvs/gnome/libsoup/libsoup/soup-gnutls.c,v
retrieving revision 1.15
diff -u -r1.15 soup-gnutls.c
--- libsoup/soup-gnutls.c	26 Aug 2004 15:33:33 -0000	1.15
+++ libsoup/soup-gnutls.c	30 Sep 2004 15:29:15 -0000
@@ -14,11 +14,14 @@
 
 #ifdef HAVE_SSL
 
+#include <errno.h>
+#include <pthread.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include <glib.h>
 
+#include <gcrypt.h>
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 
@@ -406,6 +409,22 @@
 	return NULL;
 }
 
+static gboolean soup_gnutls_inited = FALSE;
+
+#ifdef GCRY_THREAD_OPTION_PTHREAD_IMPL
+GCRY_THREAD_OPTION_PTHREAD_IMPL;
+#endif
+
+static void
+soup_gnutls_init (void)
+{
+#ifdef GCRY_THREAD_OPTION_PTHREAD_IMPL
+	gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+#endif
+	gnutls_global_init ();
+	soup_gnutls_inited = TRUE;
+}
+
 /**
  * soup_ssl_get_client_credentials:
  * @ca_file: path to a file containing X509-encoded Certificate
@@ -427,7 +446,8 @@
 	SoupGNUTLSCred *cred;
 	int status;
 
-	gnutls_global_init ();
+	if (!soup_gnutls_inited)
+		soup_gnutls_init ();
 
 	cred = g_new0 (SoupGNUTLSCred, 1);
 	gnutls_certificate_allocate_credentials (&cred->cred);
@@ -484,7 +504,8 @@
 {
 	SoupGNUTLSCred *cred;
 
-	gnutls_global_init ();
+	if (!soup_gnutls_inited)
+		soup_gnutls_init ();
 	if (!dh_params) {
 		if (!init_dh_params ())
 			return NULL;


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