diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-09-27 01:25:47 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-09-27 01:25:47 +0100 |
commit | abc3bfc07d931f667a0f50cf607f1c8a49af879f (patch) | |
tree | e1955376c90c745c2b110a9abf62eb2d5c209a2b /net-print | |
parent | 21dea977c89ba487b57c7856a4924950e667f209 (diff) |
gentoo auto-resync : 27:09:2024 - 01:25:47
Diffstat (limited to 'net-print')
-rw-r--r-- | net-print/Manifest.gz | bin | 6423 -> 6426 bytes | |||
-rw-r--r-- | net-print/cups-browsed/Manifest | 2 | ||||
-rw-r--r-- | net-print/cups-browsed/cups-browsed-2.0.1.ebuild | 79 | ||||
-rw-r--r-- | net-print/cups/Manifest | 2 | ||||
-rw-r--r-- | net-print/cups/cups-2.4.10-r1.ebuild | 322 | ||||
-rw-r--r-- | net-print/libcupsfilters/Manifest | 3 | ||||
-rw-r--r-- | net-print/libcupsfilters/files/libcupsfilters-2.1_beta1-CVE-2024-47076.patch | 31 | ||||
-rw-r--r-- | net-print/libcupsfilters/libcupsfilters-2.1_beta1.ebuild | 75 | ||||
-rw-r--r-- | net-print/libppd/Manifest | 4 | ||||
-rw-r--r-- | net-print/libppd/files/libppd-2.1_beta1-CVE-2024-47175.patch | 560 | ||||
-rw-r--r-- | net-print/libppd/libppd-2.1_beta1-r1.ebuild | 58 | ||||
-rw-r--r-- | net-print/libppd/libppd-2.1_beta1.ebuild | 54 |
12 files changed, 1190 insertions, 0 deletions
diff --git a/net-print/Manifest.gz b/net-print/Manifest.gz Binary files differindex 0719268239e8..e0fd7fd6ad69 100644 --- a/net-print/Manifest.gz +++ b/net-print/Manifest.gz diff --git a/net-print/cups-browsed/Manifest b/net-print/cups-browsed/Manifest index 97c4c5a779d8..6de769c940ee 100644 --- a/net-print/cups-browsed/Manifest +++ b/net-print/cups-browsed/Manifest @@ -1,5 +1,7 @@ AUX 0001-cups-browsed.c-Fix-build-with-avahi-disabled-20.patch 915 BLAKE2B 2349ba5021b42ab896cf277c64052c1e593fe3e6ec0665ab20476aaede23290f83d6ec58e8ed8402c29f9cece0fd7c79c294512410213fe731455c1b76337592 SHA512 2c5f75b748477cd19711c7ab2c6b158de94cc14ee4e0344e303b1e7f2e3c07ee0b3c04d110896d8db9d94486a9d80c0643e79a70fe6b1d1e27c7b0d910628be7 AUX cups-browsed.init.d 150 BLAKE2B c2098766ae08b38dead0a5bab2e30e1728ab93aa98e74edb6e20f8a885b62189f1368a041c4430ad24a1b92f0ae9cb317ac3390767db0a54ca1532022d44b0bd SHA512 c8a74ad0e5cfd3b565c12eeca50a55b7a6aa3ac92c689fc6632e2a6df5033e6fa7f16ce6c9c2cbf607ad4bd09453ab7d47448cdd04ad8c7e35f0e584b6d96d38 DIST cups-browsed-2.0.0.tar.xz 426132 BLAKE2B e1724c03302d61cf131c8886a95f6ad8f0236b134f1deaadb783fa185141b83cd8ac5c5d993ded37d04c7fd806c5cde157a792a90a2f372075f24a5bd2423dc5 SHA512 592493ef82c65b2418b86b555c4d24bdf352f78516993a021d106240b8c399fd9f4fcc27e396e895d94da889a97f2bbc5e96bfa92c58c8be80802ee8df43db80 +DIST cups-browsed-2.0.1.tar.xz 427060 BLAKE2B 06c9c8f8c50a165b11f029804dbb20db0ebfd7cddc93c274851e1ab849d0a200fcb8e7dfc489656fa1255c7d6540ae5407467161bd51edca3e8ce04e7d02b78f SHA512 9e9a11708daa861ef58b19a3bda636f1e1fccf0cf12ad5880096d61132f1df9bfa8b81f437247064d199e3aa6a5438061ba085a6d6df52c1ba6021f3b32d9d00 EBUILD cups-browsed-2.0.0.ebuild 2216 BLAKE2B b679fb64054028c3ba94be410c11b05ff1587a037200313af490779a4339540458dcd73fdd191dfb6680359692e241e1ab13a8fb8aa576dbe07e302d2ca80181 SHA512 f94c6b5b30a3a5410d6e5a5b69b15af53c871a0370c3a00b93fa6ff49810614609c5da8e59462e915346d4a7c04bb4a54fdb8232c241b864d72fa680a50031cc +EBUILD cups-browsed-2.0.1.ebuild 2194 BLAKE2B c95c3d5467c05259003c2c27aa349b9dad36eca71feb8b8d78040de330844633eddc77561ad645361087934d4a5d8f2640d24925bcbff51a848e213b49e4f8ae SHA512 dcf912b414e170247de122e6b68ddafaba3ce439e09dbfc1e6c3ea4a7b06c92c1e2ecc824e42da8e160525129777d82ea893a83eebeacae8c59ecec4f73ac05f MISC metadata.xml 350 BLAKE2B d469f8a462c27bb1f22454a0141a67a6ac9c4c06058bf50576fd4d8324371042805464135777838a7ee787185c0f37e2ab06de00db9645b5737dcada51464f22 SHA512 53832a79e75d4ffb1896d3a984709cd06294b82ed7a0cab9a2c958a8fabf7d2d4252f09b4302336a42dbd3afd079b1688b86d04e63efbca5ee5065ac56c793ce diff --git a/net-print/cups-browsed/cups-browsed-2.0.1.ebuild b/net-print/cups-browsed/cups-browsed-2.0.1.ebuild new file mode 100644 index 000000000000..b2dadbc233a5 --- /dev/null +++ b/net-print/cups-browsed/cups-browsed-2.0.1.ebuild @@ -0,0 +1,79 @@ +# Copyright 2023-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit systemd + +DESCRIPTION="helper daemon to browse for remote CUPS queues and IPP network printers" +HOMEPAGE="https://github.com/OpenPrinting/cups-browsed" +SRC_URI="https://github.com/OpenPrinting/cups-browsed/releases/download/${PV}/${P}.tar.xz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86" +IUSE="ldap test zeroconf" + +RDEPEND=" + dev-libs/glib:2 + >=net-print/cups-2 + >=net-print/cups-filters-2.0.0 + ldap? ( net-nds/openldap:= ) + test? ( net-print/cups[zeroconf] ) + zeroconf? ( net-dns/avahi[dbus] ) +" +DEPEND="${RDEPEND}" +BDEPEND=" + dev-util/gdbus-codegen + >=sys-devel/gettext-0.18.3 + virtual/pkgconfig +" + +# The tests are new since the split out of cups-filters. Actually running them +# seems to be challenging. You need: +# - cups tools that are USE-optional +# - running avahi-daemon (as root!) +# - disable portage's pid-sandbox, which interferes with avahi +# - ipptool still fails to connect to port 8xxx +# +# If anything fails, a `while true` loop fails to successfully launch and break +# out of the loop, leading to a hang. Until there's an obvious recipe for +# successfully running the tests, restrict it. +RESTRICT="test" + +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 + + $(use_enable ldap) + $(use_enable zeroconf avahi) + ) + + econf "${myeconfargs[@]}" +} + +src_test() { + # Requires avahi running. Hangs forever if not available. + avahi-daemon --check 2>/dev/null || die "no running avahi daemon found, cannot run tests" + + default +} + +src_install() { + default + + cp "${FILESDIR}"/cups-browsed.init.d "${T}"/cups-browsed || die + + if ! use zeroconf ; then + sed -i -e 's:need cupsd avahi-daemon:need cupsd:g' "${T}"/cups-browsed || die + sed -i -e 's:cups\.service avahi-daemon\.service:cups.service:g' "${S}"/daemon/cups-browsed.service || die + fi + + doinitd "${T}"/cups-browsed + systemd_dounit "${S}"/daemon/cups-browsed.service + +} diff --git a/net-print/cups/Manifest b/net-print/cups/Manifest index e62d1328c890..5d0a89b6fe1e 100644 --- a/net-print/cups/Manifest +++ b/net-print/cups/Manifest @@ -1,9 +1,11 @@ AUX cups-2.4.1-nostrip.patch 411 BLAKE2B 67b7ebe76e3586ef819a0dfee5729781ee6d5ece9ea3ff2e6805ed5bffd7cdaac039e62bbb0c47ef663fae46ae42041e025ada586f978301077124ff0ce85712 SHA512 6e792b90dbba541142f505563d37f5a567ef8469e298e2b373a9ac1900b31ffde3050b995d16fcbbeed792252b933e75c7517419a5907f9ce69e22e9c5656ff0 AUX cups-2.4.1-user-AR.patch 567 BLAKE2B 06e91a7601ebbe534808b310e80d482b0dc0b3df0d2c738979fc0917a6c497341dbb0c5f12eedc19b58a149546bab26c13324bc4d1916966d9628413a18d065f SHA512 136871e48c19be011e368dc004c39d104405a2f6729b7612c3c6355d6e1bb8dc112909c850cb58bffcbcf1efe0d4b1c3cfa3083bb63dbfc512dc93a2d0379a9e AUX cupsd.init.d-r4 577 BLAKE2B 48508b10a13ee73e905b3d061275f5cb12ebdc2175ce46affb2007d4a5d007719a147f490e7c17a3e9a5211b82d9b89be7111921b1c9d991a6fc4c457f63eae0 SHA512 23ec5714764f2bac4105130efe6f79a508a352ecb45ab3f6e08042b156af05065330b2ac85615d0ce792a4dcd8f5230302dba9d1a96fca84c11d8bf2573ccc0e +DIST cups-2.4.10-patches.tar.xz 6004 BLAKE2B d20d3ff9c4446e05546e531aa4806b29216555b8210071b9241340f772a2923a5441f8601f1fd87c8bb17d9dd534b0f996f88c0a9bf901849534842423cfc426 SHA512 e5051c28e18b0081acd57a99930ec3e36a657cc5a60156ce2248696eb7c0fbe14dd3740019decb5a0ca777f151f7ea0c05befe97e404df10cdb57b02be716f29 DIST cups-2.4.10-source.tar.gz 8145236 BLAKE2B 842a713d606c1e68d5113c0fc2f063cb58519891bb8f442fd64caeebf6b14fbf38b59d1fe4277cf8f9a01238c4c040fc7919234afa56dc86fcebb623a0058322 SHA512 6442207615f79c91de134ff5f438aa5060cbdf764113f7a338a53f7e12ad87bab147ea61302e84c94f259d31950f1a164c4574d11942ca838eb924827375748e DIST cups-2.4.6-source.tar.gz 8135135 BLAKE2B 4e61112ddaa46f20b1cfcb8f523dd07ba7d82604b9857754b288a2a9c5bc50ce242cfa119867347e4696818dc2eb505cf7fff1f9a0634e314edb2500395b83e4 SHA512 eb748680a748f599e4826c17054a24259d190e6c8e8339f6a7a37ee2a3f4c3fd1829e856b25a854cfdbee1b51279c70a0e847f6142225b8b68f1cd10c4ce4ce4 DIST cups-2.4.7-source.tar.gz 8134809 BLAKE2B d81de62cff37c576ef8fb125b97568c2d86602cec6151d7030552fad421d7bc77a5df1e860d5ac5a241e739cc0d1fe5fcac44b8451ad2fc4dc675cf74fd41382 SHA512 914b574ff6d85de9f3471528b52d4a436c484c441f47651846e1bdfa00aec26774efd416ff466216d2bccf468f8a797b1e0d666b5c82abc87e77550ce8b00d39 +EBUILD cups-2.4.10-r1.ebuild 9755 BLAKE2B 974f88ed8e585ace9239b8193eac4507556e41c32fed08e3ad58c7091009abd08a360515228e6971b44d3d8b92a2a70791cc71d2e6d65bb48b340feca65b6634 SHA512 c5acf8557920be46baa9975de064bb5986b27032f20842551fdbaf3910216d73105bddee6867249a9d4ee0c63037bf67d0744b4f7cb4e7f2308d5c0ef1488ed4 EBUILD cups-2.4.10.ebuild 9639 BLAKE2B b0dfae3c38aa0196891318f4c87bf96c4a14700d52240270176db7c0ef251afc396f118c826bd35c52fa127ce10a4ac6f7fbc2bec9cce8c256f9670a4089d48e SHA512 29df0de683db650619afeef406f26ce96ec853433e06837e10f04781732b25562e63d21500111a3428084c9f071cbab70bcd071be6e87a2214395532b58068c8 EBUILD cups-2.4.6.ebuild 9546 BLAKE2B d7706335f4b5f7d2c83067f3451a6ec8c2c19798fabc36e9a13b8ae307ae96b65f700cb8cd08cac1f93b4c834b60c43f39fe1184651360e53041b8642e06e38c SHA512 17737077831162beb5681b33c511405d5fe8fef0c90227847169695f64a3e38e8513f1b076d9f86a34c4c75796c42b2aacd589feb32ab4e2cbc590ee78ce4b54 EBUILD cups-2.4.7-r1.ebuild 9461 BLAKE2B 025635024f9a3fe9ce89130296106d1d18668eb5614be97b3d4ca7dfdc55a2e73dc4b067c576c67015cc97641dc7a76b06f1a3e37c3ee6936357b2a752711627 SHA512 da1ccc462abcc582eeff2fbd8eeb0d9f6cf8b6dd62848c0079937ae409e1385719b23452ebdb200a96505ecc0bb4b117d13d7ce6075f98c25bd6154d8fd4dae7 diff --git a/net-print/cups/cups-2.4.10-r1.ebuild b/net-print/cups/cups-2.4.10-r1.ebuild new file mode 100644 index 000000000000..f2a93b7a9c9b --- /dev/null +++ b/net-print/cups/cups-2.4.10-r1.ebuild @@ -0,0 +1,322 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools linux-info xdg multilib-minimal optfeature pam toolchain-funcs + +MY_PV="${PV/_beta/b}" +MY_PV="${MY_PV/_rc/rc}" +MY_PV="${MY_PV/_p/op}" +MY_P="${PN}-${MY_PV}" + +if [[ ${PV} == *9999 ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/OpenPrinting/cups.git" + [[ ${PV} != 9999 ]] && EGIT_BRANCH=branch-${PV/.9999} +else + SRC_URI="https://github.com/OpenPrinting/cups/releases/download/v${MY_PV}/cups-${MY_PV}-source.tar.gz" + SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-patches.tar.xz" + if [[ ${PV} != *_beta* && ${PV} != *_rc* ]] ; then + KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86" + fi +fi + +S="${WORKDIR}/${MY_P}" + +DESCRIPTION="The Common Unix Printing System" +HOMEPAGE="https://www.cups.org/ https://github.com/OpenPrinting/cups" + +LICENSE="Apache-2.0" +SLOT="0" +IUSE="acl dbus debug kerberos openssl pam selinux static-libs systemd test usb X xinetd zeroconf" + +RESTRICT="!test? ( test )" + +BDEPEND=" + acct-group/lp + acct-group/lpadmin + virtual/pkgconfig +" +COMMON_DEPEND=" + app-text/libpaper:= + sys-libs/zlib + acl? ( + kernel_linux? ( + sys-apps/acl + sys-apps/attr + ) + ) + dbus? ( >=sys-apps/dbus-1.6.18-r1[${MULTILIB_USEDEP}] ) + kerberos? ( >=virtual/krb5-0-r1[${MULTILIB_USEDEP}] ) + pam? ( sys-libs/pam ) + !pam? ( virtual/libcrypt:= ) + !openssl? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] ) + openssl? ( dev-libs/openssl:=[${MULTILIB_USEDEP}] ) + systemd? ( sys-apps/systemd ) + usb? ( virtual/libusb:1 ) + X? ( x11-misc/xdg-utils ) + xinetd? ( sys-apps/xinetd ) + zeroconf? ( >=net-dns/avahi-0.6.31-r2[dbus,${MULTILIB_USEDEP}] ) +" +# if libcupsfilters is installed, more tests are run. They fail without at least one of the two formats enabled. +DEPEND=" + ${COMMON_DEPEND} + test? ( || ( net-print/libcupsfilters[jpeg] net-print/libcupsfilters[png] ) ) +" +RDEPEND=" + ${COMMON_DEPEND} + acct-group/lp + acct-group/lpadmin + selinux? ( sec-policy/selinux-cups ) +" + +PATCHES=( + "${FILESDIR}/${PN}-2.4.1-nostrip.patch" + "${FILESDIR}/${PN}-2.4.1-user-AR.patch" + "${WORKDIR}/${P}-patches" +) + +MULTILIB_CHOST_TOOLS=( + /usr/bin/cups-config +) + +pkg_setup() { + if use kernel_linux; then + linux-info_pkg_setup + if ! linux_config_exists; then + ewarn "Can't check the linux kernel configuration." + ewarn "You might have some incompatible options enabled." + else + # Recheck that we don't have usblp to collide with libusb; this should now work in most cases (bug #501122) + if use usb; then + if linux_chkconfig_present USB_PRINTER; then + elog "Your USB printers will be managed via libusb. In case you run into problems, " + elog "please try disabling USB_PRINTER support in your kernel or blacklisting the" + elog "usblp kernel module." + elog "Alternatively, just disable the usb useflag for cups (your printer will still work)." + fi + else + if ! linux_chkconfig_present USB_PRINTER; then + ewarn "If you plan to use USB printers you should enable the USB_PRINTER" + ewarn "support in your kernel." + ewarn "Please enable it:" + ewarn " CONFIG_USB_PRINTER=y" + ewarn "in /usr/src/linux/.config or" + ewarn " Device Drivers --->" + ewarn " USB support --->" + ewarn " [*] USB Printer support" + ewarn "Alternatively, enable the usb useflag for cups and use the libusb code." + fi + fi + fi + fi +} + +src_prepare() { + default + + # Remove ".SILENT" rule for verbose output (bug #524338). + sed 's#^.SILENT:##g' -i Makedefs.in || die + + # Remove redefinition of _FORTIFY_SOURCE (bug #907683) + sed 's#-D_FORTIFY_SOURCE=3##g' -i config-scripts/cups-compiler.m4 || die + + AT_M4DIR="config-scripts" eautoreconf + + # Custom Makefiles + multilib_copy_sources +} + +multilib_src_configure() { + export DSOFLAGS="${LDFLAGS}" + + # Explicitly specify compiler wrt bug #524340 + # + # Need to override KRB5CONFIG for proper flags + # https://github.com/apple/cups/issues/4423 + local myeconfargs=( + CC="$(tc-getCC)" + CXX="$(tc-getCXX)" + KRB5CONFIG="${EPREFIX}"/usr/bin/${CHOST}-krb5-config + --libdir="${EPREFIX}"/usr/$(get_libdir) + --localstatedir="${EPREFIX}"/var + # Follow Fedora permission setting + --with-cupsd-file-perm=0755 + --with-exe-file-perm=755 + --with-log-file-perm=0640 + # Used by Debian, also prevents printers from getting + # disabled and users not knowing how to re-enable them + --with-error-policy=retry-job + # Used in Debian and Fedora + --enable-sync-on-close + # + --with-rundir="${EPREFIX}"/run/cups + --with-pkgconfpath="${EPREFIX}"/usr/$(get_libdir)/pkgconfig + --with-cups-user=lp + --with-cups-group=lp + --with-docdir="${EPREFIX}"/usr/share/cups/html + # See bug #863221 for adding root + --with-system-groups="root lpadmin" + --with-xinetd="${EPREFIX}"/etc/xinetd.d + $(multilib_native_use_enable acl) + $(use_enable dbus) + $(use_enable debug) + $(use_enable debug debug-guards) + $(use_enable debug debug-printfs) + $(use_enable kerberos gssapi) + $(multilib_native_use_enable pam) + $(use_enable static-libs static) + --with-tls=$(usex openssl openssl gnutls) + $(use_with systemd ondemand systemd) + $(multilib_native_use_enable usb libusb) + $(use_with zeroconf dnssd avahi) + $(multilib_is_native_abi && echo --enable-libpaper || echo --disable-libpaper) + ) + + # Handle empty LINGUAS properly, bug #771162 + if [[ -n "${LINGUAS+x}" ]] ; then + myeconfargs+=( + --with-languages="${LINGUAS}" + ) + fi + + if tc-is-static-only; then + myeconfargs+=( + --disable-shared + ) + fi + + # Install in /usr/libexec always, instead of using /usr/lib/cups, as that + # makes more sense when facing multilib support. + sed -i -e 's:CUPS_SERVERBIN="$exec_prefix/lib/cups":CUPS_SERVERBIN="$exec_prefix/libexec/cups":g' configure ||die + + econf "${myeconfargs[@]}" + + sed -i -e "s:SERVERBIN.*:SERVERBIN = \"\$\(BUILDROOT\)${EPREFIX}/usr/libexec/cups\":" Makedefs || die + sed -i -e "s:#define CUPS_SERVERBIN.*:#define CUPS_SERVERBIN \"${EPREFIX}/usr/libexec/cups\":" config.h || die + sed -i -e "s:cups_serverbin=.*:cups_serverbin=\"${EPREFIX}/usr/libexec/cups\":" cups-config || die + + # Additional path corrections needed for prefix, see bug #597728 + sed \ + -e "s:ICONDIR.*:ICONDIR = ${EPREFIX}/usr/share/icons:" \ + -e "s:INITDIR.*:INITDIR = ${EPREFIX}/etc:" \ + -e "s:DBUSDIR.*:DBUSDIR = ${EPREFIX}/etc/dbus-1:" \ + -e "s:MENUDIR.*:MENUDIR = ${EPREFIX}/usr/share/applications:" \ + -i Makedefs || die +} + +multilib_src_compile() { + if multilib_is_native_abi; then + default + else + emake libs + fi +} + +multilib_src_test() { + # We only build some of CUPS for multilib, so can't run the tests. + if multilib_is_native_abi; then + # Avoid using /tmp + export CUPS_TESTBASE="${T}"/cups-tests + + mkdir "${T}"/cups-tests || die + + # avoid building *and running* test binaries in src_compile + # https://github.com/OpenPrinting/cups/commit/b1d42061e9286f50eefc851ed906d17c6e80c4b0 + emake UNITTESTS=unittests + default + fi +} + +multilib_src_install() { + if multilib_is_native_abi; then + emake BUILDROOT="${D}" install + else + emake BUILDROOT="${D}" install-libs install-headers + dobin cups-config + fi +} + +multilib_src_install_all() { + dodoc {CHANGES,CREDITS,README}.md + + # Move the default config file to docs + dodoc "${ED}"/etc/cups/cupsd.conf.default + rm "${ED}"/etc/cups/cupsd.conf.default || die + + # Clean out cups init scripts + rm -r "${ED}"/etc/{init.d/cups,rc*} || die + + # Install our init script + local neededservices=( + $(usex zeroconf avahi-daemon '') + $(usex dbus dbus '') + ) + [[ -n ${neededservices[@]} ]] && neededservices="need ${neededservices[@]}" + cp "${FILESDIR}"/cupsd.init.d-r4 "${T}"/cupsd || die + sed -i -e "s/@neededservices@/${neededservices}/" "${T}"/cupsd || die + doinitd "${T}"/cupsd + + if use pam ; then + rm "${ED}"/etc/pam.d/${PN} || die + pamd_mimic_system cups auth account + fi + + if use xinetd ; then + # Correct path + sed -i -e "s:server = .*:server = /usr/libexec/cups/daemon/cups-lpd:" \ + "${ED}"/etc/xinetd.d/cups-lpd || die + # It is safer to disable this by default, bug #137130 + grep -w 'disable' "${ED}"/etc/xinetd.d/cups-lpd || \ + { sed -i -e "s:}:\tdisable = yes\n}:" "${ED}"/etc/xinetd.d/cups-lpd || die ; } + # Write permission for file owner (root), bug #296221 + fperms u+w /etc/xinetd.d/cups-lpd + else + # Always configure with --with-xinetd= and clean up later, + # bug #525604 + rm -r "${ED}"/etc/xinetd.d || die + fi + + keepdir /etc/cups/{interfaces,ppd,ssl} + + if ! use X ; then + rm -r "${ED}"/usr/share/applications || die + fi + + # Create /etc/cups/client.conf, bug #196967 and bug #266678 + echo "ServerName ${EPREFIX}/run/cups/cups.sock" >> "${ED}"/etc/cups/client.conf + + # The following file is now provided by cups-filter: + rm -r "${ED}"/usr/share/cups/banners || die + + # The following are created by the init script + rm -r "${ED}"/var/cache || die + rm -r "${ED}"/run || die + + keepdir /usr/libexec/cups/driver /usr/share/cups/{model,profiles} /var/log/cups /var/spool/cups/tmp +} + +pkg_postinst() { + xdg_pkg_postinst + local v + + for v in ${REPLACING_VERSIONS}; do + if ! ver_test ${v} -ge 2.2.2-r2 ; then + ewarn "The cupsd init script switched to using pidfiles. Shutting down" + ewarn "cupsd will fail the next time. To fix this, please run once as root" + ewarn " killall cupsd ; /etc/init.d/cupsd zap ; /etc/init.d/cupsd start" + break + fi + done + + for v in ${REPLACING_VERSIONS}; do + elog + elog "For information about installing a printer and general cups setup" + elog "take a look at: https://wiki.gentoo.org/wiki/Printing" + break + done + + optfeature_header "CUPS may need installing the following for certain features to work:" + use zeroconf && optfeature "local hostname resolution using a hostname.local naming scheme" sys-auth/nss-mdns +} diff --git a/net-print/libcupsfilters/Manifest b/net-print/libcupsfilters/Manifest index 3d1eb0d37cd5..c466f5c60ddd 100644 --- a/net-print/libcupsfilters/Manifest +++ b/net-print/libcupsfilters/Manifest @@ -2,7 +2,10 @@ AUX libcupsfilters-2.0.0-color-space.patch 8846 BLAKE2B 204e948b02db64854bc875fb AUX libcupsfilters-2.0.0-r3-c++17.patch 622 BLAKE2B a36f3b54b7047cbf1c7b8ff1a615d53fcaa23d9a5cda7abd8a565b40b05ebf3dbf277c7008d99f17d907fb3c3a5e38ff3726a6a56c0bf9c4821d1c11665acff2 SHA512 4bfed9113913b8788f111334df3fa08536c965d316f5b627d614914d6ef2bb14747b8eb25a6c9bd69a092a6082829a97468111c70f3717ce1c762737faddcb07 AUX libcupsfilters-2.0.0-raster-build-fix.patch 842 BLAKE2B 37abde9acc45311a62edc669498bef9d6f86e691de3c9632aec66ca575c5af9a0dab03b9e7bcf97ad1b927580825a98ee7dcad3fe3e00d1679e25ec7b0f0e843 SHA512 2e639d238c2dbb8646174c3b76c9b5c4450639c8fd0fd1969545d86370fe077f04720412e561108dde88bd86e8a29cf6fe2233a45398494b50a3f6908aa834aa AUX libcupsfilters-2.0.0-raster-gray.patch 1889 BLAKE2B 515b29df1141389262458205d1104f430f986f2ef5eefb9e2624c34715c4afd1f07b01deb57267fc322707f0799f8b31f17408c96af9f39c38d5eabbdc5eb678 SHA512 b63d639ac5472848a54f23bf0562dff58704b31864d753ce2f3502f56bd427feef4d2439f79e6fa20ab3bfcb61a4d0ac9f783c98716e09e1ed289c01ee570da2 +AUX libcupsfilters-2.1_beta1-CVE-2024-47076.patch 868 BLAKE2B 4820e50f9a6a43133a201e4488906ad910c8aee6d61a3f1612fc3a4f79ab2a59bf24b91e308959ae730c94782a972b440e723b846db93214de1b1c17ca2c3620 SHA512 e58464efafc9cbc661ed1dc467db523a078f44bd765cc17cd82e6583cfec48c864c012fa734a805717351dbcd874ceccd8bcadc9a7d2d243f0396c90cad3288e DIST libcupsfilters-2.0.0.tar.xz 1279856 BLAKE2B ce9d839bb700017c303c1301c7a97fd02e3657a908e685377be49557d995574a7fc5a31d4fcbda5eeb9ba2d3cd07858224540dbf0bc9fa078cfd25a58ee15a41 SHA512 279bff6dcfa76312b10dae97480914345defd90eab79c4716d4553870f73e0f9db404786fd7e2948a86ae5aedb10dca0c2984ccb4222acbd4e835cd572030d6a +DIST libcupsfilters-2.1b1.tar.xz 1443976 BLAKE2B 043174e47c6c5de5393cfb4d6f41e3839646932cff42cf677319b2ea22fe8408fbf1d1edfb3b99c1d2c36916a92993069a40ed5f75552d47d88300e283b6aa84 SHA512 5b0cd2472f54188dda13b091f82b257ba926e12065c225ddbde9cab97597baa6d855f09d7352b7d7ee4af8416fc9c3ddb3c75e0c6a0a201b366d047abe47ecef EBUILD libcupsfilters-2.0.0-r3.ebuild 1607 BLAKE2B 71c325100275ba46d3cd6fcbe992511c8c03f34fe22d6282ed6180572490de7d0ddb12f83d3a4fc9a7dcbd6414a659b47ec9b0bde6cc2a05f898b7b973906a96 SHA512 114b8120157f04c8d2e1852726cecfa048fec5946295a293f73553f11930b41d6bf5a4c2f1711bf05c4fd6a984528eb2299b3fe11691325c4dd52fdfd250715b EBUILD libcupsfilters-2.0.0-r5.ebuild 1726 BLAKE2B 6f958ce33fd46210b93b14d628cf39d9efb8dfe9318da2921b5627c0400f2555d16e48d50493f523bf1b24de426127ee5375038c83661f411e04dbf8950fe831 SHA512 6bdddedb3fef61e8906a61cd0e01b387abff91513d9c3228d24be1e53507d6b3fc484b3e086b7ea23263741951e8925913c214c572c38679692e6b9658d42e56 +EBUILD libcupsfilters-2.1_beta1.ebuild 1665 BLAKE2B 68a6a23af31c161fba66ed6748ef88e4fc0e9bbb716d5bf6b7da68e0123732af082f034a22b2d1aa64a81c8b8704b9946abc9213aee047c033b4b4862b399918 SHA512 c9beeee96fb4ce27380e854ef9c1af1f17b74ce7f4f90ea7f9c866cf8f1b2d7e8de44aef6a32ff0ce3fd46d246f3a7fbc9d0a8c36609eb7bbe0f941e0f0575dd MISC metadata.xml 426 BLAKE2B 60d605203c938ba35e60bc4dfa121d6fb0223d70fdd1bdea4ed02693034a46ff039a580f5c0a5925aa3c4c33220243503096b8de233f6031447a6425a974182a SHA512 04811e0d82ce0365308b4391a33e03da423dc924cc7ff16a2eeedbdb51705b9a62cffe67d7e25b9221a0b511caaa3b19c184301fbecc59056a282a811ad9df7e diff --git a/net-print/libcupsfilters/files/libcupsfilters-2.1_beta1-CVE-2024-47076.patch b/net-print/libcupsfilters/files/libcupsfilters-2.1_beta1-CVE-2024-47076.patch new file mode 100644 index 000000000000..016d086ea2b1 --- /dev/null +++ b/net-print/libcupsfilters/files/libcupsfilters-2.1_beta1-CVE-2024-47076.patch @@ -0,0 +1,31 @@ +https://bugs.gentoo.org/940313 +https://github.com/OpenPrinting/libcupsfilters/commit/95576ec3d20c109332d14672a807353cdc551018 + +From 95576ec3d20c109332d14672a807353cdc551018 Mon Sep 17 00:00:00 2001 +From: Zdenek Dohnal <zdohnal@redhat.com> +Date: Thu, 26 Sep 2024 23:09:29 +0200 +Subject: [PATCH] cfGetPrinterAttributes5(): Validate response attributes + before return + +The destination can be corrupted or forged, so validate the response +to strenghten security measures. + +Fixes CVE-2024-47076 +--- a/cupsfilters/ipp.c ++++ b/cupsfilters/ipp.c +@@ -404,6 +404,14 @@ cfGetPrinterAttributes5(http_t *http_printer, + ippDelete(response2); + } + } ++ ++ // Check if the response is valid ++ if (!ippValidateAttributes(response)) ++ { ++ ippDelete(response); ++ response = NULL; ++ } ++ + if (have_http == 0) httpClose(http_printer); + if (uri) free(uri); + return (response); + diff --git a/net-print/libcupsfilters/libcupsfilters-2.1_beta1.ebuild b/net-print/libcupsfilters/libcupsfilters-2.1_beta1.ebuild new file mode 100644 index 000000000000..6fc8a01f0022 --- /dev/null +++ b/net-print/libcupsfilters/libcupsfilters-2.1_beta1.ebuild @@ -0,0 +1,75 @@ +# Copyright 2023-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit libtool + +DESCRIPTION="library for developing printing features, split out of cups-filters" +HOMEPAGE="https://github.com/OpenPrinting/libcupsfilters" +SRC_URI="https://github.com/OpenPrinting/libcupsfilters/releases/download/${PV/_beta/b}/${P/_beta/b}.tar.xz" +S="${WORKDIR}"/${P/_beta/b} + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86" +IUSE="dbus exif jpeg pdf +poppler +postscript png test tiff" +RESTRICT="!test? ( test )" + +RDEPEND=" + >=app-text/qpdf-8.3.0:= + media-libs/fontconfig + media-libs/lcms:2 + >=net-print/cups-2 + !<net-print/cups-filters-2.0.0 + + exif? ( media-libs/libexif ) + dbus? ( sys-apps/dbus ) + jpeg? ( media-libs/libjpeg-turbo:= ) + pdf? ( app-text/mupdf ) + postscript? ( app-text/ghostscript-gpl[cups] ) + poppler? ( >=app-text/poppler-0.32:=[cxx] ) + png? ( media-libs/libpng:= ) + tiff? ( media-libs/tiff:= ) +" +DEPEND="${RDEPEND}" +BDEPEND=" + >=sys-devel/gettext-0.18.3 + virtual/pkgconfig + test? ( media-fonts/dejavu ) +" + +PATCHES=( + "${FILESDIR}"/${P}-CVE-2024-47076.patch +) + +src_prepare() { + default + + # respect --as-needed + elibtoolize +} + +src_configure() { + local myeconfargs=( + --enable-imagefilters + --localstatedir="${EPREFIX}"/var + --with-cups-rundir="${EPREFIX}"/run/cups + + $(use_enable exif) + $(use_enable dbus) + $(use_enable poppler) + $(use_enable postscript ghostscript) + $(use_enable pdf mutool) + $(use_with jpeg) + $(use_with png) + $(use_with tiff) + ) + + econf "${myeconfargs[@]}" +} + +src_install() { + default + find "${ED}" -name '*.la' -delete || die +} diff --git a/net-print/libppd/Manifest b/net-print/libppd/Manifest index 8bf6b978f342..763108704fd9 100644 --- a/net-print/libppd/Manifest +++ b/net-print/libppd/Manifest @@ -1,4 +1,8 @@ AUX libppd-2.0.0-slibtool.patch 2191 BLAKE2B 2a88a48542355d5f4189685979cd1cc24a992c4ad6c803e28d2420e7f974b962050d186d5cd7ec1642d22ac200137fe74e143df2270259d30ee6e30ee05e28b5 SHA512 d169bfaf4dd40917b197aa6d00b4ad9b1ad5d010781d492205c2656621bcadc1792ca5f589be97f8b9e15f431820c8af1c40cae5bf7fbf9fd14df8377cb1484a +AUX libppd-2.1_beta1-CVE-2024-47175.patch 22061 BLAKE2B 65b926bd5853f2f1cb6882412a21fc21e2a5440177efea99c5bdd887559f6fa5c941142c5525504459176504f18d11a90e89f786d23eb266d4c9df8a6832088b SHA512 59f4a0bb466b7cae7c5b38df7a3e3c761722defc395f8151ee80b840f67525743072a8df204514c51f6e687facb6ce32543c9f50bd123b5cddcaf7914dbf71dc DIST libppd-2.0.0.tar.xz 580716 BLAKE2B 8505c5ab5b515104308624a8f78505343b894df08ab8ac2727d7bd82d0d65d256d22ecaf384b212d9a5c45d2a619a6311722a8c5ed954b7a8a9780477aedb458 SHA512 8be9e67552528606fd804ba13b05710938ed7d02316c1c902ee657bc0e5fade663ffacb5b032609a1c1fdc80d976e7e54d2ca2f71db83cb8fdcee6a371e6bad4 +DIST libppd-2.1b1.tar.xz 583692 BLAKE2B f9889ba7758097d2f794b16bdd74758223036daa8e49b191d07789e36ad7e2d69693c9ebb0b89c1c52f23f90fee8b56e1532246da90b1898caf1c557a416c20c SHA512 2b1ab3444f9de4a856f116aae83fd2aaa61adec9862bdd6dcff5fe2672e593b1e69e4da3638994ac4762dcc0e2640c5e3cbf3af247017d3790f01ef10395f54a EBUILD libppd-2.0.0.ebuild 1539 BLAKE2B 98c5a87008151ab86a9aa4fcc788576063ae9d53d59acbbfbf44352b0e15d7fb8460a5395ca557bf5e995298a4c55c1f8f9156dc836368debc761518ae8e84fc SHA512 d3265c1eccc7ee79634e51f1aca38b3016c327434ff3b564195f73bd59853d1f80de6c968ed638eb7c8d3fbab4ff0d06a5b9aeadb6bfc30a91ed46d7016e51d3 +EBUILD libppd-2.1_beta1-r1.ebuild 1552 BLAKE2B 52aceb4656e75374160ee3fbe3cfcaac17d35185f86ee292d1aecd410126c448478ff9a0dd588dce7bd41001254bdf300fd55d4d34421a090c86e914da663b8a SHA512 7336fdf2ee5e900cf7c7090b306d74c847ff8f0e6fe5cb4fda97c648377901773d97097a8b097db35b92320428c3acbe60ebb0250fb5d6d116ba314301bb7982 +EBUILD libppd-2.1_beta1.ebuild 1498 BLAKE2B e57503b814c637e04b3f04a8515af1e76b65ce0374d2d27de1e3575329a159d93bd049b6f748eb235b8d60e17845a8168c8e8c06d53b2351bd5bac35fe1154dd SHA512 94d741fb94d76d75f107bfdeecad470c49a4c8a1369401e43da2b4e39c05de8b032b499877b1333d083317602dd55ac9ce67b7bc9de3a57eb0f5fb5c18d1ae78 MISC metadata.xml 440 BLAKE2B 8cc1e3fa25d2c12efb0253a37a0dedb484fcac5930deacd37bc09534e9210e72e58669a07efc0d40612a428d190b852064f6175083c852a8b3a4153101483905 SHA512 79801ac1a34f4e5fc46bd8c45c638dccde3168c701dfaffb51d626405e77fe0e8fa190b32c0b76150e51197223363dea0163086f172b0dccccd0c94fc5cb2d0b diff --git a/net-print/libppd/files/libppd-2.1_beta1-CVE-2024-47175.patch b/net-print/libppd/files/libppd-2.1_beta1-CVE-2024-47175.patch new file mode 100644 index 000000000000..60817509cdb3 --- /dev/null +++ b/net-print/libppd/files/libppd-2.1_beta1-CVE-2024-47175.patch @@ -0,0 +1,560 @@ +https://bugs.gentoo.org/940314 +https://github.com/OpenPrinting/libppd/commit/d681747ebf12602cb426725eb8ce2753211e2477 + +From d681747ebf12602cb426725eb8ce2753211e2477 Mon Sep 17 00:00:00 2001 +From: Zdenek Dohnal <zdohnal@redhat.com> +Date: Thu, 26 Sep 2024 23:12:14 +0200 +Subject: [PATCH] Prevent PPD generation based on invalid IPP response + +Author: Mike Sweet +Minor fixes: Zdenek Dohnal + +Fixes CVE-2024-47175 +--- a/ppd/ppd-cache.c ++++ b/ppd/ppd-cache.c +@@ -3434,7 +3435,7 @@ ppdCacheGetBin( + + // + // Range check input... +- ++ + + if (!pc || !output_bin) + return (NULL); +@@ -3935,7 +3936,7 @@ ppdCacheGetPageSize( + { + // + // Check not only the base size (like "A4") but also variants (like +- // "A4.Borderless"). We check only the margins and orientation but do ++ // "A4.Borderless"). We check only the margins and orientation but do + // not re-check the size. + // + +@@ -4776,7 +4777,7 @@ ppdPwgPpdizeName(const char *ipp, // I - IPP keyword + *end; // End of name buffer + + +- if (!ipp) ++ if (!ipp || !_ppd_isalnum(*ipp)) + { + *name = '\0'; + return; +@@ -4786,13 +4787,19 @@ ppdPwgPpdizeName(const char *ipp, // I - IPP keyword + + for (ptr = name + 1, end = name + namesize - 1; *ipp && ptr < end;) + { +- if (*ipp == '-' && _ppd_isalnum(ipp[1])) ++ if (*ipp == '-' && isalnum(ipp[1])) + { + ipp ++; + *ptr++ = (char)toupper(*ipp++ & 255); + } +- else ++ else if (*ipp == '_' || *ipp == '.' || *ipp == '-' || isalnum(*ipp)) ++ { + *ptr++ = *ipp++; ++ } ++ else ++ { ++ ipp ++; ++ } + } + + *ptr = '\0'; +--- a/ppd/ppd-generator.c ++++ b/ppd/ppd-generator.c +@@ -71,6 +72,7 @@ typedef struct _ppd_size_s // **** Media Size (cups_size_t of lib + + static int http_connect(http_t **http, const char *url, char *resource, + size_t ressize); ++static void ppd_put_string(cups_file_t *fp, cups_lang_t *lang, const char *ppd_option, const char *ppd_choice, const char *pwg_msgid); + + + // +@@ -80,7 +82,7 @@ static int http_connect(http_t **http, const char *url, char *resource, + // than CUPS 2.2.x. We have also an additional test and development + // platform for this code. Taken from cups/ppd-cache.c, + // cups/string-private.h, cups/string.c. +-// ++// + // The advantage of PPD generation instead of working with System V + // interface scripts is that the print dialogs of the clients do not + // need to ask the printer for its options via IPP. So we have access +@@ -144,7 +146,7 @@ char ppdgenerator_msg[1024]; + // IPP 1.x legacy) + // + +-char * // O - PPD filename or NULL ++char * // O - PPD filename or NULL + // on error + ppdCreatePPDFromIPP(char *buffer, // I - Filename buffer + size_t bufsize, // I - Size of filename +@@ -195,7 +197,7 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + cups_array_t *conflicts, // I - Array of + // constraints + cups_array_t *sizes, // I - Media sizes we've +- // added ++ // added + char* default_pagesize, // I - Default page size + const char *default_cluster_color, // I - cluster def + // color (if cluster's +@@ -207,6 +209,7 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + size_t status_msg_size) // I - Size of status + // message buffer + { ++ cups_lang_t *lang; // Localization language + cups_file_t *fp; // PPD file + cups_array_t *printer_sizes; // Media sizes we've added + _ppd_size_t *size; // Current media size +@@ -219,9 +222,10 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + ipp_t *media_col, // Media collection + *media_size; // Media size collection + char make[256], // Make and model +- *model, // Model name ++ *mptr, // Pointer into make and model + ppdname[PPD_MAX_NAME]; + // PPD keyword ++ const char *model; // Model name + int i, j, // Looping vars + count = 0, // Number of values + bottom, // Largest bottom margin +@@ -303,6 +307,68 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + return (NULL); + } + ++ // ++ // Get a sanitized make and model... ++ // ++ ++ if ((attr = ippFindAttribute(supported, "printer-make-and-model", IPP_TAG_TEXT)) != NULL && ippValidateAttribute(attr)) ++ { ++ // Sanitize the model name to only contain PPD-safe characters. ++ strlcpy(make, ippGetString(attr, 0, NULL), sizeof(make)); ++ ++ for (mptr = make; *mptr; mptr ++) ++ { ++ if (*mptr < ' ' || *mptr >= 127 || *mptr == '\"') ++ { ++ // Truncate the make and model on the first bad character... ++ *mptr = '\0'; ++ break; ++ } ++ } ++ ++ while (mptr > make) ++ { ++ // Strip trailing whitespace... ++ mptr --; ++ if (*mptr == ' ') ++ *mptr = '\0'; ++ } ++ ++ if (!make[0]) ++ { ++ // Use a default make and model if nothing remains... ++ strlcpy(make, "Unknown", sizeof(make)); ++ } ++ } ++ else ++ { ++ // Use a default make and model... ++ strlcpy(make, "Unknown", sizeof(make)); ++ } ++ ++ if (!strncasecmp(make, "Hewlett Packard ", 16) || !strncasecmp(make, "Hewlett-Packard ", 16)) ++ { ++ // Normalize HP printer make and model... ++ model = make + 16; ++ strlcpy(make, "HP", sizeof(make)); ++ ++ if (!strncasecmp(model, "HP ", 3)) ++ model += 3; ++ } ++ else if ((mptr = strchr(make, ' ')) != NULL) ++ { ++ // Separate "MAKE MODEL"... ++ while (*mptr && *mptr == ' ') ++ *mptr++ = '\0'; ++ ++ model = mptr; ++ } ++ else ++ { ++ // No separate model name... ++ model = "Printer"; ++ } ++ + // + // Standard stuff for PPD file... + // +@@ -331,25 +397,6 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + } + } + +- if ((attr = ippFindAttribute(supported, "printer-make-and-model", +- IPP_TAG_TEXT)) != NULL) +- strlcpy(make, ippGetString(attr, 0, NULL), sizeof(make)); +- else if (make_model && make_model[0] != '\0') +- strlcpy(make, make_model, sizeof(make)); +- else +- strlcpy(make, "Unknown Printer", sizeof(make)); +- +- if (!strncasecmp(make, "Hewlett Packard ", 16) || +- !strncasecmp(make, "Hewlett-Packard ", 16)) +- { +- model = make + 16; +- strlcpy(make, "HP", sizeof(make)); +- } +- else if ((model = strchr(make, ' ')) != NULL) +- *model++ = '\0'; +- else +- model = make; +- + cupsFilePrintf(fp, "*Manufacturer: \"%s\"\n", make); + cupsFilePrintf(fp, "*ModelName: \"%s %s\"\n", make, model); + cupsFilePrintf(fp, "*Product: \"(%s %s)\"\n", make, model); +@@ -445,21 +492,19 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + } + cupsFilePuts(fp, "\"\n"); + +- if ((attr = ippFindAttribute(supported, "printer-more-info", IPP_TAG_URI)) != +- NULL) ++ if ((attr = ippFindAttribute(supported, "printer-more-info", IPP_TAG_URI)) != NULL && ippValidateAttribute(attr)) + cupsFilePrintf(fp, "*APSupplies: \"%s\"\n", ippGetString(attr, 0, NULL)); + +- if ((attr = ippFindAttribute(supported, "printer-charge-info-uri", +- IPP_TAG_URI)) != NULL) +- cupsFilePrintf(fp, "*cupsChargeInfoURI: \"%s\"\n", ippGetString(attr, 0, +- NULL)); ++ if ((attr = ippFindAttribute(supported, "printer-charge-info-uri", IPP_TAG_URI)) != NULL && ippValidateAttribute(attr)) ++ cupsFilePrintf(fp, "*cupsChargeInfoURI: \"%s\"\n", ippGetString(attr, 0, NULL)); + + // Message catalogs for UI strings ++ lang = cupsLangDefault(); + opt_strings_catalog = cfCatalogOptionArrayNew(); + cfCatalogLoad(NULL, NULL, opt_strings_catalog); + + if ((attr = ippFindAttribute(supported, "printer-strings-uri", +- IPP_TAG_URI)) != NULL) ++ IPP_TAG_URI)) != NULL && ippValidateAttribute(attr)) + { + printer_opt_strings_catalog = cfCatalogOptionArrayNew(); + cfCatalogLoad(ippGetString(attr, 0, NULL), NULL, +@@ -512,7 +557,7 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + response = cupsDoRequest(http, request, resource); + + if ((attr = ippFindAttribute(response, "printer-strings-uri", +- IPP_TAG_URI)) != NULL) ++ IPP_TAG_URI)) != NULL && ippValidateAttribute(attr)) + cupsFilePrintf(fp, "*cupsStringsURI %s: \"%s\"\n", keyword, + ippGetString(attr, 0, NULL)); + +@@ -538,13 +583,10 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + IPP_TAG_BOOLEAN), 0)) + cupsFilePuts(fp, "*cupsJobAccountingUserId: True\n"); + +- if ((attr = ippFindAttribute(supported, "printer-privacy-policy-uri", +- IPP_TAG_URI)) != NULL) +- cupsFilePrintf(fp, "*cupsPrivacyURI: \"%s\"\n", +- ippGetString(attr, 0, NULL)); ++ if ((attr = ippFindAttribute(supported, "printer-privacy-policy-uri", IPP_TAG_URI)) != NULL && ippValidateAttribute(attr)) ++ cupsFilePrintf(fp, "*cupsPrivacyURI: \"%s\"\n", ippGetString(attr, 0, NULL)); + +- if ((attr = ippFindAttribute(supported, "printer-mandatory-job-attributes", +- IPP_TAG_KEYWORD)) != NULL) ++ if ((attr = ippFindAttribute(supported, "printer-mandatory-job-attributes", IPP_TAG_KEYWORD)) != NULL && ippValidateAttribute(attr)) + { + char prefix = '\"'; // Prefix for string + +@@ -564,8 +606,7 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + cupsFilePuts(fp, "\"\n"); + } + +- if ((attr = ippFindAttribute(supported, "printer-requested-job-attributes", +- IPP_TAG_KEYWORD)) != NULL) ++ if ((attr = ippFindAttribute(supported, "printer-requested-job-attributes", IPP_TAG_KEYWORD)) != NULL && ippValidateAttribute(attr)) + { + char prefix = '\"'; // Prefix for string + +@@ -684,7 +725,7 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + } + + // +- // Fax ++ // Fax + // + + if (is_fax) +@@ -734,21 +775,21 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + else if (cupsArrayFind(pdl_list, "image/urf") && + (ippFindAttribute(supported, "urf-supported", IPP_TAG_KEYWORD) != NULL)) + { +- int resStore = 0; // Variable for storing the no. of resolutions in the resolution array ++ int resStore = 0; // Variable for storing the no. of resolutions in the resolution array + int resArray[__INT16_MAX__]; // Creating a resolution array supporting a maximum of 32767 resolutions. + int lowdpi = 0, middpi = 0, hidpi = 0; // Lower , middle and higher resolution + if ((attr = ippFindAttribute(supported, "urf-supported", + IPP_TAG_KEYWORD)) != NULL) + { + for (int i = 0, count = ippGetCount(attr); i < count; i ++) +- { ++ { + const char *rs = ippGetString(attr, i, NULL); // RS values +- const char *rsCopy = ippGetString(attr, i, NULL); // RS values(copy) ++ const char *rsCopy = ippGetString(attr, i, NULL); // RS values(copy) + if (strncasecmp(rs, "RS", 2)) // Comparing attributes to have RS in + // the beginning to indicate the + // resolution feature + continue; +- int resCount = 0; // Using a count variable which can be reset ++ int resCount = 0; // Using a count variable which can be reset + while (*rsCopy != '\0') // Parsing through the copy pointer to + // determine the no. of resolutions + { +@@ -846,7 +887,7 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + formatfound = 1; + is_apple = 1; + } +- } ++ } + } + } + } +@@ -924,7 +965,7 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + if (manual_copies == 1) + cupsFilePuts(fp, "*cupsManualCopies: True\n"); + +- // No resolution requirements by any of the supported PDLs? ++ // No resolution requirements by any of the supported PDLs? + // Use "printer-resolution-supported" attribute + if (common_res == NULL) + { +@@ -1042,7 +1083,7 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + // + // PageSize/PageRegion/ImageableArea/PaperDimension + // +- ++ + cfGenerateSizes(supported, CF_GEN_SIZES_DEFAULT, &printer_sizes, &defattr, + NULL, NULL, NULL, NULL, NULL, NULL, + &min_width, &min_length, +@@ -1421,15 +1462,15 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + if (!strcmp(sources[j], keyword)) + break; + if (j >= 0) +- cupsFilePrintf(fp, "*InputSlot %s%s%s: \"<</MediaPosition %d>>setpagedevice\"\n", +- ppdname, +- (human_readable ? "/" : ""), +- (human_readable ? human_readable : ""), j); ++ { ++ cupsFilePrintf(fp, "*InputSlot %s: \"<</MediaPosition %d>>setpagedevice\"\n", ppdname, j); ++ ppd_put_string(fp, lang, "InputSlot", ppdname, human_readable); ++ } + else +- cupsFilePrintf(fp, "*InputSlot %s%s%s: \"\"\n", +- ppdname, +- (human_readable ? "/" : ""), +- (human_readable ? human_readable : "")); ++ { ++ cupsFilePrintf(fp, "*InputSlot %s%s%s:\"\"\n", ppdname, human_readable ? "/" : "", human_readable ? human_readable : ""); ++ ppd_put_string(fp, lang, "InputSlot", ppdname, human_readable); ++ } + } + cupsFilePuts(fp, "*CloseUI: *InputSlot\n"); + } +@@ -1464,11 +1505,8 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + human_readable = cfCatalogLookUpChoice((char *)keyword, "media-type", + opt_strings_catalog, + printer_opt_strings_catalog); +- cupsFilePrintf(fp, "*MediaType %s%s%s: \"<</MediaType(%s)>>setpagedevice\"\n", +- ppdname, +- (human_readable ? "/" : ""), +- (human_readable ? human_readable : ""), +- ppdname); ++ cupsFilePrintf(fp, "*MediaType %s: \"<</MediaType(%s)>>setpagedevice\"\n", ppdname, ppdname); ++ ppd_put_string(fp, lang, "MediaType", ppdname, human_readable); + } + cupsFilePuts(fp, "*CloseUI: *MediaType\n"); + } +@@ -1791,10 +1829,8 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + human_readable = cfCatalogLookUpChoice((char *)keyword, "output-bin", + opt_strings_catalog, + printer_opt_strings_catalog); +- cupsFilePrintf(fp, "*OutputBin %s%s%s: \"\"\n", +- ppdname, +- (human_readable ? "/" : ""), +- (human_readable ? human_readable : "")); ++ cupsFilePrintf(fp, "*OutputBin %s: \"\"\n", ppdname); ++ ppd_put_string(fp, lang, "OutputBin", ppdname, human_readable); + outputorderinfofound = 0; + faceupdown = 1; + firsttolast = 1; +@@ -1848,7 +1884,7 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + + // + // Finishing options... +- // ++ // + + if ((attr = ippFindAttribute(supported, "finishings-supported", + IPP_TAG_ENUM)) != NULL) +@@ -1973,9 +2009,8 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + human_readable = cfCatalogLookUpChoice(buf, "finishings", + opt_strings_catalog, + printer_opt_strings_catalog); +- cupsFilePrintf(fp, "*StapleLocation %s%s%s: \"\"\n", ppd_keyword, +- (human_readable ? "/" : ""), +- (human_readable ? human_readable : "")); ++ cupsFilePrintf(fp, "*StapleLocation %s: \"\"\n", ppd_keyword); ++ ppd_put_string(fp, lang, "StapleLocation", ppd_keyword, human_readable); + cupsFilePrintf(fp, "*cupsIPPFinishings %d/%s: \"*StapleLocation %s\"\n", + value, keyword, ppd_keyword); + } +@@ -2065,9 +2100,8 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + human_readable = cfCatalogLookUpChoice(buf, "finishings", + opt_strings_catalog, + printer_opt_strings_catalog); +- cupsFilePrintf(fp, "*FoldType %s%s%s: \"\"\n", ppd_keyword, +- (human_readable ? "/" : ""), +- (human_readable ? human_readable : "")); ++ cupsFilePrintf(fp, "*FoldType %s: \"\"\n", ppd_keyword); ++ ppd_put_string(fp, lang, "FoldType", ppd_keyword, human_readable); + cupsFilePrintf(fp, "*cupsIPPFinishings %d/%s: \"*FoldType %s\"\n", + value, keyword, ppd_keyword); + } +@@ -2164,9 +2198,8 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + human_readable = cfCatalogLookUpChoice(buf, "finishings", + opt_strings_catalog, + printer_opt_strings_catalog); +- cupsFilePrintf(fp, "*PunchMedia %s%s%s: \"\"\n", ppd_keyword, +- (human_readable ? "/" : ""), +- (human_readable ? human_readable : "")); ++ cupsFilePrintf(fp, "*PunchMedia %s: \"\"\n", ppd_keyword); ++ ppd_put_string(fp, lang, "PunchMedia", ppd_keyword, human_readable); + cupsFilePrintf(fp, "*cupsIPPFinishings %d/%s: \"*PunchMedia %s\"\n", + value, keyword, ppd_keyword); + } +@@ -2257,9 +2290,8 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + human_readable = cfCatalogLookUpChoice(buf, "finishings", + opt_strings_catalog, + printer_opt_strings_catalog); +- cupsFilePrintf(fp, "*CutMedia %s%s%s: \"\"\n", ppd_keyword, +- (human_readable ? "/" : ""), +- (human_readable ? human_readable : "")); ++ cupsFilePrintf(fp, "*CutMedia %s: \"\"\n", ppd_keyword); ++ ppd_put_string(fp, lang, "CutMedia", ppd_keyword, human_readable); + cupsFilePrintf(fp, "*cupsIPPFinishings %d/%s: \"*CutMedia %s\"\n", + value, keyword, ppd_keyword); + } +@@ -2283,7 +2315,7 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + cupsFilePrintf(fp, "*OpenUI *cupsFinishingTemplate/%s: PickOne\n", + (human_readable ? human_readable : "Finishing Template")); + cupsFilePuts(fp, "*OrderDependency: 10 AnySetup *cupsFinishingTemplate\n"); +- cupsFilePuts(fp, "*DefaultcupsFinishingTemplate: none\n"); ++ cupsFilePuts(fp, "*DefaultcupsFinishingTemplate: None\n"); + human_readable = cfCatalogLookUpChoice("3", "finishings", + opt_strings_catalog, + printer_opt_strings_catalog); +@@ -2314,8 +2346,9 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + printer_opt_strings_catalog); + if (human_readable == NULL) + human_readable = (char *)keyword; +- cupsFilePrintf(fp, "*cupsFinishingTemplate %s/%s: \"\n", keyword, +- human_readable); ++ ppdPwgPpdizeName(keyword, ppdname, sizeof(ppdname)); ++ cupsFilePrintf(fp, "*cupsFinishingTemplate %s: \"\n", ppdname); ++ ppd_put_string(fp, lang, "cupsFinishingTemplate", ppdname, human_readable); + for (finishing_attr = ippGetFirstAttribute(finishing_col); finishing_attr; + finishing_attr = ippGetNextAttribute(finishing_col)) { + if (ippGetValueTag(finishing_attr) == IPP_TAG_BEGIN_COLLECTION) { +@@ -2579,14 +2612,14 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + if (!preset || !preset_name) + continue; + +- if ((localized_name = ++ ppdPwgPpdizeName(preset_name, ppdname, sizeof(ppdname)); ++ ++ localized_name = + cfCatalogLookUpOption((char *)preset_name, + opt_strings_catalog, +- printer_opt_strings_catalog)) == NULL) +- cupsFilePrintf(fp, "*APPrinterPreset %s: \"\n", preset_name); +- else +- cupsFilePrintf(fp, "*APPrinterPreset %s/%s: \"\n", preset_name, +- localized_name); ++ printer_opt_strings_catalog); ++ cupsFilePrintf(fp, "*APPrinterPreset %s: \"\n", ppdname); ++ ppd_put_string(fp, lang, "APPrinterPreset", ppdname, localized_name); + + for (member = ippGetFirstAttribute(preset); member; + member = ippGetNextAttribute(preset)) +@@ -2635,7 +2668,10 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + ippGetString(ippFindAttribute(fin_col, + "finishing-template", + IPP_TAG_ZERO), 0, NULL)) != NULL) +- cupsFilePrintf(fp, "*cupsFinishingTemplate %s\n", keyword); ++ { ++ ppdPwgPpdizeName(keyword, ppdname, sizeof(ppdname)); ++ cupsFilePrintf(fp, "*cupsFinishingTemplate %s\n", ppdname); ++ } + } + } + else if (!strcmp(member_name, "media")) +@@ -2674,7 +2710,7 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + NULL)) != NULL) + { + ppdPwgPpdizeName(keyword, ppdname, sizeof(ppdname)); +- cupsFilePrintf(fp, "*InputSlot %s\n", keyword); ++ cupsFilePrintf(fp, "*InputSlot %s\n", ppdname); + } + + if ((keyword = ippGetString(ippFindAttribute(media_col, "media-type", +@@ -2682,7 +2718,7 @@ ppdCreatePPDFromIPP2(char *buffer, // I - Filename buffer + NULL)) != NULL) + { + ppdPwgPpdizeName(keyword, ppdname, sizeof(ppdname)); +- cupsFilePrintf(fp, "*MediaType %s\n", keyword); ++ cupsFilePrintf(fp, "*MediaType %s\n", ppdname); + } + } + else if (!strcmp(member_name, "print-quality")) +@@ -2832,3 +2868,38 @@ http_connect(http_t **http, // IO - Current HTTP connection + + return (*http != NULL); + } ++ ++ ++/* ++ * 'ppd_put_strings()' - Write localization attributes to a PPD file. ++ */ ++ ++static void ++ppd_put_string(cups_file_t *fp, /* I - PPD file */ ++ cups_lang_t *lang, /* I - Language */ ++ const char *ppd_option,/* I - PPD option */ ++ const char *ppd_choice,/* I - PPD choice */ ++ const char *text) /* I - Localized text */ ++{ ++ if (!text) ++ return; ++ ++ // Add the first line of localized text... ++#if CUPS_VERSION_MAJOR > 2 ++ cupsFilePrintf(fp, "*%s.%s %s/", cupsLangGetName(lang), ppd_option, ppd_choice); ++#else ++ cupsFilePrintf(fp, "*%s.%s %s/", lang->language, ppd_option, ppd_choice); ++#endif // CUPS_VERSION_MAJOR > 2 ++ ++ while (*text && *text != '\n') ++ { ++ // Escape ":" and "<"... ++ if (*text == ':' || *text == '<') ++ cupsFilePrintf(fp, "<%02X>", *text); ++ else ++ cupsFilePutChar(fp, *text); ++ ++ text ++; ++ } ++ cupsFilePuts(fp, ": \"\"\n"); ++} + diff --git a/net-print/libppd/libppd-2.1_beta1-r1.ebuild b/net-print/libppd/libppd-2.1_beta1-r1.ebuild new file mode 100644 index 000000000000..2d3bdb4a3484 --- /dev/null +++ b/net-print/libppd/libppd-2.1_beta1-r1.ebuild @@ -0,0 +1,58 @@ +# Copyright 2023-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="Legacy library for PPD files, split out of cups-filters" +HOMEPAGE="https://github.com/OpenPrinting/libppd" +SRC_URI="https://github.com/OpenPrinting/libppd/releases/download/${PV/_beta/b}/${P/_beta/b}.tar.xz" +S="${WORKDIR}"/${P/_beta/b} + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86" +IUSE="+postscript +poppler" + +# pdftops has various possible implementations, but the default +# really needs to be decent +REQUIRED_USE="|| ( postscript poppler )" + +RDEPEND=" + >=net-print/cups-2 + net-print/libcupsfilters + !<net-print/cups-filters-2.0.0 + sys-libs/zlib + postscript? ( >=app-text/ghostscript-gpl-9.09[cups] ) + poppler? ( >=app-text/poppler-0.32[utils] ) +" +DEPEND="${RDEPEND}" +BDEPEND=" + >=sys-devel/gettext-0.18.3 + virtual/pkgconfig +" + +PATCHES=( + "${FILESDIR}"/${P}-CVE-2024-47175.patch +) + +src_configure() { + local myeconfargs=( + --localstatedir="${EPREFIX}"/var + --with-cups-rundir="${EPREFIX}"/run/cups + # This does build time checks for (preferred) tool interfaces. + $(use_enable postscript ghostscript) + $(use_enable poppler pdftops) + # These fallbacks are just probed for the path. Always enable them. + --with-mutool-path="${EPREFIX}"/usr/bin/mutool + --with-pdftocairo-path="${EPREFIX}"/usr/bin/pdftocairo # from poppler + # unpackaged + --disable-acroread + ) + + econf "${myeconfargs[@]}" +} + +src_install() { + default + find "${ED}" -name '*.la' -delete || die +} diff --git a/net-print/libppd/libppd-2.1_beta1.ebuild b/net-print/libppd/libppd-2.1_beta1.ebuild new file mode 100644 index 000000000000..facbdf57cdc0 --- /dev/null +++ b/net-print/libppd/libppd-2.1_beta1.ebuild @@ -0,0 +1,54 @@ +# Copyright 2023-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="Legacy library for PPD files, split out of cups-filters" +HOMEPAGE="https://github.com/OpenPrinting/libppd" +SRC_URI="https://github.com/OpenPrinting/libppd/releases/download/${PV/_beta/b}/${P/_beta/b}.tar.xz" +S="${WORKDIR}"/${P/_beta/b} + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86" +IUSE="+postscript +poppler" + +# pdftops has various possible implementations, but the default +# really needs to be decent +REQUIRED_USE="|| ( postscript poppler )" + +RDEPEND=" + >=net-print/cups-2 + net-print/libcupsfilters + !<net-print/cups-filters-2.0.0 + sys-libs/zlib + postscript? ( >=app-text/ghostscript-gpl-9.09[cups] ) + poppler? ( >=app-text/poppler-0.32[utils] ) +" +DEPEND="${RDEPEND}" +BDEPEND=" + >=sys-devel/gettext-0.18.3 + virtual/pkgconfig +" + +src_configure() { + local myeconfargs=( + --localstatedir="${EPREFIX}"/var + --with-cups-rundir="${EPREFIX}"/run/cups + # This does build time checks for (preferred) tool interfaces. + $(use_enable postscript ghostscript) + $(use_enable poppler pdftops) + # These fallbacks are just probed for the path. Always enable them. + --with-mutool-path="${EPREFIX}"/usr/bin/mutool + --with-pdftocairo-path="${EPREFIX}"/usr/bin/pdftocairo # from poppler + # unpackaged + --disable-acroread + ) + + econf "${myeconfargs[@]}" +} + +src_install() { + default + find "${ED}" -name '*.la' -delete || die +} |