]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
scheduler: Tolerate devices breaking IPPEVE specs if possible 1054/head
authorZdenek Dohnal <zdohnal@redhat.com>
Wed, 18 Sep 2024 11:24:11 +0000 (13:24 +0200)
committerZdenek Dohnal <zdohnal@redhat.com>
Wed, 18 Sep 2024 11:24:11 +0000 (13:24 +0200)
Related to #1033

PPD generator currently is capable to bypass missing attribute
"media-col-database", if attributes "media-size-supported" or
"media-supported" are present.

Although such devices do not pass any IPP Everywhere or AirPrint
certifications, they exist in the wilderness.

scheduler/ipp.c

index 7215281ebf7abf9ea2442f97f5c7078a2d286cb7..caa07394528fb0a98435e0965d9c1b96eda2331a 100644 (file)
@@ -5319,7 +5319,7 @@ create_local_bg_thread(
   * try to get it separately
   */
 
-  if (ippFindAttribute(response, "media-col-database", IPP_TAG_ZERO) ==
+  if (ippFindAttribute(response, "media-col-database", IPP_TAG_BEGIN_COLLECTION) ==
       NULL)
   {
     ipp_t *response2;
@@ -5356,6 +5356,21 @@ create_local_bg_thread(
     }
   }
 
+  if (ippFindAttribute(response, "media-col-database", IPP_TAG_BEGIN_COLLECTION) == NULL
+      && ippFindAttribute(response, "media-supported", IPP_TAG_ZERO) == NULL
+      && ippFindAttribute(response, "media-size-supported", IPP_TAG_BEGIN_COLLECTION) == NULL)
+  {
+    cupsdLogMessage(CUPSD_LOG_ERROR, "The printer %s doesn't provide attributes \"media-col-database\", \"media-size-supported\" or \"media-supported\" required for generating printer capabilities.", printer->name);
+
+    /* Force printer to timeout and be deleted */
+    cupsRWLockWrite(&printer->lock);
+    printer->state_time = 0;
+    cupsRWUnlock(&printer->lock);
+
+    send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("The printer %s does not provide attributes required for IPP Everywhere."), printer->name);
+    goto finish_response;
+  }
+
   // Validate response from printer...
   if (!ippValidateAttributes(response))
   {