]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
scheduler: Fix applying print-as-raster default 1369/head
authorZdenek Dohnal <zdohnal@redhat.com>
Mon, 22 Sep 2025 12:33:45 +0000 (14:33 +0200)
committerZdenek Dohnal <zdohnal@redhat.com>
Mon, 22 Sep 2025 12:33:45 +0000 (14:33 +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 64db4b70fd688a8b10d32f304aab5560f76e53f9..fa822603b0492c35929a4fa3e5bee5b1a92e3c6a 100644 (file)
@@ -1507,8 +1507,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_STATUS_ERROR_INTERNAL,
@@ -1517,8 +1515,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_PTYPE_CLASS | CUPS_PTYPE_REMOTE);
   job->attrs   = con->request;