]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix an authentication race condition in cupsSendRequest (STR #4403)
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 9 May 2014 20:20:16 +0000 (20:20 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Fri, 9 May 2014 20:20:16 +0000 (20:20 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11866 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES-1.7.txt
cups/request.c

index 538c9d7afb8e0639ac7ce092de368e00e5b3a3a5..d1880c3ab33f9afbb297348228ac73c24cae8e3f 100644 (file)
@@ -11,6 +11,7 @@ CHANGES IN CUPS V1.7.3
          CUPS_HTTP_DEFAULT (<rdar://problem/16762593>)
        - The IPP backend did not abort a job when the printer did not validate
          the supplied options (<rdar://problem/16836752>)
+       - Fixed an authentication race condition in cupsSendRequest (STR #4403)
 
 
 CHANGES IN CUPS V1.7.2
index 3ee1da04ca24fad5877d72fb4b4a2809691787fe..881bffd5b929c42776b2f35358a8bd67532f724c 100644 (file)
@@ -747,9 +747,8 @@ cupsSendRequest(http_t     *http,   /* I - Connection to server or @code CUPS_HTTP
     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;
 
@@ -757,15 +756,30 @@ cupsSendRequest(http_t     *http, /* I - Connection to server or @code CUPS_HTTP
        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 a HTTP
+      * error status?
+      */
 
-      http->status = HTTP_STATUS_ERROR;
-      http->state  = HTTP_STATE_WAITING;
+      if (!got_status || status < HTTP_STATUS_MULTIPLE_CHOICES)
+      {
+       /*
+        * No, something else went wrong.
+       */
 
-      return (HTTP_STATUS_ERROR);
+       DEBUG_puts("1cupsSendRequest: Unable to send IPP request.");
+
+       http->status = HTTP_STATUS_ERROR;
+       http->state  = HTTP_STATE_WAITING;
+
+       return (HTTP_STATUS_ERROR);
+      }
     }
 
    /*