From c111351f8b9ad2de0291998ad2473e2d6d7f6a14 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Tue, 6 Aug 2024 13:27:20 +0200 Subject: [PATCH] RHEL-46785 Cups browsing with 'Autoclustering on' in RHEL 9 cannot find printer clusters for HA Resolves: RHEL-46785 --- browsed-ignore-NULL-attrs.patch | 31 ++++++++++++++++++++++++++ cups-filters.spec | 39 ++++++++++++++++++++++++++++++++- 2 files changed, 69 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..7fd8666 --- /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 6dba2ed..a5e5779 100644 +--- a/utils/cups-browsed.c ++++ b/utils/cups-browsed.c +@@ -5641,6 +5641,12 @@ record_printer_options(const char *printer) { + printer); + 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 || +@@ -5657,6 +5663,13 @@ record_printer_options(const char *printer) { + memmove(c, c + 1, strlen(c)); + if (*c) c ++; + } ++ ++ if (strlen(buf) == 0) ++ { ++ attr = ippNextAttribute(response); ++ continue; ++ } ++ + debug_printf(" %s=%s\n", key, buf); + p->num_options = cupsAddOption(key, buf, p->num_options, + &(p->options)); diff --git a/cups-filters.spec b/cups-filters.spec index ab96a43..25e4fe2 100644 --- a/cups-filters.spec +++ b/cups-filters.spec @@ -11,7 +11,7 @@ Summary: OpenPrinting CUPS filters and backends Name: cups-filters Version: 1.28.7 -Release: 15%{?dist} +Release: 16%{?dist} # For a breakdown of the licensing, see COPYING file # GPLv2: filters: commandto*, imagetoraster, pdftops, rasterto*, @@ -42,6 +42,8 @@ Patch03: 0001-libcupsfilters-Fix-page-range-like-10-in-pdftopdf-fi.patch Patch04: beh-cve2023.patch # RHEL-16026 Cups Browsed does not correctly pull printer location and description information from print server Patch05: 0001-Use-description-location-from-server-if-available-ot.patch +# RHEL-46785 Cups browsing with 'Autoclustering on' in RHEL 9 cannot find printer clusters for HA +Patch06: browsed-ignore-NULL-attrs.patch # autogen.sh @@ -283,6 +285,38 @@ done %ldconfig_scriptlets libs +%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 @@ -407,6 +441,9 @@ done %endif %changelog +* Tue Jul 30 2024 Zdenek Dohnal - 1.28.7-16 +- RHEL-46785 Cups browsing with 'Autoclustering on' in RHEL 9 cannot find printer clusters for HA + * Mon Feb 26 2024 Zdenek Dohnal - 1.28.7-15 - RHEL-19201 redhat-lsb unnecessary pulls in cups and avahi dependencies