From 132ba052583201eb31a8f70e9357a9f0ec937f6c Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Tue, 13 May 2025 13:09:51 +0200 Subject: [PATCH] RHEL-77102 Cups images rotate 90 degrees when using browsed for printer sharing Resolves: RHEL-77102 --- browsed-ignore-NULL-attrs.patch | 31 +++++++++++++++++++++++++ cups-filters.spec | 41 ++++++++++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 browsed-ignore-NULL-attrs.patch diff --git a/browsed-ignore-NULL-attrs.patch b/browsed-ignore-NULL-attrs.patch new file mode 100644 index 0000000..a5cff9b --- /dev/null +++ b/browsed-ignore-NULL-attrs.patch @@ -0,0 +1,31 @@ +diff --git a/utils/cups-browsed.c b/utils/cups-browsed.c +index a6d6fd2..2fc063f 100644 +--- a/utils/cups-browsed.c ++++ b/utils/cups-browsed.c +@@ -2643,6 +2643,12 @@ record_printer_options(const char *printer) { + if (response) { + attr = ippFirstAttribute(response); + while (attr) { ++ if (ippGetValueTag(attr) == IPP_TAG_NOVALUE) ++ { ++ attr = ippNextAttribute(response); ++ continue; ++ } ++ + key = ippGetName(attr); + for (ptr = attrs_to_record; *ptr; ptr++) + if (strcasecmp(key, *ptr) == 0 || +@@ -2659,6 +2665,13 @@ record_printer_options(const char *printer) { + memmove(c, c + 1, strlen(c)); + if (*c) c ++; + } ++ ++ if (strlen(buf) == 0) ++ { ++ attr = ippNextAttribute(response); ++ continue; ++ } ++ + p->num_options = cupsAddOption(key, buf, p->num_options, + &(p->options)); + } diff --git a/cups-filters.spec b/cups-filters.spec index 34f0290..cd5de89 100644 --- a/cups-filters.spec +++ b/cups-filters.spec @@ -11,7 +11,7 @@ Summary: OpenPrinting CUPS filters and backends Name: cups-filters Version: 1.20.0 -Release: 35%{?dist} +Release: 36%{?dist} # For a breakdown of the licensing, see COPYING file # GPLv2: filters: commandto*, imagetoraster, pdftops, rasterto*, @@ -77,6 +77,8 @@ Patch20: 0001-pdftopdf-Fixed-printing-multiple-copies-on-driverles.patch Patch21: cups-filters-CVE-2024-47175.patch # CVE-2024-47076 cups-filters: `cfGetPrinterAttributes` API does not perform sanitization on returned IPP attributes Patch22: 0001-cfGetPrinterAttributes5-Validate-response-attributes.patch +# RHEL-77102 Cups images rotate 90 degrees when using browsed for printer sharing +Patch23: browsed-ignore-NULL-attrs.patch %if %{with braille} @@ -258,6 +260,8 @@ The package provides filters and cups-brf backend needed for braille printing. %patch21 -p1 -b .CVE-2024-47175 # CVE-2024-47076 cups-filters: `cfGetPrinterAttributes` API does not perform sanitization on returned IPP attributes %patch22 -p1 -b .CVE-2024-47076 +# RHEL-77102 Cups images rotate 90 degrees when using browsed for printer sharing +%patch23 -p1 -b .no-orientation %build @@ -359,6 +363,38 @@ fi %postun libs -p /sbin/ldconfig +%posttrans +if ls -lah /var/cache/cups/cups-browsed* &> /dev/null +then + BROWSED_ACTIVE="0" + CUPSD_ACTIVE="0" + + if systemctl is-active cups-browsed &> /dev/null + then + BROWSED_ACTIVE="1" + CUPSD_ACTIVE="1" + elif systemctl is-active cups &> /dev/null + then + CUPSD_ACTIVE="1" + fi + + if test "x$CUPSD_ACTIVE" = "x1" + then + systemctl stop cups + fi + + # RHEL-46785 - clean up recorded options to make the fix work + rm -rf /var/cache/cups/*.data /var/cache/cups/cups-browsed* &> /dev/null + + if test "x$BROWSED_ACTIVE" = "x1" + then + systemctl start cups-browsed + elif test "x$CUPSD_ACTIVE" = "x1" + then + systemctl start cups + fi +fi + %files %{_pkgdocdir}/README @@ -477,6 +513,9 @@ fi %endif %changelog +* Tue May 13 2025 Zdenek Dohnal - 1.20.0-36 +- RHEL-77102 Cups images rotate 90 degrees when using browsed for printer sharing + * Fri Sep 27 2024 Zdenek Dohnal - 1.20.0-35 - CVE-2024-47175 cups-filters: remote command injection via attacker controlled data in PPD file - CVE-2024-47076 cups-filters: `cfGetPrinterAttributes` API does not perform sanitization on returned IPP attributes