]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
scheduler/printers.c: Add warning when loading printers 286/head
authorZdenek Dohnal <zdohnal@redhat.com>
Thu, 11 Nov 2021 08:14:44 +0000 (09:14 +0100)
committerZdenek Dohnal <zdohnal@redhat.com>
Thu, 11 Nov 2021 08:14:44 +0000 (09:14 +0100)
Since drivers and raw queues going are deprecated and going to be
removed, this change will introduce a warning during cupsd's start.

This way we have all print queue installation options covered - lpadmin
and web ui were enhanced with warning in the past.

scheduler/printers.c

index 6dcad8d30fd107fe6b0f60c7de50021ce37bc0f6..6cc5f79b47453d6ef9921dd7849321fb74e90c3c 100644 (file)
@@ -944,6 +944,8 @@ cupsdLoadAllPrinters(void)
                        *value,         /* Pointer to value */
                        *valueptr;      /* Pointer into value */
   cupsd_printer_t      *p;             /* Current printer */
+  int                  found_raw = 0;          /* Flag whether raw queue is installed */
+  int                  found_driver = 0;               /* Flag whether queue with classic driver is installed */
 
 
  /*
@@ -1019,6 +1021,30 @@ cupsdLoadAllPrinters(void)
 
         cupsdSetPrinterAttrs(p);
 
+       if ((p->device_uri && strncmp(p->device_uri, "ipp:", 4) && strncmp(p->device_uri, "ipps:", 5) && strncmp(p->device_uri, "implicitclass:", 14)) ||
+           !p->make_model ||
+           (p->make_model && strstr(p->make_model, "IPP Everywhere") == NULL && strstr(p->make_model, "driverless") == NULL))
+       {
+        /*
+         * Warn users about printer drivers and raw queues will be deprecated.
+         * It will warn users in the following scenarios:
+         * - the queue doesn't use ipp, ipps or implicitclass backend, which means
+         *   it doesn't communicate via IPP and is raw or uses a driver for sure
+         * - the queue doesn't have make_model - it is raw
+         * - the queue uses a correct backend, but the model is not IPP Everywhere/driverless
+         */
+         if (!p->make_model)
+         {
+           cupsdLogMessage(CUPSD_LOG_DEBUG, "Queue %s is a raw queue, which is deprecated.", p->name);
+           found_raw = 1;
+         }
+         else
+         {
+           cupsdLogMessage(CUPSD_LOG_DEBUG, "Queue %s uses a printer driver, which is deprecated.", p->name);
+           found_driver = 1;
+         }
+       }
+
         if (strncmp(p->device_uri, "file:", 5) && p->state != IPP_PRINTER_STOPPED)
        {
         /*
@@ -1409,6 +1435,12 @@ cupsdLoadAllPrinters(void)
     }
   }
 
+  if (found_raw)
+    cupsdLogMessage(CUPSD_LOG_WARN, "Raw queues are deprecated and will stop working in a future version of CUPS. See https://github.com/OpenPrinting/cups/issues/103");
+
+  if (found_driver)
+    cupsdLogMessage(CUPSD_LOG_WARN, "Printer drivers are deprecated and will stop working in a future version of CUPS. See https://github.com/OpenPrinting/cups/issues/103");
+
   cupsFileClose(fp);
 }