import cups-browsed-2.0.0-6.el10

cs10 imports/cs10/cups-browsed-2.0.0-6.el10
MSVSphere Packaging Team 4 months ago
commit d2064e29d0
Signed by: sys_gitsync
GPG Key ID: B2B0B9F29E528FE8

@ -0,0 +1 @@
98fa3d9fa277a0ed169e01d744c98a78c1b34974 SOURCES/cups-browsed-2.0.0.tar.gz

1
.gitignore vendored

@ -0,0 +1 @@
SOURCES/cups-browsed-2.0.0.tar.gz

@ -0,0 +1,38 @@
From a38ab5522964afe07415aeebecdc12b13d0c9196 Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Thu, 25 Jan 2024 17:43:25 +0100
Subject: [PATCH] Fix memory leak in resolve_callback
---
daemon/cups-browsed.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/daemon/cups-browsed.c b/daemon/cups-browsed.c
index 1e461bd1..d4527c05 100644
--- a/daemon/cups-browsed.c
+++ b/daemon/cups-browsed.c
@@ -10899,7 +10899,7 @@ resolve_callback(void* arg)
AVAHI_GCC_UNUSED void* userdata = a->userdata;
char ifname[IF_NAMESIZE];
- AvahiStringList *uuid_entry, *printer_type_entry;
+ AvahiStringList *uuid_entry = NULL, *printer_type_entry;
char *uuid_key, *uuid_value;
debug_printf("resolve_callback() in THREAD %ld\n", pthread_self());
@@ -11176,6 +11176,12 @@ resolve_callback(void* arg)
}
ignore:
+ if (uuid_entry)
+ {
+ avahi_free(uuid_key);
+ avahi_free(uuid_value);
+ }
+
if (a->name) free((char*)a->name);
if (a->type) free((char*)a->type);
if (a->domain) free((char*)a->domain);
--
2.43.0

