RHEL-51349 Cups browsing with 'Autoclustering on' cannot find printer clusters for HA due incorrect orientation-requested-default

Resolves: RHEL-51349
This commit is contained in:
Zdenek Dohnal 2024-08-06 13:22:18 +02:00
parent 10e9fa1322
commit 4eca7304d4
2 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,31 @@
diff --git a/daemon/cups-browsed.c b/daemon/cups-browsed.c
index a2530d9..efc5669 100644
--- a/daemon/cups-browsed.c
+++ b/daemon/cups-browsed.c
@@ -5947,6 +5947,12 @@ record_printer_options(const char *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 ||
@@ -5966,6 +5972,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

@ -10,7 +10,7 @@
Name: cups-browsed
Epoch: 1
Version: 2.0.0
Release: 5%{?dist}
Release: 6%{?dist}
Summary: Daemon for local auto-installation of remote printers
# the CUPS exception text is the same as LLVM exception, so using that name with
# agreement from legal team
@ -26,6 +26,10 @@ Patch001: 0001-Fix-memory-leak-in-resolve_callback.patch
Patch002: 0001-Init-variables-which-can-be-later-used-uninitialized.patch
# https://github.com/OpenPrinting/cups-browsed/pull/25
Patch003: browsed-goto-fail.patch
# RHEL-51349 Cups browsing with 'Autoclustering on' in RHEL 9 cannot find printer clusters for HA
# https://github.com/OpenPrinting/cups-browsed/pull/32
# https://github.com/OpenPrinting/cups-browsed/pull/33
Patch04: browsed-ignore-NULL-attrs.patch
# remove once CentOS Stream 10 is released, cups-browsed
@ -162,6 +166,39 @@ done
%postun
%systemd_postun_with_restart cups-browsed.service
# remove once F41 is EOL
%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
%license COPYING LICENSE NOTICE
@ -179,6 +216,9 @@ done
%changelog
* Tue Aug 06 2024 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.0.0-6
- RHEL-51349 Cups browsing with 'Autoclustering on' cannot find printer clusters for HA due incorrect orientation-requested-default
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1:2.0.0-5
- Bump release for June 2024 mass rebuild