commit: c7112c5d9b29e7e87c8171e5f81322b89fcecd7d Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Fri Apr 25 00:35:48 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Fri Apr 25 00:36:34 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c7112c5d
net-print/cups-browsed: backport 2 crash fixes to 2.1.1 Also, drop workaround added for bug #940311, as it's resolved upstream in 2.1.1. Bug: https://bugs.gentoo.org/940311 Signed-off-by: Sam James <sam <AT> gentoo.org> ...d-2.1.1.ebuild => cups-browsed-2.1.1-r1.ebuild} | 7 ++-- .../files/cups-browsed-2.1.1-crash.patch | 31 ++++++++++++++++ .../files/cups-browsed-2.1.1-no-model.patch | 42 ++++++++++++++++++++++ 3 files changed, 78 insertions(+), 2 deletions(-) diff --git a/net-print/cups-browsed/cups-browsed-2.1.1.ebuild b/net-print/cups-browsed/cups-browsed-2.1.1-r1.ebuild similarity index 95% rename from net-print/cups-browsed/cups-browsed-2.1.1.ebuild rename to net-print/cups-browsed/cups-browsed-2.1.1-r1.ebuild index 2f666b559c9b..4ea44cabb437 100644 --- a/net-print/cups-browsed/cups-browsed-2.1.1.ebuild +++ b/net-print/cups-browsed/cups-browsed-2.1.1-r1.ebuild @@ -40,11 +40,14 @@ BDEPEND=" # successfully running the tests, restrict it. RESTRICT="test" +PATCHES=( + "${FILESDIR}"/${P}-no-model.patch + "${FILESDIR}"/${P}-crash.patch +) + src_configure() { local myeconfargs=( --localstatedir="${EPREFIX}"/var - # Omit cups here for bug #940311 (CVE-2024-47176 mitigation) - --with-browseremoteprotocols=dnssd --with-cups-rundir="${EPREFIX}"/run/cups --with-rcdir=no diff --git a/net-print/cups-browsed/files/cups-browsed-2.1.1-crash.patch b/net-print/cups-browsed/files/cups-browsed-2.1.1-crash.patch new file mode 100644 index 000000000000..b103db02ee7e --- /dev/null +++ b/net-print/cups-browsed/files/cups-browsed-2.1.1-crash.patch @@ -0,0 +1,31 @@ +https://github.com/OpenPrinting/cups-browsed/commit/724ac36fd2cd9c11f7c429b63ba1e9e7fed0d326 + +From 724ac36fd2cd9c11f7c429b63ba1e9e7fed0d326 Mon Sep 17 00:00:00 2001 +From: Till Kamppeter <[email protected]> +Date: Wed, 16 Apr 2025 18:59:34 +0200 +Subject: [PATCH] cups-browsed: NULL check od make/model string when checking + printer's PDLs + +If we allow setting up queues for non-driverless legacy IPP printers +(IPP 1.x) we check for known PDLs and here we check also the +make/model string, but our check would crash cups-browsed if the +string is NULL. This commit adds an appropriate NULL check. +--- + daemon/cups-browsed.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/daemon/cups-browsed.c b/daemon/cups-browsed.c +index 46bc8892..ad4e4f45 100644 +--- a/daemon/cups-browsed.c ++++ b/daemon/cups-browsed.c +@@ -6832,7 +6832,8 @@ create_remote_printer_entry (const char *queue_name, + ((!strcasestr(pdl, "application/vnd.hp-PCL") && + !strcasestr(pdl, "application/PCL") && + !strcasestr(pdl, "application/x-pcl")) || +- ((!strncasecmp(make_model, "HP", 2) || // HP inkjets not supported ++ (make_model && ++ (!strncasecmp(make_model, "HP", 2) || // HP inkjets not supported + !strncasecmp(make_model, "Hewlett Packard", 15) || + !strncasecmp(make_model, "Hewlett-Packard", 15)) && + !strcasestr(make_model, "LaserJet") && + diff --git a/net-print/cups-browsed/files/cups-browsed-2.1.1-no-model.patch b/net-print/cups-browsed/files/cups-browsed-2.1.1-no-model.patch new file mode 100644 index 000000000000..dd20a8702ff2 --- /dev/null +++ b/net-print/cups-browsed/files/cups-browsed-2.1.1-no-model.patch @@ -0,0 +1,42 @@ +https://github.com/OpenPrinting/cups-browsed/commit/6f48f9daf91fff0c94abe3325b583eb959b480c2 + +From 6f48f9daf91fff0c94abe3325b583eb959b480c2 Mon Sep 17 00:00:00 2001 +From: Till Kamppeter <[email protected]> +Date: Wed, 16 Apr 2025 17:41:24 +0200 +Subject: [PATCH] cups-browsed: Generate PPD for printer also if it does not + report make/model + +It can happen that an IPP printer does not report make and model in +its DNS-SD record. cups-browsed did not create a PPD file for the +local queue then. This commit fixes it. + +The ppdCreatePPDFromIPP2() function of libppd works also when its +make_model parameter is NULL. +--- + daemon/cups-browsed.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/daemon/cups-browsed.c b/daemon/cups-browsed.c +index 5401a134..42cebf3c 100644 +--- a/daemon/cups-browsed.c ++++ b/daemon/cups-browsed.c +@@ -7582,7 +7582,8 @@ create_queue(void* arg) + debug_printf("Generated Default Attributes for local queue %s\n", + p->queue_name); + } +- if (ppdfile == NULL && make_model && strcmp(make_model, "Local Raw Printer")) ++ if (ppdfile == NULL && ++ (!make_model || strcmp(make_model, "Local Raw Printer"))) + { + // If we do not want CUPS-generated PPDs or we cannot obtain a + // CUPS-generated PPD, for example if CUPS does not create a +@@ -7775,7 +7776,8 @@ create_queue(void* arg) + debug_printf("Generated Default Attributes for local queue %s\n", + p->queue_name); + } +- if (ppdfile == NULL && make_model && strcmp(make_model, "Local Raw Printer")) ++ if (ppdfile == NULL && ++ (!make_model || strcmp(make_model, "Local Raw Printer"))) + { + // If we do not want CUPS-generated PPDs or we cannot obtain a + // CUPS-generated PPD, for example if CUPS does not create a
