Skip to content

Commit

Permalink
libcups: Don't overwrite permanent queue with network during discovery
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zdohnal committed Dec 18, 2024
1 parent c76b026 commit 3e05eee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/`)
Expand Down
12 changes: 10 additions & 2 deletions cups/dest.c
Original file line number Diff line number Diff line change
Expand Up @@ -3521,6 +3521,10 @@ cups_get_cb(_cups_getdata_t *data, // I - Data from cupsGetDests
unsigned flags, // I - Enumeration flags
cups_dest_t *dest) // I - Destination
{
int diff = 1, // Result of comparison
match; // Matching index


if (flags & CUPS_DEST_FLAGS_REMOVED)
{
/*
Expand All @@ -3532,10 +3536,14 @@ cups_get_cb(_cups_getdata_t *data, // I - Data from cupsGetDests
else
{
/*
* Add destination to array...
* Add destination to array if not present already...
*/

data->num_dests = cupsCopyDest(dest, data->num_dests, &data->dests);
if (data->num_dests)
match = cups_find_dest(dest->name, dest->instance, data->num_dests, data->dests, -1, &diff);

if (diff)
data->num_dests = cupsCopyDest(dest, data->num_dests, &data->dests);
}

return (1);
Expand Down

0 comments on commit 3e05eee

Please sign in to comment.