diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2014-05-09 20:20:16 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2014-05-09 20:20:16 +0000 |
commit | 88a988667704a4042ea9c4c678912696bb96d3e7 (patch) | |
tree | d7462243e3e838361eb1481a14cbb992d41f65ae /cups/request.c | |
parent | 651e0a226e22d9dc11759d0caf023337a37362de (diff) | |
download | cups-88a988667704a4042ea9c4c678912696bb96d3e7.tar.gz |
Fix an authentication race condition in cupsSendRequest (STR #4403)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11866 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'cups/request.c')
-rw-r--r-- | cups/request.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/cups/request.c b/cups/request.c index 3ee1da04c..881bffd5b 100644 --- a/cups/request.c +++ b/cups/request.c @@ -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); + } } /* |