From aeaeffe7a6f825c68c5eb859292e63f5ec5a8093 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Sep 17 2010 16:07:42 +0000 Subject: Merge branch 'f13' into f14 --- diff --git a/cups-force-gnutls.patch b/cups-force-gnutls.patch new file mode 100644 index 0000000..85adaa8 --- /dev/null +++ b/cups-force-gnutls.patch @@ -0,0 +1,89 @@ +diff -up cups-1.4.4/config-scripts/cups-ssl.m4.force-gnutls cups-1.4.4/config-scripts/cups-ssl.m4 +--- cups-1.4.4/config-scripts/cups-ssl.m4.force-gnutls 2010-09-15 16:49:22.343502552 +0100 ++++ cups-1.4.4/config-scripts/cups-ssl.m4 2010-09-15 16:49:42.347502595 +0100 +@@ -65,23 +65,21 @@ if test x$enable_ssl != xno; then + if $PKGCONFIG --exists gnutls; then + if test "x$have_pthread" = xyes; then + AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.]) +- else +- have_ssl=1 +- SSLLIBS=`$PKGCONFIG --libs gnutls` +- SSLFLAGS=`$PKGCONFIG --cflags gnutls` +- AC_DEFINE(HAVE_SSL) +- AC_DEFINE(HAVE_GNUTLS) + fi ++ have_ssl=1 ++ SSLLIBS=`$PKGCONFIG --libs gnutls` ++ SSLFLAGS=`$PKGCONFIG --cflags gnutls` ++ AC_DEFINE(HAVE_SSL) ++ AC_DEFINE(HAVE_GNUTLS) + elif test "x$LIBGNUTLSCONFIG" != x; then + if test "x$have_pthread" = xyes; then + AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.]) +- else +- have_ssl=1 +- SSLLIBS=`$LIBGNUTLSCONFIG --libs` +- SSLFLAGS=`$LIBGNUTLSCONFIG --cflags` +- AC_DEFINE(HAVE_SSL) +- AC_DEFINE(HAVE_GNUTLS) + fi ++ have_ssl=1 ++ SSLLIBS=`$LIBGNUTLSCONFIG --libs` ++ SSLFLAGS=`$LIBGNUTLSCONFIG --cflags` ++ AC_DEFINE(HAVE_SSL) ++ AC_DEFINE(HAVE_GNUTLS) + fi + + if test $have_ssl = 1; then +diff -up cups-1.4.4/configure.force-gnutls cups-1.4.4/configure +--- cups-1.4.4/configure.force-gnutls 2010-06-17 19:25:47.000000000 +0100 ++++ cups-1.4.4/configure 2010-09-15 16:50:01.689503165 +0100 +@@ -17542,36 +17542,34 @@ fi + if test "x$have_pthread" = xyes; then + { echo "$as_me:$LINENO: WARNING: The current version of GNU TLS cannot be made thread-safe." >&5 + echo "$as_me: WARNING: The current version of GNU TLS cannot be made thread-safe." >&2;} +- else +- have_ssl=1 +- SSLLIBS=`$PKGCONFIG --libs gnutls` +- SSLFLAGS=`$PKGCONFIG --cflags gnutls` +- cat >>confdefs.h <<\_ACEOF ++ fi ++ have_ssl=1 ++ SSLLIBS=`$PKGCONFIG --libs gnutls` ++ SSLFLAGS=`$PKGCONFIG --cflags gnutls` ++ cat >>confdefs.h <<\_ACEOF + #define HAVE_SSL 1 + _ACEOF + +- cat >>confdefs.h <<\_ACEOF ++ cat >>confdefs.h <<\_ACEOF + #define HAVE_GNUTLS 1 + _ACEOF + +- fi + elif test "x$LIBGNUTLSCONFIG" != x; then + if test "x$have_pthread" = xyes; then + { echo "$as_me:$LINENO: WARNING: The current version of GNU TLS cannot be made thread-safe." >&5 + echo "$as_me: WARNING: The current version of GNU TLS cannot be made thread-safe." >&2;} +- else +- have_ssl=1 +- SSLLIBS=`$LIBGNUTLSCONFIG --libs` +- SSLFLAGS=`$LIBGNUTLSCONFIG --cflags` +- cat >>confdefs.h <<\_ACEOF ++ fi ++ have_ssl=1 ++ SSLLIBS=`$LIBGNUTLSCONFIG --libs` ++ SSLFLAGS=`$LIBGNUTLSCONFIG --cflags` ++ cat >>confdefs.h <<\_ACEOF + #define HAVE_SSL 1 + _ACEOF + +- cat >>confdefs.h <<\_ACEOF ++ cat >>confdefs.h <<\_ACEOF + #define HAVE_GNUTLS 1 + _ACEOF + +- fi + fi + + if test $have_ssl = 1; then diff --git a/cups-serialize-gnutls.patch b/cups-serialize-gnutls.patch new file mode 100644 index 0000000..cdd82cb --- /dev/null +++ b/cups-serialize-gnutls.patch @@ -0,0 +1,109 @@ +diff -up cups-1.4.4/cups/http.c.serialize-gnutls cups-1.4.4/cups/http.c +--- cups-1.4.4/cups/http.c.serialize-gnutls 2010-09-17 13:37:01.858871762 +0100 ++++ cups-1.4.4/cups/http.c 2010-09-17 13:55:22.579871934 +0100 +@@ -149,7 +149,7 @@ static int http_write_ssl(http_t *http, + + # ifdef HAVE_GNUTLS + # ifdef HAVE_PTHREAD_H +-GCRY_THREAD_OPTION_PTHREAD_IMPL; ++static pthread_mutex_t gnutls_lock; + # endif /* HAVE_PTHREAD_H */ + + # elif defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD_H) +@@ -1231,7 +1231,7 @@ httpInitialize(void) + */ + + # ifdef HAVE_PTHREAD_H +- gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); ++ pthread_mutex_init(&gnutls_lock, NULL); + # endif /* HAVE_PTHREAD_H */ + + /* +@@ -2228,6 +2228,7 @@ _httpWait(http_t *http, /* I - Connect + if (SSL_pending((SSL *)(http->tls))) + return (1); + # elif defined(HAVE_GNUTLS) ++ /* lock already held here... */ + if (gnutls_record_check_pending(((http_tls_t *)(http->tls))->session)) + return (1); + # elif defined(HAVE_CDSASSL) +@@ -2294,6 +2295,8 @@ int /* O - 1 if data is available, 0 + httpWait(http_t *http, /* I - Connection to server */ + int msec) /* I - Milliseconds to wait */ + { ++ int ret; ++ + /* + * First see if there is data in the buffer... + */ +@@ -2318,7 +2321,17 @@ httpWait(http_t *http, /* I - Connecti + * If not, check the SSL/TLS buffers and do a select() on the connection... + */ + +- return (_httpWait(http, msec, 1)); ++#if defined(HAVE_SSL) && defined(HAVE_GNUTLS) && defined(HAVE_PTHREAD_H) ++ pthread_mutex_lock(&gnutls_lock); ++#endif ++ ++ ret = _httpWait(http, msec, 1); ++ ++#if defined(HAVE_SSL) && defined(HAVE_GNUTLS) && defined(HAVE_PTHREAD_H) ++ pthread_mutex_unlock(&gnutls_lock); ++#endif ++ ++ return (ret); + } + + +@@ -2769,7 +2782,9 @@ http_read_ssl(http_t *http, /* I - Conn + ssize_t result; /* Return value */ + + ++ pthread_mutex_lock(&gnutls_lock); + result = gnutls_record_recv(((http_tls_t *)(http->tls))->session, buf, len); ++ pthread_mutex_unlock(&gnutls_lock); + + if (result < 0 && !errno) + { +@@ -3085,6 +3100,7 @@ http_setup_ssl(http_t *http) /* I - Con + return (-1); + } + ++ pthread_mutex_lock(&gnutls_lock); + gnutls_certificate_allocate_credentials(credentials); + + gnutls_init(&(conn->session), GNUTLS_CLIENT); +@@ -3104,9 +3120,11 @@ http_setup_ssl(http_t *http) /* I - Con + free(credentials); + free(conn); + ++ pthread_mutex_unlock(&gnutls_lock); + return (-1); + } + ++ pthread_mutex_unlock(&gnutls_lock); + conn->credentials = credentials; + + # elif defined(HAVE_CDSASSL) +@@ -3196,9 +3214,11 @@ http_shutdown_ssl(http_t *http) /* I - + conn = (http_tls_t *)(http->tls); + credentials = (gnutls_certificate_client_credentials *)(conn->credentials); + ++ pthread_mutex_lock(&gnutls_lock); + gnutls_bye(conn->session, GNUTLS_SHUT_RDWR); + gnutls_deinit(conn->session); + gnutls_certificate_free_credentials(*credentials); ++ pthread_mutex_unlock(&gnutls_lock); + free(credentials); + free(conn); + +@@ -3445,7 +3465,9 @@ http_write_ssl(http_t *http, /* I - + # elif defined(HAVE_GNUTLS) + ssize_t result; /* Return value */ + ++ pthread_mutex_lock(&gnutls_lock); + result = gnutls_record_send(((http_tls_t *)(http->tls))->session, buf, len); ++ pthread_mutex_unlock(&gnutls_lock); + + if (result < 0 && !errno) + { diff --git a/cups-serverbin-compat.patch b/cups-serverbin-compat.patch index 0d1ab10..44a7894 100644 --- a/cups-serverbin-compat.patch +++ b/cups-serverbin-compat.patch @@ -1,7 +1,7 @@ -diff -up cups-1.4rc1/scheduler/conf.c.serverbin-compat cups-1.4rc1/scheduler/conf.c ---- cups-1.4rc1/scheduler/conf.c.serverbin-compat 2009-05-26 16:41:04.000000000 +0100 -+++ cups-1.4rc1/scheduler/conf.c 2009-06-17 11:03:24.286442640 +0100 -@@ -490,6 +490,9 @@ cupsdReadConfiguration(void) +diff -up cups-1.4.4/scheduler/conf.c.serverbin-compat cups-1.4.4/scheduler/conf.c +--- cups-1.4.4/scheduler/conf.c.serverbin-compat 2010-04-23 19:56:34.000000000 +0100 ++++ cups-1.4.4/scheduler/conf.c 2010-09-15 13:20:41.339960335 +0100 +@@ -488,6 +488,9 @@ cupsdReadConfiguration(void) cupsdClearString(&ServerName); cupsdClearString(&ServerAdmin); cupsdSetString(&ServerBin, CUPS_SERVERBIN); @@ -11,7 +11,7 @@ diff -up cups-1.4rc1/scheduler/conf.c.serverbin-compat cups-1.4rc1/scheduler/con cupsdSetString(&RequestRoot, CUPS_REQUESTS); cupsdSetString(&CacheDir, CUPS_CACHEDIR); cupsdSetString(&DataDir, CUPS_DATADIR); -@@ -1320,7 +1323,12 @@ cupsdReadConfiguration(void) +@@ -1318,7 +1321,12 @@ cupsdReadConfiguration(void) * Read the MIME type and conversion database... */ @@ -24,10 +24,10 @@ diff -up cups-1.4rc1/scheduler/conf.c.serverbin-compat cups-1.4rc1/scheduler/con snprintf(mimedir, sizeof(mimedir), "%s/mime", DataDir); MimeDatabase = mimeLoadTypes(NULL, mimedir); -diff -up cups-1.4rc1/scheduler/conf.h.serverbin-compat cups-1.4rc1/scheduler/conf.h ---- cups-1.4rc1/scheduler/conf.h.serverbin-compat 2009-05-11 23:46:01.000000000 +0100 -+++ cups-1.4rc1/scheduler/conf.h 2009-06-17 11:03:24.287442308 +0100 -@@ -106,6 +106,10 @@ VAR char *ConfigurationFile VALUE(NULL) +diff -up cups-1.4.4/scheduler/conf.h.serverbin-compat cups-1.4.4/scheduler/conf.h +--- cups-1.4.4/scheduler/conf.h.serverbin-compat 2010-04-23 19:56:34.000000000 +0100 ++++ cups-1.4.4/scheduler/conf.h 2010-09-15 13:20:41.340959464 +0100 +@@ -105,6 +105,10 @@ VAR char *ConfigurationFile VALUE(NULL) /* Root directory for scheduler */ *ServerBin VALUE(NULL), /* Root directory for binaries */ @@ -38,10 +38,10 @@ diff -up cups-1.4rc1/scheduler/conf.h.serverbin-compat cups-1.4rc1/scheduler/con *StateDir VALUE(NULL), /* Root directory for state data */ *RequestRoot VALUE(NULL), -diff -up cups-1.4rc1/scheduler/env.c.serverbin-compat cups-1.4rc1/scheduler/env.c ---- cups-1.4rc1/scheduler/env.c.serverbin-compat 2008-06-18 23:31:26.000000000 +0100 -+++ cups-1.4rc1/scheduler/env.c 2009-06-17 11:03:24.288442597 +0100 -@@ -86,8 +86,13 @@ cupsdInitEnv(void) +diff -up cups-1.4.4/scheduler/env.c.serverbin-compat cups-1.4.4/scheduler/env.c +--- cups-1.4.4/scheduler/env.c.serverbin-compat 2009-06-15 18:13:52.000000000 +0100 ++++ cups-1.4.4/scheduler/env.c 2010-09-15 13:20:41.341959587 +0100 +@@ -87,8 +87,13 @@ cupsdInitEnv(void) cupsdSetEnv("LD_LIBRARY_PATH", NULL); cupsdSetEnv("LD_PRELOAD", NULL); cupsdSetEnv("NLSPATH", NULL); @@ -55,10 +55,10 @@ diff -up cups-1.4rc1/scheduler/env.c.serverbin-compat cups-1.4rc1/scheduler/env. cupsdSetEnv("SERVER_ADMIN", ServerAdmin); cupsdSetEnv("SHLIB_PATH", NULL); cupsdSetEnv("SOFTWARE", CUPS_MINIMAL); -diff -up cups-1.4rc1/scheduler/ipp.c.serverbin-compat cups-1.4rc1/scheduler/ipp.c ---- cups-1.4rc1/scheduler/ipp.c.serverbin-compat 2009-05-26 23:01:23.000000000 +0100 -+++ cups-1.4rc1/scheduler/ipp.c 2009-06-17 11:03:24.295443078 +0100 -@@ -2539,9 +2539,18 @@ add_printer(cupsd_client_t *con, /* I - +diff -up cups-1.4.4/scheduler/ipp.c.serverbin-compat cups-1.4.4/scheduler/ipp.c +--- cups-1.4.4/scheduler/ipp.c.serverbin-compat 2010-04-23 19:56:34.000000000 +0100 ++++ cups-1.4.4/scheduler/ipp.c 2010-09-15 13:20:41.359835378 +0100 +@@ -2615,9 +2615,18 @@ add_printer(cupsd_client_t *con, /* I - * Could not find device in list! */ @@ -77,9 +77,9 @@ diff -up cups-1.4rc1/scheduler/ipp.c.serverbin-compat cups-1.4rc1/scheduler/ipp. } } -diff -up cups-1.4rc1/scheduler/job.c.serverbin-compat cups-1.4rc1/scheduler/job.c ---- cups-1.4rc1/scheduler/job.c.serverbin-compat 2009-05-11 23:46:01.000000000 +0100 -+++ cups-1.4rc1/scheduler/job.c 2009-06-17 11:03:24.305442437 +0100 +diff -up cups-1.4.4/scheduler/job.c.serverbin-compat cups-1.4.4/scheduler/job.c +--- cups-1.4.4/scheduler/job.c.serverbin-compat 2010-03-30 23:07:33.000000000 +0100 ++++ cups-1.4.4/scheduler/job.c 2010-09-15 13:20:41.366836134 +0100 @@ -972,8 +972,32 @@ cupsdContinueJob(cupsd_job_t *job) /* I i ++, filter = (mime_filter_t *)cupsArrayNext(filters)) { @@ -144,10 +144,10 @@ diff -up cups-1.4rc1/scheduler/job.c.serverbin-compat cups-1.4rc1/scheduler/job. close(job->status_pipes[1]); job->status_pipes[1] = -1; -diff -up cups-1.4rc1/scheduler/printers.c.serverbin-compat cups-1.4rc1/scheduler/printers.c ---- cups-1.4rc1/scheduler/printers.c.serverbin-compat 2009-05-16 22:49:57.000000000 +0100 -+++ cups-1.4rc1/scheduler/printers.c 2009-06-17 11:08:13.888317742 +0100 -@@ -1015,9 +1015,19 @@ cupsdLoadAllPrinters(void) +diff -up cups-1.4.4/scheduler/printers.c.serverbin-compat cups-1.4.4/scheduler/printers.c +--- cups-1.4.4/scheduler/printers.c.serverbin-compat 2010-04-23 21:53:38.000000000 +0100 ++++ cups-1.4.4/scheduler/printers.c 2010-09-15 13:21:39.627960657 +0100 +@@ -1059,9 +1059,19 @@ cupsdLoadAllPrinters(void) * Backend does not exist, stop printer... */ @@ -167,7 +167,7 @@ diff -up cups-1.4rc1/scheduler/printers.c.serverbin-compat cups-1.4rc1/scheduler } } -@@ -3549,6 +3559,12 @@ add_printer_filter( +@@ -3603,6 +3613,14 @@ add_printer_filter( if (stat(filename, &fileinfo)) { @@ -176,11 +176,13 @@ diff -up cups-1.4rc1/scheduler/printers.c.serverbin-compat cups-1.4rc1/scheduler + program); + if (stat(filename, &fileinfo)) + { ++ snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin, ++ program); +#endif /* __x86_64__ */ memset(&fileinfo, 0, sizeof(fileinfo)); snprintf(p->state_message, sizeof(p->state_message), -@@ -3557,6 +3573,9 @@ add_printer_filter( +@@ -3611,6 +3629,9 @@ add_printer_filter( cupsdSetPrinterReasons(p, "+cups-missing-filter-warning"); cupsdLogMessage(CUPSD_LOG_ERROR, "%s", p->state_message); diff --git a/cups-snmp-quirks.patch b/cups-snmp-quirks.patch index d90c5f6..0308676 100644 --- a/cups-snmp-quirks.patch +++ b/cups-snmp-quirks.patch @@ -96,8 +96,8 @@ diff -up cups-1.4.3/backend/snmp-supplies.c.snmp-quirks cups-1.4.3/backend/snmp- + for (i = 0; i < sizeof (quirk_names) / sizeof (quirk_names[0]); i++) + { + len = strlen (quirk_names[i].keyword); -+ if (!strncmp (value, quirk_names[i].keyword, len) && -+ (value[len] == '\0' || value[len] == ' ')) ++ if (!strncmp (ptr, quirk_names[i].keyword, len) && ++ (ptr[len] == '\0' || ptr[len] == ' ')) + quirks |= quirk_names[i].bit; + } + diff --git a/cups.spec b/cups.spec index 640c040..68800fb 100644 --- a/cups.spec +++ b/cups.spec @@ -8,7 +8,7 @@ Summary: Common Unix Printing System Name: cups Version: 1.4.4 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv2 Group: System Environment/Daemons Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2 @@ -56,6 +56,8 @@ Patch22: cups-uri-compat.patch Patch23: cups-cups-get-classes.patch Patch24: cups-avahi.patch Patch25: cups-str3382.patch +Patch26: cups-force-gnutls.patch +Patch27: cups-serialize-gnutls.patch Patch29: cups-0755.patch Patch30: cups-EAI_AGAIN.patch Patch31: cups-hostnamelookups.patch @@ -250,6 +252,11 @@ module. %patch24 -p1 -b .avahi # Fix temporary filename creation. %patch25 -p1 -b .str3382 +# Force the use of gnutls despite thread-safety concerns (bug #607159). +%patch26 -p1 -b .force-gnutls +# Perform locking for gnutls and avoid libgcrypt's broken +# locking (bug #607159). +%patch27 -p1 -b .serialize-gnutls # Use mode 0755 for binaries and libraries where appropriate. %patch29 -p1 -b .0755 # Re-initialise the resolver on failure in httpAddrLookup(). @@ -306,7 +313,7 @@ export CFLAGS="$RPM_OPT_FLAGS -fstack-protector-all -DLDAP_DEPRECATED=1" --with-pdftops=pdftops \ --with-dbusdir=%{_sysconfdir}/dbus-1 \ --with-php=/usr/bin/php-cgi --enable-avahi \ - --disable-threads --enable-gnutls \ + --enable-threads --enable-gnutls \ localedir=%{_datadir}/locale # If we got this far, all prerequisite libraries must be here. @@ -571,6 +578,19 @@ rm -rf $RPM_BUILD_ROOT %{php_extdir}/phpcups.so %changelog +* Fri Sep 17 2010 Tim Waugh 1:1.4.4-10 +- Perform locking for gnutls and avoid libgcrypt's broken + locking (bug #607159). +- Build with --enable-threads again (bug #607159). +- Force the use of gnutls despite thread-safety concerns (bug #607159). + +* Wed Sep 15 2010 Tim Waugh +- Fixed serverbin-compat patch to avoid misleading "filter not + available" messages (bug #633779). + +* Mon Aug 23 2010 Tim Waugh +- Fixed SNMP quirks parsing. + * Fri Aug 20 2010 Tim Waugh 1:1.4.4-9 - Use better upstream fix for STR #3608 (bug #606909).