]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
libcups: Don't overwrite permanent queue with network during discovery
authorZdenek Dohnal <zdohnal@redhat.com>
Thu, 19 Dec 2024 11:55:53 +0000 (12:55 +0100)
committerZdenek Dohnal <zdohnal@redhat.com>
Thu, 19 Dec 2024 11:55:53 +0000 (12:55 +0100)
Currently, if there is a permanent queue of the same name as network
discovered printer, the network one is written in `lpstat -l -e` output.
This is confusing to users and maintainers, because if print job is
sent, it comes to the permanent one instead of listed network/temporary,
which can have a different connection or PPD.

This behavior happens when user creates manually a queue with the same
name as the temporary one, or when the permanent queue is created by
cups-browsed. In both cases user realizes he prints into a different
queue once he enables debugging and see printer-uri in logs.

CHANGES.md
cups/dest.c

index 5d3c7eae05e54bd17454bd82ec0245c0bf880489..305c71d7a0f10f17650db7b5e499e4efb7622a10 100644 (file)
@@ -126,6 +126,8 @@ Changes in CUPS v2.5b1 (YYYY-MM-DD)
 - Fixed error handling when reading a mixed `1setOf` attribute.
 - Fixed how `ippeveprinter` responds to an unsupported request character set.
 - Fixed a recursion issue in `ippReadIO`.
+- Fixed verbose listing of `lpstat -l -e` when permanent queue has the same name
+  as network discovered.
 - Removed hash support for SHA2-512-224 and SHA2-512-256.
 - Removed `mantohtml` script for generating html pages (use
   `https://www.msweet.org/mantohtml/`)
index f0067100a60451de8ad0e8ce82eab4a422158999..a69f8dc848a881fb1b86520800fa1f7c2f179cf5 100644 (file)
@@ -3529,10 +3529,10 @@ cups_get_cb(_cups_getdata_t *data,      // I - Data from cupsGetDests
 
     data->num_dests = cupsRemoveDest(dest->name, dest->instance, data->num_dests, &data->dests);
   }
-  else
+  else if (!cupsGetDest(dest->name, dest->instance, data->num_dests, data->dests))
   {
    /*
-    * Add destination to array...
+    * Add destination to array if not already present...
     */
 
     data->num_dests = cupsCopyDest(dest, data->num_dests, &data->dests);