Skip to content

Commit 22dfe43

Browse files
committed
Mirror temporary device URI changes from 2.4.x.
1 parent 0b3709e commit 22dfe43

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

cups/dest.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2748,6 +2748,7 @@ cups_dest_query_cb(
27482748
uri[1024]; // Printer URI
27492749
cups_ptype_t type = CUPS_PTYPE_DISCOVERED | CUPS_PTYPE_BW;
27502750
// Printer type
2751+
const char *uuid; // Printer UUID
27512752
bool saw_printer_type = false;
27522753
// Did we see a printer-type key?
27532754

@@ -2855,6 +2856,8 @@ cups_dest_query_cb(
28552856
int i; // Looping var
28562857
cups_dest_t *local; // Local printer
28572858

2859+
device->dest.num_options = cupsAddOption("UUID", value, device->dest.num_options,&device->dest.options);
2860+
28582861
for (i = data->num_local, local = data->local_dests; i > 0; i --, local ++)
28592862
{
28602863
const char *local_uuid = cupsGetOption("printer-uuid", local->num_options, local->options);
@@ -2955,7 +2958,10 @@ cups_dest_query_cb(
29552958

29562959
// Save the URI...
29572960
cups_dnssd_unquote(uriname, device->fullname, sizeof(uriname));
2958-
httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), !strcmp(device->regtype, "_ipps._tcp") ? "ipps" : "ipp", NULL, uriname, 0, saw_printer_type ? "/cups" : "/");
2961+
if ((uuid = cupsGetOption("UUID", device->dest.num_options, device->dest.options)) != NULL)
2962+
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "dnssd", NULL, uriname, 0, saw_printer_type ? "/cups?uuid=%s" : "/?uuid=%s", uuid);
2963+
else
2964+
httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), "dnssd", NULL, uriname, 0, saw_printer_type ? "/cups" : "/");
29592965

29602966
DEBUG_printf("6cups_dnssd_query: device-uri=\"%s\"", uri);
29612967

scheduler/ipp.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5483,7 +5483,8 @@ create_local_printer(
54835483
char name[128], /* Sanitized printer name */
54845484
*nameptr, /* Pointer into name */
54855485
uri[1024]; /* printer-uri-supported value */
5486-
const char *ptr; /* Pointer into attribute value */
5486+
const char *ptr, /* Pointer into attribute value */
5487+
*device_uri_ptr; /* Pointer into device URI */
54875488
char scheme[HTTP_MAX_URI], /* Scheme portion of URI */
54885489
userpass[HTTP_MAX_URI], /* Username portion of URI */
54895490
host[HTTP_MAX_URI], /* Host portion of URI */
@@ -5553,9 +5554,9 @@ create_local_printer(
55535554
return;
55545555
}
55555556

5556-
ptr = ippGetString(device_uri, 0, NULL);
5557+
device_uri_ptr = ippGetString(device_uri, 0, NULL);
55575558

5558-
if (!ptr || !ptr[0] || (strncmp(ptr, "ipp://", 6) && strncmp(ptr, "ipps://", 7)))
5559+
if (!device_uri_ptr || !device_uri_ptr[0] || (strncmp(device_uri_ptr, "dnssd://", 8) && strncmp(device_uri_ptr, "ipp://", 6) && strncmp(device_uri_ptr, "ipps://", 7)))
55595560
{
55605561
send_ipp_status(con, IPP_STATUS_ERROR_NOT_POSSIBLE, _("Bad device-uri \"%s\"."), ptr);
55615562

@@ -5579,7 +5580,7 @@ create_local_printer(
55795580

55805581
for (printer = (cupsd_printer_t *)cupsArrayGetFirst(Printers); printer; printer = (cupsd_printer_t *)cupsArrayGetNext(Printers))
55815582
{
5582-
if (printer->device_uri && !strcmp(ptr, printer->device_uri))
5583+
if (printer->device_uri && !strcmp(device_uri_ptr, printer->device_uri))
55835584
{
55845585
printer->state_time = time(NULL);
55855586
send_ipp_status(con, IPP_STATUS_OK, _("Printer \"%s\" already exists."), printer->name);

0 commit comments

Comments
 (0)