- Ensure proper thread-safety in gnutls's use of libgcrypt (bug #544619).

This commit is contained in:
Tim Waugh 2009-12-21 17:07:05 +00:00
parent afdd444a6d
commit b5b3f9aa92
2 changed files with 63 additions and 1 deletions

View File

@ -0,0 +1,56 @@
diff -up cups-1.4.2/cups/http.c.gnutls-gcrypt-threads cups-1.4.2/cups/http.c
--- cups-1.4.2/cups/http.c.gnutls-gcrypt-threads 2009-12-21 16:50:58.931552118 +0000
+++ cups-1.4.2/cups/http.c 2009-12-21 16:51:15.047552357 +0000
@@ -1161,6 +1161,9 @@ httpHead(http_t *http, /* I - Conne
return (http_send(http, HTTP_HEAD, uri));
}
+#ifdef HAVE_GNUTLS
+GCRY_THREAD_OPTION_PTHREAD_IMPL;
+#endif
/*
* 'httpInitialize()' - Initialize the HTTP interface library and set the
@@ -1205,6 +1208,7 @@ httpInitialize(void)
#endif /* WIN32 */
#ifdef HAVE_GNUTLS
+ gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
gnutls_global_init();
#endif /* HAVE_GNUTLS */
diff -up cups-1.4.2/cups/http-private.h.gnutls-gcrypt-threads cups-1.4.2/cups/http-private.h
--- cups-1.4.2/cups/http-private.h.gnutls-gcrypt-threads 2009-04-07 16:48:14.000000000 +0100
+++ cups-1.4.2/cups/http-private.h 2009-12-21 16:51:15.049552624 +0000
@@ -98,6 +98,8 @@ extern BIO_METHOD *_httpBIOMethods(void)
* The GNU TLS library is more of a "bare metal" SSL/TLS library...
*/
# include <gnutls/gnutls.h>
+# include <gcrypt.h>
+# include <pthread.h>
typedef struct
{
diff -up cups-1.4.2/scheduler/server.c.gnutls-gcrypt-threads cups-1.4.2/scheduler/server.c
--- cups-1.4.2/scheduler/server.c.gnutls-gcrypt-threads 2008-09-10 23:05:29.000000000 +0100
+++ cups-1.4.2/scheduler/server.c 2009-12-21 16:51:15.048553044 +0000
@@ -35,7 +35,9 @@
*/
static int started = 0;
-
+#if !defined(HAVE_LIBSSL) && defined(HAVE_GNUTLS)
+GCRY_THREAD_OPTION_PTHREAD_IMPL;
+#endif
/*
* 'cupsdStartServer()' - Start the server.
@@ -75,7 +77,7 @@ cupsdStartServer(void)
/*
* Initialize the encryption libraries...
*/
-
+ gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
gnutls_global_init();
#endif /* HAVE_LIBSSL */

View File

@ -9,7 +9,7 @@
Summary: Common Unix Printing System
Name: cups
Version: 1.4.2
Release: 17%{?dist}
Release: 18%{?dist}
License: GPLv2
Group: System Environment/Daemons
Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2
@ -74,6 +74,7 @@ Patch46: cups-str3425.patch
Patch47: cups-str3428.patch
Patch48: cups-str3431.patch
Patch49: cups-delete-active-printer.patch
Patch50: cups-gnutls-gcrypt-threads.patch
Patch100: cups-lspp.patch
@ -253,6 +254,7 @@ module.
%patch47 -p1 -b .str3428
%patch48 -p1 -b .str3431
%patch49 -p1 -b .delete-active-printer
%patch50 -p1 -b .gnutls-gcrypt-threads
%if %lspp
%patch100 -p1 -b .lspp
@ -551,6 +553,10 @@ rm -rf $RPM_BUILD_ROOT
%{php_extdir}/phpcups.so
%changelog
* Mon Dec 21 2009 Tim Waugh <twaugh@redhat.com> - 1:1.4.2-18
- Ensure proper thread-safety in gnutls's use of libgcrypt
(bug #544619).
* Sat Dec 19 2009 Tim Waugh <twaugh@redhat.com> - 1:1.4.2-17
- Fixed patch for STR #3425 by adding in back-ported change from svn
revision 8936 (bug #548904).