RHEL-46785 Cups browsing with 'Autoclustering on' in RHEL 9 cannot find printer clusters for HA

Resolves: RHEL-46785
This commit is contained in:
Zdenek Dohnal 2024-08-06 13:27:20 +02:00
parent 77c01ae418
commit c111351f8b
2 changed files with 69 additions and 1 deletions

View File

@ -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));

View File

@ -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 <zdohnal@redhat.com> - 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 <zdohnal@redhat.com> - 1.28.7-15
- RHEL-19201 redhat-lsb unnecessary pulls in cups and avahi dependencies