@ -0,0 +1,34 @@
From 4ccd64b65b4672ce211bf56ee1ca6e1a5f8ebf5c Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Wed, 7 Feb 2024 14:59:41 +0100
Subject: [PATCH] Init variables which can be later used uninitialized
---
daemon/cups-browsed.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemon/cups-browsed.c b/daemon/cups-browsed.c
index 29fd34a1..a144abae 100644
--- a/daemon/cups-browsed.c
+++ b/daemon/cups-browsed.c
@@ -6935,7 +6935,7 @@ on_job_state (CupsNotifier *object,
// The priority order for the PDLs is the same as in the
// PPD generator in ppd/ppd-generator.c of libppd
- document_format = (char *)malloc(sizeof(char) * 32);
+ document_format = (char *)calloc(32, sizeof(char));
if (cupsArrayFind(pdl_list, "application/vnd.cups-pdf"))
strcpy(document_format, "application/vnd.cups-pdf");
else if (cupsArrayFind(pdl_list, "image/urf"))
@@ -10951,7 +10951,7 @@ resolve_callback(void* arg)
// Called whenever a service has been resolved successfully
// New remote printer found
- AvahiStringList *rp_entry, *adminurl_entry;
+ AvahiStringList *rp_entry = NULL, *adminurl_entry = NULL;
char *rp_key, *rp_value, *adminurl_key, *adminurl_value;
debug_printf("Avahi Resolver: Service '%s' of type '%s' in domain '%s' with host name '%s' and port %d on interface '%s' (%s).\n",
--
2.43.0

@ -0,0 +1,16 @@
diff --git a/daemon/cups-browsed.c b/daemon/cups-browsed.c
index 7f83510..9be61ca 100644
--- a/daemon/cups-browsed.c
+++ b/daemon/cups-browsed.c
@@ -7792,8 +7792,11 @@ create_remote_printer_entry (const char *queue_name,
p->prattrs = cfGetPrinterAttributes(p->uri, NULL, 0, NULL, 0, 1);
debug_log_out(cf_get_printer_attributes_log);
if (p->prattrs == NULL)
+ {
debug_printf("get-printer-attributes IPP call failed on printer %s (%s).\n",
p->queue_name, p->uri);
+ goto fail;
+ }
}
}
else

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

@ -0,0 +1,257 @@
%global _cups_serverbin %{_prefix}/lib/cups
%if 0%{?fedora}
%bcond_without mdns
%else
%bcond_with mdns
%endif
Name: cups-browsed
Epoch: 1
Version: 2.0.0
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
# https://lists.fedoraproject.org/archives/list/legal@lists.fedoraproject.org/message/A7GFSD6M3GYGSI32L2FC5KB22DUAEQI3/
License: Apache-2.0 WITH LLVM-exception
URL: https://github.com/OpenPrinting/cups-browsed
Source0: %{URL}/releases/download/%{version}/%{name}-%{version}.tar.gz
# Patches
# https://github.com/OpenPrinting/cups-browsed/pull/26 both 001 and 002
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
# was shipped in cups-filters before 2.0
Conflicts: cups-filters < 2.0
# for generating configure and Makefile scripts in autogen.h
BuildRequires: autoconf
# for generating configure and Makefile scripts in autogen.h
BuildRequires: automake
# most filter functions written in C
BuildRequires: gcc
# for generating configure and Makefile scripts in autogen.h
BuildRequires: gettext-devel
# for autosetup
BuildRequires: git-core
# for generating configure and Makefile scripts in autogen.h
BuildRequires: libtool
# uses Makefiles
BuildRequires: make
# for pkg-config in configure and in SPEC file
BuildRequires: pkgconf-pkg-config
# for looking for devices on mDNS and their sharing on mDNS
BuildRequires: pkgconfig(avahi-client)
# for polling avahi
BuildRequires: pkgconfig(avahi-glib)
# uses CUPS and IPP API
BuildRequires: pkgconfig(cups) >= 2.2.2
# uses cupsfilters API
BuildRequires: pkgconfig(libcupsfilters) >= 2.0b3
# implicitclass uses libppd
BuildRequires: pkgconfig(libppd) >= 2.0b3
# for dBUS proxy from GLib
BuildRequires: pkgconfig(glib-2.0)
# needed for systemd rpm macros in scriptlets
BuildRequires: systemd-rpm-macros
%if %{with mdns}
# Avahi has to run for mDNS support
Recommends: avahi
# if set to browse or share mDNS, we need a resolver
Recommends: nss-mdns
%endif
# only recommends cups RPM in case someone wants to use CUPS container/SNAP
# - cups-browsed has to have a cupsd daemon to send requests to
# using a weak dep will work for bootstraping as well in case the old cups-filters
# 1.x, which is CUPS dependency, will be in repos when cups-browsed
Recommends: cups
# requires cups directories
Requires: cups-filesystem
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%description
cups-browsed is a helper daemon, which automatically installs printers
locally, provides load balancing and clustering of print queues.
The daemon installs the printers based on found mDNS records and CUPS
broadcast, or by polling a remote print server.
%prep
%autosetup -S git
%build
# generate configuration/compilation files
./autogen.sh
# --enable-auto-setup-driverless-only - enable autoinstalling of driverless IPP
# destinations
# --disable-saving-created-queues - don't save the queues during shutdown
# --disable-frequent-netif-update - don't update network interfaces after
# every found printer, update only on NM dBUS event
# --with-browseremoteprotocols - which protocols to use for looking for printers, default DNSSD and CUPS
# --with-remote-cups-local-queue-naming - use the name from remote server
# if polling the server for printers via BrowsePoll
%configure --enable-auto-setup-driverless-only\
--disable-rpath\
--disable-saving-created-queues\
--disable-frequent-netif-update\
%if %{without mdns}
--with-browseremoteprotocols=none\
%endif
--with-remote-cups-local-queue-naming=RemoteName\
--without-rcdir
%make_build
%install
%make_install
# systemd unit file
mkdir -p %{buildroot}%{_unitdir}
install -p -m 644 daemon/cups-browsed.service %{buildroot}%{_unitdir}
# remove INSTALL file
rm -f %{buildroot}%{_pkgdocdir}/INSTALL
# provided by cups-browsed dependency
rm -f %{buildroot}%{_pkgdocdir}/CHANGES-1.x.md
# license related files are already under /usr/share/licenses
rm -f %{buildroot}%{_pkgdocdir}/{LICENSE,COPYING,NOTICE}
%post
%systemd_post cups-browsed.service
# put UpdateCUPSQueuesMaxPerCall and PauseBetweenCUPSQueueUpdates into cups-browsed.conf
# for making cups-browsed work more stable for environments with many print queues
# TODO make this configurable during build
for directive in "UpdateCUPSQueuesMaxPerCall" "PauseBetweenCUPSQueueUpdates"
do
found=`%{_bindir}/grep "^[[:blank:]]*$directive" %{_sysconfdir}/cups/cups-browsed.conf`
if [ -z "$found" ]
then
if [ "x$directive" == "xUpdateCUPSQueuesMaxPerCall" ]
then
%{_bindir}/echo "UpdateCUPSQueuesMaxPerCall 20" >> %{_sysconfdir}/cups/cups-browsed.conf
else
%{_bindir}/echo "PauseBetweenCUPSQueueUpdates 5" >> %{_sysconfdir}/cups/cups-browsed.conf
fi
fi
done
%preun
%systemd_preun cups-browsed.service
%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
%doc ABOUT-NLS AUTHORS CHANGES.md CONTRIBUTING.md DEVELOPING.md README.md
# implicitclass backend must be run as root
# https://github.com/OpenPrinting/cups-filters/issues/183#issuecomment-570196216
%attr(0744,root,root) %{_cups_serverbin}/backend/implicitclass
# 2123809 - rpm -Va reports changes due %%post scriptlet (remove the verify part once we remove
# cups-browsed.conf update from %%post scriptlet)
%config(noreplace) %verify(not size filedigest mtime) %{_sysconfdir}/cups/cups-browsed.conf
%{_mandir}/man5/cups-browsed.conf.5.gz
%{_mandir}/man8/cups-browsed.8.gz
%{_sbindir}/cups-browsed
%{_unitdir}/cups-browsed.service
%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
* Wed Feb 07 2024 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.0.0-4
- 2253985 - cups-browsed crashes when remote CUPS queue found by DNS-SD is not able to response on IPP Get-Printer-Attributes
- fix several issues reported by openscanhub
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Wed Oct 04 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.0.0-1
- 2240317 - cups-browsed-2.0.0 is available
* Tue Aug 29 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.0~rc2-3
- 2150035 - [abrt] cups-filters: __strlen_avx2(): cups-browsed killed by SIGSEGV
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.0~rc2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Wed Jun 28 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.0~rc2-1
- 2.0rc2
* Thu Apr 27 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.0~rc1-1
- 2.0rc1
* Mon Apr 03 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.0~b4-1
- 2179346 - cups-browsed-2.0b4 is available
* Wed Mar 01 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.0~b3-2
- use Epoch to ensure upgrade path because I didn't read FPG carefully
* Thu Feb 02 2023 Zdenek Dohnal <zdohnal@redhat.com> - 2.0b3-1
- Initial import (fedora#2170547)
Loading…
Cancel
Save