From: Michael R Sweet Date: Mon, 22 Jun 2026 18:38:12 +0000 (-0400) Subject: Mirror temporary device URI changes from 2.4.x. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=22dfe4333fd65a8dd7f25c04f778dbf2e177bf3d;p=thirdparty%2Fcups.git Mirror temporary device URI changes from 2.4.x. --- diff --git a/cups/dest.c b/cups/dest.c index d729ae2b8c..a84a9e2d2a 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -2748,6 +2748,7 @@ cups_dest_query_cb( uri[1024]; // Printer URI cups_ptype_t type = CUPS_PTYPE_DISCOVERED | CUPS_PTYPE_BW; // Printer type + const char *uuid; // Printer UUID bool saw_printer_type = false; // Did we see a printer-type key? @@ -2855,6 +2856,8 @@ cups_dest_query_cb( int i; // Looping var cups_dest_t *local; // Local printer + device->dest.num_options = cupsAddOption("UUID", value, device->dest.num_options,&device->dest.options); + for (i = data->num_local, local = data->local_dests; i > 0; i --, local ++) { const char *local_uuid = cupsGetOption("printer-uuid", local->num_options, local->options); @@ -2955,7 +2958,10 @@ cups_dest_query_cb( // Save the URI... cups_dnssd_unquote(uriname, device->fullname, sizeof(uriname)); - httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), !strcmp(device->regtype, "_ipps._tcp") ? "ipps" : "ipp", NULL, uriname, 0, saw_printer_type ? "/cups" : "/"); + if ((uuid = cupsGetOption("UUID", device->dest.num_options, device->dest.options)) != NULL) + httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "dnssd", NULL, uriname, 0, saw_printer_type ? "/cups?uuid=%s" : "/?uuid=%s", uuid); + else + httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), "dnssd", NULL, uriname, 0, saw_printer_type ? "/cups" : "/"); DEBUG_printf("6cups_dnssd_query: device-uri=\"%s\"", uri); diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 2fba295dc1..dfe94ccaaf 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -5483,7 +5483,8 @@ create_local_printer( char name[128], /* Sanitized printer name */ *nameptr, /* Pointer into name */ uri[1024]; /* printer-uri-supported value */ - const char *ptr; /* Pointer into attribute value */ + const char *ptr, /* Pointer into attribute value */ + *device_uri_ptr; /* Pointer into device URI */ char scheme[HTTP_MAX_URI], /* Scheme portion of URI */ userpass[HTTP_MAX_URI], /* Username portion of URI */ host[HTTP_MAX_URI], /* Host portion of URI */ @@ -5553,9 +5554,9 @@ create_local_printer( return; } - ptr = ippGetString(device_uri, 0, NULL); + device_uri_ptr = ippGetString(device_uri, 0, NULL); - if (!ptr || !ptr[0] || (strncmp(ptr, "ipp://", 6) && strncmp(ptr, "ipps://", 7))) + 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))) { send_ipp_status(con, IPP_STATUS_ERROR_NOT_POSSIBLE, _("Bad device-uri \"%s\"."), ptr); @@ -5579,7 +5580,7 @@ create_local_printer( for (printer = (cupsd_printer_t *)cupsArrayGetFirst(Printers); printer; printer = (cupsd_printer_t *)cupsArrayGetNext(Printers)) { - if (printer->device_uri && !strcmp(ptr, printer->device_uri)) + if (printer->device_uri && !strcmp(device_uri_ptr, printer->device_uri)) { printer->state_time = time(NULL); send_ipp_status(con, IPP_STATUS_OK, _("Printer \"%s\" already exists."), printer->name);