]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror temporary device URI changes from 2.4.x.
authorMichael R Sweet <msweet@msweet.org>
Mon, 22 Jun 2026 18:38:12 +0000 (14:38 -0400)
committerMichael R Sweet <msweet@msweet.org>
Mon, 22 Jun 2026 18:38:12 +0000 (14:38 -0400)
cups/dest.c
scheduler/ipp.c

index d729ae2b8c9d5f7b6f28da4b07dc8180889349f9..a84a9e2d2a46a3e1feac27b49fc47b7885719d44 100644 (file)
@@ -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);
 
index 2fba295dc12d624c4b3de252f916c28b656bd49a..dfe94ccaaf4ee11edc38ff2cffc52fc1428adc26 100644 (file)
@@ -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);