import UBI cups-filters-1.20.0-34.el8

This commit is contained in:
eabdullin 2024-05-22 13:30:44 +00:00
parent d398e429d7
commit d3b7a6e2e5
3 changed files with 114 additions and 4 deletions

View File

@ -0,0 +1,46 @@
diff --git a/filter/gstoraster.c b/filter/gstoraster.c
index 0c9f37d..820acc8 100644
--- a/filter/gstoraster.c
+++ b/filter/gstoraster.c
@@ -73,29 +73,23 @@ static GsDocType
parse_doc_type(FILE *fp)
{
char buf[5];
- GsDocType doc_type;
- char *rc;
+ GsDocType type = GS_DOC_TYPE_UNKNOWN;
/* get the first few bytes of the file */
- doc_type = GS_DOC_TYPE_UNKNOWN;
rewind(fp);
- rc = fgets(buf,sizeof(buf),fp);
- if (rc == NULL)
- goto out;
-
- /* is PDF */
- if (strncmp(buf,"%PDF",4) == 0) {
- doc_type = GS_DOC_TYPE_PDF;
- goto out;
+/* skip until PDF/PS start header */
+ while (fgets(buf, sizeof(buf), fp) != 0) {
+ if (strncmp(buf, "%PDF", 4) == 0)
+ type = GS_DOC_TYPE_PDF;
+ if (strncmp(buf, "%!", 2) == 0)
+ type = GS_DOC_TYPE_PS;
+ if (type != GS_DOC_TYPE_UNKNOWN)
+ break;
}
- /* is PS */
- if (strncmp(buf,"%!",2) == 0) {
- doc_type = GS_DOC_TYPE_PS;
- goto out;
- }
-out:
- return doc_type;
+ rewind(fp);
+
+ return (type);
}
static void

View File

@ -0,0 +1,49 @@
From a07a43f885a4a7186310639b214c499e09e453c5 Mon Sep 17 00:00:00 2001
From: Till Kamppeter <till.kamppeter@gmail.com>
Date: Tue, 13 Nov 2018 13:04:59 +0100
Subject: [PATCH] pdftopdf: Fixed printing multiple copies on driverless IPP
printers.
---
NEWS | 4 ++++
filter/pdftopdf/pdftopdf.cc | 24 +++++++++++++++++++-----
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/filter/pdftopdf/pdftopdf.cc b/filter/pdftopdf/pdftopdf.cc
index f474f08c6..880b664fd 100644
--- a/filter/pdftopdf/pdftopdf.cc
+++ b/filter/pdftopdf/pdftopdf.cc
@@ -783,11 +783,25 @@ void calculate(ppd_file_t *ppd,ProcessingParameters &param) // {{{
} else if ((ppd)&&(!ppd->manual_copies)) { // hw copy generation available
param.deviceCopies=param.numCopies;
if (param.collate) { // collate requested by user
- // check collate device, with current/final(!) ppd settings
- param.deviceCollate=printerWillCollate(ppd);
- if (!param.deviceCollate) {
- // printer can't hw collate -> we must copy collated in sw
- param.deviceCopies=1;
+ // Check output format (FINAL_CONTENT_TYPE env variable) whether it is
+ // of a driverless IPP printer (PDF, Apple Raster, PWG Raster, PCLm).
+ // These printers do always hardware collate if they do hardware copies.
+ // https://github.com/apple/cups/issues/5433
+ char *final_content_type = getenv("FINAL_CONTENT_TYPE");
+ if (final_content_type &&
+ (strcasestr(final_content_type, "/pdf") ||
+ strcasestr(final_content_type, "/vnd.cups-pdf") ||
+ strcasestr(final_content_type, "/pwg-raster") ||
+ strcasestr(final_content_type, "/urf") ||
+ strcasestr(final_content_type, "/PCLm"))) {
+ param.deviceCollate = true;
+ } else {
+ // check collate device, with current/final(!) ppd settings
+ param.deviceCollate=printerWillCollate(ppd);
+ if (!param.deviceCollate) {
+ // printer can't hw collate -> we must copy collated in sw
+ param.deviceCopies=1;
+ }
}
} // else: printer copies w/o collate and takes care of duplex/evenDuplex
} else { // sw copies
--
2.43.0

View File

@ -11,7 +11,7 @@
Summary: OpenPrinting CUPS filters and backends
Name: cups-filters
Version: 1.20.0
Release: 32%{?dist}
Release: 34%{?dist}
# For a breakdown of the licensing, see COPYING file
# GPLv2: filters: commandto*, imagetoraster, pdftops, rasterto*,
@ -69,6 +69,11 @@ Patch16: 0001-libcupsfilters-Fix-page-range-like-10-in-pdftopdf-fi.patch
Patch17: gstoraster-margins.patch
# CVE-2023-24805 cups-filters: remote code execution in cups-filters, beh CUPS backend
Patch18: beh-cve2023.patch
# RHEL-19433 Incorrect PS header handling in gstopdf
Patch19: 0001-gstoraster-Improved-detection-whether-input-is-PostS.patch
# RHEL-16034 pdftopdf results with (N > 1)^2 copies if a file is sent to IPP printer with collate
Patch20: 0001-pdftopdf-Fixed-printing-multiple-copies-on-driverles.patch
%if %{with braille}
Recommends: %{name}-braille%{?_isa} = %{version}-%{release}
@ -140,14 +145,12 @@ Requires: bc grep sed which
# cups-browsed
# it needs cups.service for running
Requires: cups
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
# recommends avahi and cups-ipptool - it is needed for driverless support,
# recommends cups-ipptool - it is needed for driverless support,
# but it is useless for older devices and cups servers
Recommends: avahi
Recommends: cups-ipptool
# older installations can still have ghostscript-cups and foomatic-filters
@ -243,6 +246,10 @@ The package provides filters and cups-brf backend needed for braille printing.
%patch17 -p1 -b .margins
# CVE-2023-24805 cups-filters: remote code execution in cups-filters, beh CUPS backend
%patch18 -p1 -b .cve202324805
# RHEL-19433 Incorrect PS header handling in gstopdf
%patch19 -p1 -b .gstoraster-psdetect
# RHEL-16034 pdftopdf results with (N > 1)^2 copies if a file is sent to IPP printer with collate
%patch20 -p1 -b .pdftopdf-ncopies
%build
@ -453,6 +460,14 @@ make check
%endif
%changelog
* Mon Feb 26 2024 Zdenek Dohnal <zdohnal@redhat.com> - 1.20.0-34
- RHEL-13211 redhat-lsb unnecessary pulls in cups and avahi dependencies
* Tue Dec 19 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1.20.0-33
- RHEL-19433 Incorrect PS header handling in gstopdf
- RHEL-16034 pdftopdf results with (N > 1)^2 copies if a file is sent to IPP printer with collate
- RHEL-13211 redhat-lsb unnecessary pulls in cups and avahi dependencies
* Tue Aug 08 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1.20.0-32
- 2118406 - texttotext filter strips ESC causing PCL files to be printed improperly