[cups/f20] Another attempt at avoiding race condition when sending IPP requests (STR #4386, bug #1072952).

Tim Waugh twaugh at fedoraproject.org
Mon May 12 14:33:10 UTC 2014


commit 8425e43657a1d7f4e3d5ffa7459602fa922b2850
Author: Tim Waugh <twaugh at redhat.com>
Date:   Fri May 9 15:45:31 2014 +0100

    Another attempt at avoiding race condition when sending IPP requests (STR #4386, bug #1072952).
    
    Resolves: rhbz#1072952
    (cherry picked from commit e3384fee5967f966cd70b5dee3b308301ddaf57e)
    
    Conflicts:
    	cups.spec

 cups-str4386.patch |   44 ++++++++++++++++++++++++++++++++++++++++++++
 cups.spec          |   10 +++++++++-
 2 files changed, 53 insertions(+), 1 deletions(-)
---
diff --git a/cups-str4386.patch b/cups-str4386.patch
new file mode 100644
index 0000000..e2da700
--- /dev/null
+++ b/cups-str4386.patch
@@ -0,0 +1,44 @@
+diff -up cups-1.7.2/cups/request.c.str4386 cups-1.7.2/cups/request.c
+--- cups-1.7.2/cups/request.c.str4386	2014-03-26 21:06:04.000000000 +0000
++++ cups-1.7.2/cups/request.c	2014-04-16 14:02:20.039876149 +0100
+@@ -749,9 +749,8 @@ cupsSendRequest(http_t     *http,	/* I -
+     got_status     = 0;
+ 
+     while ((state = ippWrite(http, request)) != IPP_STATE_DATA)
+-      if (state == IPP_STATE_ERROR)
+-	break;
+-      else if (httpCheck(http))
++    {
++      if (httpCheck(http))
+       {
+         got_status = 1;
+ 
+@@ -759,15 +758,24 @@ cupsSendRequest(http_t     *http,	/* I -
+ 	if (status >= HTTP_STATUS_MULTIPLE_CHOICES)
+ 	  break;
+       }
++      else if (state == IPP_STATE_ERROR)
++	break;
++    }
+ 
+     if (state == IPP_STATE_ERROR)
+     {
+-      DEBUG_puts("1cupsSendRequest: Unable to send IPP request.");
++      /* We weren't able to send the IPP request. But did we already
++       * get an HTTP error status? */
++      if (!(got_status && status >= HTTP_STATUS_MULTIPLE_CHOICES))
++      {
++	/* No, something else went wrong. */
++	DEBUG_puts("1cupsSendRequest: Unable to send IPP request.");
+ 
+-      http->status = HTTP_STATUS_ERROR;
+-      http->state  = HTTP_STATE_WAITING;
++	http->status = HTTP_STATUS_ERROR;
++	http->state  = HTTP_STATE_WAITING;
+ 
+-      return (HTTP_STATUS_ERROR);
++	return (HTTP_STATUS_ERROR);
++      }
+     }
+ 
+    /*
diff --git a/cups.spec b/cups.spec
index 9f95b9f..03bdb08 100644
--- a/cups.spec
+++ b/cups.spec
@@ -11,7 +11,7 @@ Summary: CUPS printing system
 Name: cups
 Epoch: 1
 Version: 1.7.2
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv2
 Url: http://www.cups.org/
 Source: http://www.cups.org/software/%{version}/cups-%{version}-source.tar.bz2
@@ -30,6 +30,7 @@ Source8: macros.cups
 Patch1: cups-no-gzip-man.patch
 Patch2: cups-system-auth.patch
 Patch3: cups-multilib.patch
+Patch4: cups-str4386.patch
 Patch5: cups-banners.patch
 Patch6: cups-serverbin-compat.patch
 Patch7: cups-no-export-ssllibs.patch
@@ -180,6 +181,9 @@ Sends IPP requests to the specified URI and tests and/or displays the results.
 %patch2 -p1 -b .system-auth
 # Prevent multilib conflict in cups-config script.
 %patch3 -p1 -b .multilib
+# Apply patch to fix cupsSendRequest() race condition (bug #1072952,
+# STR #4386).
+%patch4 -p1 -b .str4386
 # Ignore rpm save/new files in the banners directory.
 %patch5 -p1 -b .banners
 # Use compatibility fallback path for ServerBin.
@@ -636,6 +640,10 @@ rm -f %{cups_serverbin}/backend/smb
 %{_mandir}/man5/ipptoolfile.5.gz
 
 %changelog
+* Fri May  9 2014 Tim Waugh <twaugh at redhat.com> - 1:1.7.2-2
+- Another attempt at avoiding race condition when sending IPP requests
+  (STR #4386, bug #1072952).
+
 * Mon Apr 14 2014 Jiri Popelka <jpopelka at redhat.com> - 1:1.7.2-1
 - 1.7.2
 


More information about the scm-commits mailing list