]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
scheduler: Fix applying print-as-raster default
authorZdenek Dohnal <zdohnal@redhat.com>
Tue, 23 Sep 2025 06:51:14 +0000 (08:51 +0200)
committerZdenek Dohnal <zdohnal@redhat.com>
Tue, 23 Sep 2025 06:51:14 +0000 (08:51 +0200)
Currently, the default was applied only when present in the request,
which is how `lp` behaves. However the application does not have to
include defaults in the request, so we have to apply it in scheduler.

Additionally, this covers a case when print-as-raster is set by default,
but we want to disable it in a specific request.

scheduler/ipp.c

index 2f104cc67109e02cce7fb5b0b923d4e4eee63b96..174871741b68438c8247cf4a74d6b8c9a40828fd 100644 (file)
@@ -1514,8 +1514,6 @@ add_job(cupsd_client_t  *con,             /* I - Client connection */
     ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "job-name", NULL, "Untitled");
   }
 
-  attr = ippFindAttribute(con->request, "requesting-user-name", IPP_TAG_NAME);
-
   if ((job = cupsdAddJob(priority, printer->name)) == NULL)
   {
     send_ipp_status(con, IPP_INTERNAL_ERROR,
@@ -1524,8 +1522,19 @@ add_job(cupsd_client_t  *con,            /* I - Client connection */
     return (NULL);
   }
 
-  if (ippGetBoolean(ippFindAttribute(con->request, "print-as-raster", IPP_TAG_BOOLEAN), 0))
-    job->print_as_raster = 1;
+  if ((attr = ippFindAttribute(con->request, "print-as-raster", IPP_TAG_BOOLEAN)) != NULL)
+  {
+    if (ippGetBoolean(attr, 0))
+      job->print_as_raster = 1;
+  }
+  else
+  {
+    if (cupsGetOption("print-as-raster", printer->num_options,
+                     printer->options) != NULL)
+      job->print_as_raster = 1;
+  }
+
+  attr = ippFindAttribute(con->request, "requesting-user-name", IPP_TAG_NAME);
 
   job->dtype   = printer->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_REMOTE);
   job->attrs   = con->request;