]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
backend/ipp: Change handling of job_canceled 74/head
authorSean Kau <skau@chromium.org>
Thu, 17 Dec 2020 19:04:59 +0000 (11:04 -0800)
committerPranav Batra <batrapranav@chromium.org>
Wed, 13 Jan 2021 23:24:31 +0000 (23:24 +0000)
job_canceled can be -1, 0, or 1. 0 indicates no error, 1 indicates
that we were cancelled in normal operations (user cancelled from
computer) and -1 indicates cancelled by printer.  There is clearly
an assumption that -1 is false since there is a check for
job_canceled < 0 a few lines later.

BUG=b:174793115
TEST=Print to printer with malformed PWG-Raster content

Change-Id: I88f504d00e0680507cd439b633c6c288cf7c5390

backend/ipp.c

index 521c0390cc458b8d68d30a388d171b9aa8ea5706..8b1976990dbb148027b9a5ce62eda72af2a73ff5 100644 (file)
@@ -2240,7 +2240,8 @@ main(int  argc,                           /* I - Number of command-line args */
   else if (ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_AUTHORIZATION_FAILED)
     fputs("JOBSTATE: account-authorization-failed\n", stderr);
 
-  if (job_canceled)
+  // job_canceled can be -1 which should not be treated as CUPS_BACKEND_OK
+  if (job_canceled > 0)
     return (CUPS_BACKEND_OK);
   else if (ipp_status == IPP_STATUS_ERROR_NOT_AUTHORIZED || ipp_status == IPP_STATUS_ERROR_FORBIDDEN || ipp_status == IPP_STATUS_ERROR_CUPS_AUTHENTICATION_CANCELED)
     return (CUPS_BACKEND_AUTH_REQUIRED);