From: Michael R Sweet Date: Fri, 5 Apr 2024 20:34:05 +0000 (-0400) Subject: Support ippeveprinter -f option with -a (Issue #759) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c8a3657c16848ecaec7c6c85bfe36973148f986;p=thirdparty%2Fcups.git Support ippeveprinter -f option with -a (Issue #759) --- diff --git a/CHANGES.md b/CHANGES.md index f50d3b0a1a..24b250f14e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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) diff --git a/tools/ippeveprinter.c b/tools/ippeveprinter.c index 7629112a17..9afa643a8f 100644 --- a/tools/ippeveprinter.c +++ b/tools/ippeveprinter.c @@ -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