Skip to content

Commit

Permalink
Add a temporary queue before setting the defaults for lpoptions (Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Sep 20, 2024
1 parent 96a330d commit 141153e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changes in CUPS v2.4.11 (YYYY-MM-DD)
------------------------------------

- Updated the maximum file descriptor limit for `cupsd` to 64k-1 (Issue #989)
- Fixed `lpoptions -d` with a discovered but not added printer (Issue #833)
- Fixed incorrect error message for HTTP/IPP errors (Issue #893)
- Fixed JobPrivateAccess and SubscriptionPrivateAccess support for "all"
(Issue #990)
Expand Down
29 changes: 29 additions & 0 deletions cups/dest.c
Original file line number Diff line number Diff line change
Expand Up @@ -2058,6 +2058,35 @@ cupsSetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
if (!num_dests || !dests)
return (-1);

/*
* See if the default destination has a printer URI associated with it...
*/

if ((dest = cupsGetDest(/*name*/NULL, /*instance*/NULL, num_dests, dests)) != NULL && !cupsGetOption("printer-uri-supported", dest->num_options, dest->options))
{
/*
* No, try adding it...
*/

const char *uri; /* Device/printer URI */

if ((uri = cupsGetOption("device-uri", dest->num_options, dest->options)) != NULL)
{
char tempresource[1024]; /* Temporary resource path */

#ifdef HAVE_DNSSD
if (strstr(uri, "._tcp"))
uri = cups_dnssd_resolve(dest, uri, /*msec*/30000, /*cancel*/NULL, /*cb*/NULL, /*user_data*/NULL);
#endif /* HAVE_DNSSD */

if (uri)
uri = _cupsCreateDest(dest->name, cupsGetOption("printer-info", dest->num_options, dest->options), NULL, uri, tempresource, sizeof(tempresource));

if (uri)
dest->num_options = cupsAddOption("printer-uri-supported", uri, dest->num_options, &dest->options);
}
}

/*
* Get the server destinations...
*/
Expand Down

0 comments on commit 141153e

Please sign in to comment.