]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Don't stop a printer after a job is canceled/aborted (Issue #5517)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 21 Feb 2019 15:44:23 +0000 (10:44 -0500)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 21 Feb 2019 15:44:23 +0000 (10:44 -0500)
CHANGES.md
backend/ipp.c
scheduler/job.c

index 0cf54d6166b9d9759a09c799bb815b0dcaefd375..c66ca2054c4125aa6126c33c8153b1ddd748983c 100644 (file)
@@ -21,6 +21,8 @@ Changes in CUPS v2.2.11
 - The `ippValidateAttribute` function did not catch all instances of invalid
   UTF-8 strings (Issue #5509)
 - Non-Kerberized printing to Windows via IPP was broken (Issue #5515)
+- The scheduler no longer stops a printer if an error occurs when a job is
+  canceled or aborted (Issue #5517)
 - Added a USB quirks rule for the DYMO 450 Turbo (Issue #5521)
 - Added a USB quirks rule for Xerox printers (Issue #5523)
 - The scheduler's self-signed certificate did not include all of the alternate
index f14a44e66bb7db92c9276c5d8376fc9377bcc96b..c364e19788db35ec7c253b90ab14e9c72163749c 100644 (file)
@@ -2217,8 +2217,9 @@ 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 (ipp_status == IPP_STATUS_ERROR_NOT_AUTHORIZED || ipp_status == IPP_STATUS_ERROR_FORBIDDEN ||
-      ipp_status == IPP_STATUS_ERROR_CUPS_AUTHENTICATION_CANCELED)
+  if (job_canceled)
+    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);
   else if (ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_LIMIT_REACHED ||
           ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_INFO_NEEDED ||
index 638f256db06383fd9954c643546ac2bdf8b82299..8f212f6f400125fc42a8f62cad8fce5c45825903 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Job management routines for the CUPS scheduler.
  *
- * Copyright 2007-2018 by Apple Inc.
+ * Copyright 2007-2019 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  * These coded instructions, statements, and computer programs are the
@@ -3442,6 +3442,12 @@ finalize_job(cupsd_job_t *job,           /* I - Job */
          * Stop the printer...
          */
 
+          if (job_state == IPP_JSTATE_CANCELED || job_state == IPP_JSTATE_ABORTED)
+          {
+            cupsdLogJob(job, CUPSD_LOG_INFO, "Ignored STOP from backend since the job is %s.", job_state == IPP_JSTATE_CANCELED ? "canceled" : "aborted");
+            break;
+         }
+
          printer_state = IPP_PRINTER_STOPPED;
 
          if (ErrorLog)
@@ -3456,8 +3462,7 @@ finalize_job(cupsd_job_t *job,            /* I - Job */
          {
            job_state = IPP_JOB_PENDING;
 
-           ippSetString(job->attrs, &job->reasons, 0,
-                        "resources-are-not-ready");
+           ippSetString(job->attrs, &job->reasons, 0, "resources-are-not-ready");
          }
           break;