]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Support ippeveprinter -f option with -a (Issue #759)
authorMichael R Sweet <msweet@msweet.org>
Fri, 5 Apr 2024 20:34:05 +0000 (16:34 -0400)
committerMichael R Sweet <msweet@msweet.org>
Fri, 5 Apr 2024 20:34:05 +0000 (16:34 -0400)
CHANGES.md
tools/ippeveprinter.c

index f50d3b0a1ae1a427df39db6cee418575714e0b8f..24b250f14e7cd0ed43b5b94a09dad39bdf2ecd1c 100644 (file)
@@ -35,6 +35,8 @@ Changes in CUPS v2.5b1 (TBA)
 - Updated the "get-printer-attributes-suite.test" test file (Issue #909)
 - Updated `cupsRasterReadPixels` and `cupsRasterWritePixels` to not try reading
   or writing if the number of bytes passed is 0 (Issue #914)
+- The `ippeveprinter` program now supports the `-f` option with `-a`
+  (Issue #759)
 - Fixed use-after-free in `cupsdAcceptClient()` when we log warning during error
   handling (fixes CVE-2023-34241)
 - Fixed hanging of `lpstat` on Solaris (Issue #156)
index 7629112a174713110ff996954c56ea477c7b1ebd..9afa643a8fe4ad39ed6910618474699372ec16a3 100644 (file)
@@ -480,7 +480,6 @@ main(int  argc,                             // I - Number of command-line args
                usage(1);
 
              docformats = cupsArrayNewStrings(argv[i], ',');
-             legacy     = true;
              break;
 
          case 'i' : // -i icon.png
@@ -1684,13 +1683,17 @@ create_printer(
 
   if (docformats)
   {
+    ipp_attribute_t    *attr;          // Attribute
+
     // document-format-default
     if (!ippFindAttribute(printer->attrs, "document-format-default", IPP_TAG_MIMETYPE))
       ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_MIMETYPE), "document-format-default", NULL, "application/octet-stream");
 
     // document-format-supported
-    if (!ippFindAttribute(printer->attrs, "document-format-supported", IPP_TAG_MIMETYPE))
-      ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_MIMETYPE, "document-format-supported", num_formats, NULL, formats);
+    if ((attr = ippFindAttribute(printer->attrs, "document-format-supported", IPP_TAG_MIMETYPE)) != NULL)
+      ippDeleteAttribute(printer->attrs, attr);
+
+    ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_MIMETYPE, "document-format-supported", num_formats, NULL, formats);
   }
 
   // generated-natural-language-supported