From b5b3f9aa92d64a740b2b0376f755a54f09946e99 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Mon, 21 Dec 2009 17:07:05 +0000 Subject: [PATCH] - Ensure proper thread-safety in gnutls's use of libgcrypt (bug #544619). --- cups-gnutls-gcrypt-threads.patch | 56 ++++++++++++++++++++++++++++++++ cups.spec | 8 ++++- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 cups-gnutls-gcrypt-threads.patch diff --git a/cups-gnutls-gcrypt-threads.patch b/cups-gnutls-gcrypt-threads.patch new file mode 100644 index 0000000..31f14dd --- /dev/null +++ b/cups-gnutls-gcrypt-threads.patch @@ -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 ++# include ++# include + + 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 */ + diff --git a/cups.spec b/cups.spec index 526aae8..4c6c92d 100644 --- a/cups.spec +++ b/cups.spec @@ -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 - 1:1.4.2-18 +- Ensure proper thread-safety in gnutls's use of libgcrypt + (bug #544619). + * Sat Dec 19 2009 Tim Waugh - 1:1.4.2-17 - Fixed patch for STR #3425 by adding in back-ported change from svn revision 8936 (bug #548904).