From 9b19d8b26c740ca1cc1a7c30095fc7cd484760d3 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Thu, 11 Nov 2021 09:14:44 +0100 Subject: [PATCH] scheduler/printers.c: Add warning when loading printers 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 | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/scheduler/printers.c b/scheduler/printers.c index 6dcad8d30f..6cc5f79b47 100644 --- a/scheduler/printers.c +++ b/scheduler/printers.c @@ -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); } -- 2.47.2