commit 1dc6c43965124c337d89fcd302433cc72330a164 Author: MSVSphere Packaging Team Date: Fri Dec 20 13:39:48 2024 +0300 import pappl-retrofit-1.0b2-5.el10 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1770386 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/pappl-retrofit-1.0b2.tar.gz diff --git a/.pappl-retrofit.metadata b/.pappl-retrofit.metadata new file mode 100644 index 0000000..95abec2 --- /dev/null +++ b/.pappl-retrofit.metadata @@ -0,0 +1 @@ +8d02c46a8f8d942425d0508a5b4dcf63bd72ce51 SOURCES/pappl-retrofit-1.0b2.tar.gz diff --git a/SOURCES/0001-Added-man-page-for-the-Legacy-Printer-Application.patch b/SOURCES/0001-Added-man-page-for-the-Legacy-Printer-Application.patch new file mode 100644 index 0000000..9b081f6 --- /dev/null +++ b/SOURCES/0001-Added-man-page-for-the-Legacy-Printer-Application.patch @@ -0,0 +1,162 @@ +From 33be36f28f1be2870594c7aa5bcdf3fc42a186ca Mon Sep 17 00:00:00 2001 +From: Till Kamppeter +Date: Thu, 17 Aug 2023 23:57:43 +0200 +Subject: [PATCH] Added man page for the Legacy Printer Application + +As the Legacy Printer Application is a useful utility for end users, +allowing them to continue using proprietary CUPS drivers for their +legacy printers after updating to CUPS 3.x or to the CUPS Snap, we add +a man page for it now, as we have already man pages for the other +Printer Applications: PostScript, Ghostscript, HPLIP, and Gutenprint +Printer Application. +--- + Makefile.am | 13 +++++ + legacy/legacy-printer-app.1 | 112 ++++++++++++++++++++++++++++++++++++ + 2 files changed, 125 insertions(+) + create mode 100644 legacy/legacy-printer-app.1 + +diff --git a/Makefile.am b/Makefile.am +index 76008e5..e127c85 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -82,6 +82,19 @@ legacy_printer_app_CFLAGS = \ + EXTRA_DIST += \ + legacy/legacy-printer-app.service + ++# ========= ++# Man pages ++# ========= ++ ++man_MANS = ++ ++legacy_printer_app_manpages = \ ++ legacy/legacy-printer-app.1 ++man_MANS += $(legacy_printer_app_manpages) ++ ++EXTRA_DIST += \ ++ $(legacy_printer_app_manpages) ++ + # =========== + # Directories + # =========== +diff --git a/legacy/legacy-printer-app.1 b/legacy/legacy-printer-app.1 +new file mode 100644 +index 0000000..d45e9df +--- /dev/null ++++ b/legacy/legacy-printer-app.1 +@@ -0,0 +1,112 @@ ++.\" ++.\" Legacy Printer Application man page ++.\" ++.\" Copyright © 2020 by Till Kamppeter ++.\" Copyright © 2020 by Michael R Sweet ++.\" ++.\" Licensed under Apache License v2.0. See the file "LICENSE" for more ++.\" information. ++.\" ++.TH legacy-printer-app 1 "legacy-printer-app" "2023-08-17" "OpenPrinting" ++.SH NAME ++legacy-printer-app \- Legacy Printer Application ++.SH SYNOPSIS ++.B legacy-printer-app ++[ ++.I SUB-COMMAND ++] [ OPTIONS ] [ FILES ] ++.SH DESCRIPTION ++.B legacy-printer-app ++is a Printer Application that can be run standalone or as a dedicated IPP Everywhere network service. ++.B legacy-printer-app ++maps arbitrary classic CUPS drivers to the Printer Application format. If on a system there is no classic installation (DEB, RPM, ... packages, installation from source) of CUPS 2.x or older, but instead, CUPS 3.x or newer is used and/or the CUPS Snap, claasic CUPS drivers are not supported any more and printer drivers can only be provided by means of Printer Applications. ++.B legacy-printer-app ++finds classic CUPS drivers in the locations where they are usually installed for being found by the distribution's classic CUPS 2.x installation, typically filters in /usr/lib/cups/filter, backends in /usr/lib/cups/backend, PPD files (and files generating PPDs) in /usr/share/ppd, /usr/share/cups/model/, /usr/share/cups/drv, and /usr/lib/cups/driver. When opening the Printer Application's web interface (http://localhost:8000/, http://localhost:8001/, ...) and clicking "Add Printer" printers are discovered and available classic drivers offered. Once setting up a printer it gets available as an emulation of a driverless IPP printer and the Printer Application uses the classically installed driver. A classic installation of CUPS or any general CUPS filters (cups-filters package) is not needed. ++ ++This way classic CUPS drivers for which no equivalent Printer Application is available, especially manufacturer-supplied proprietary drivers for legacy printers, can be continued to be used with CUPS 3.x or the CUPS Snap. ++ ++.SH SUB-COMMANDS ++If no sub-command is specified, "submit" is assumed. ++ ++The following sub-commands are recognized by ++.B legacy-printer-app: ++.TP 5 ++add ++Add a printer queue. ++.TP 5 ++cancel ++Cancel one or more print jobs. ++.TP 5 ++default ++Get/Set the default printer queue. ++.TP 5 ++delete ++Delete a printer queue. ++.TP 5 ++devices ++List connected printers. ++.TP 5 ++drivers ++List the supported drivers. ++.TP 5 ++jobs ++List pending print jobs. ++.TP 5 ++modify ++Modify a printer queue. ++.TP 5 ++options ++List supported options. ++.TP 5 ++printers ++List the printer queues. ++.TP 5 ++server ++Start a server. ++.TP 5 ++shutdown ++Shutdown a running server. ++.TP 5 ++status ++Show the status of a printer or all printers. ++.TP 5 ++submit ++Submit a file for printing. ++.SH OPTIONS ++The following options are recognized by ++.B legacy-printer-app: ++.TP 5 ++-a ++Cancel all jobs. ++.TP 5 ++-d PRINTER ++Specify printer. ++.TP 5 ++-h HOST ++Specify hostname. ++.TP 5 ++-j JOB-ID ++Specify job ID. ++.TP 5 ++-m DRIVER-NAME ++Specify driver. ++.TP 5 ++-n COPIES ++Specify number of copies. ++.TP 5 ++-o NAME=VALUE ++Specify option. ++.TP 5 ++-t TITLE ++Specify job title. ++.TP 5 ++-u URI ++Specify ipp: or ipps: printer/server. ++.TP 5 ++-v DEVICE-URI ++Specify socket: or usb: device. ++.SH SEE ALSO ++https://github.com/OpenPrinting/pappl-retrofit ++.SH COPYRIGHT ++Copyright \[co] 2020 by Till Kamppeter. ++Copyright \[co] 2020 by Michael R Sweet. +-- +2.43.0 + diff --git a/SOURCES/0001-Use-PAPPL-configuration-options-from-file.patch b/SOURCES/0001-Use-PAPPL-configuration-options-from-file.patch new file mode 100644 index 0000000..06c9c4c --- /dev/null +++ b/SOURCES/0001-Use-PAPPL-configuration-options-from-file.patch @@ -0,0 +1,98 @@ +From f1cfd4bdd916568712347c42ca8e7268e4e76171 Mon Sep 17 00:00:00 2001 +From: Zdenek Dohnal +Date: Mon, 29 Jul 2024 16:14:48 +0200 +Subject: [PATCH] Use PAPPL configuration options from file + +My previous commit added possibility to configure legacy-printer-app to +be run with different options when the service is started. However PAPPL +supports reading configuration files, which can happen either in default +system callback defined in PAPPL, or by specific system callback defined +by the application. + +The change updates `_prSystemCB()` to accept different server options, +the same way as lprint or default PAPPL system callback does. This way +the retrofitting printer application and lprint can use the same way of +configuration. +--- + configure.ac | 75 ---------------------------- + legacy/legacy-printer-app.service | 10 ++++ + legacy/legacy-printer-app.service.in | 10 ---- + pappl-retrofit/pappl-retrofit.c | 44 +++++++++++++++- + 4 files changed, 52 insertions(+), 87 deletions(-) + create mode 100644 legacy/legacy-printer-app.service + delete mode 100644 legacy/legacy-printer-app.service.in + +diff --git a/pappl-retrofit/pappl-retrofit.c b/pappl-retrofit/pappl-retrofit.c +index dfbf570..7627164 100644 +--- a/pappl-retrofit/pappl-retrofit.c ++++ b/pappl-retrofit/pappl-retrofit.c +@@ -4553,6 +4553,7 @@ _prSystemCB(int num_options, // I - Number of options + pappl_system_t *system; // System object + const char *val, // Current option value + *hostname, // Hostname, if any ++ *listenhost, // Listen hostname, if any + *logfile, // Log file, if any + *system_name; // System name, if any + pappl_loglevel_t loglevel; // Log level +@@ -4599,8 +4600,43 @@ _prSystemCB(int num_options, // I - Number of options + else + loglevel = PAPPL_LOGLEVEL_UNSPEC; + +- logfile = cupsGetOption("log-file", num_options, options); ++ if ((val = cupsGetOption("server-options", num_options, options)) != NULL) ++ { ++ const char *valptr; // Pointer into value ++ ++ for (valptr = val; valptr && *valptr;) ++ { ++ if (!strcmp(valptr, "none") || !strncmp(valptr, "none,", 5)) ++ soptions = PAPPL_SOPTIONS_NONE; ++ else if (!strcmp(valptr, "dnssd-host") || !strncmp(valptr, "dnssd-host,", 11)) ++ soptions |= PAPPL_SOPTIONS_DNSSD_HOST; ++ else if (!strcmp(valptr, "no-multi-queue") || !strncmp(valptr, "no-multi-queue,", 15)) ++ soptions &= (pappl_soptions_t)~PAPPL_SOPTIONS_MULTI_QUEUE; ++ else if (!strcmp(valptr, "raw-socket") || !strncmp(valptr, "raw-socket,", 11)) ++ soptions |= PAPPL_SOPTIONS_RAW_SOCKET; ++ else if (!strcmp(valptr, "usb-printer") || !strncmp(valptr, "usb-printer,", 12)) ++ soptions |= PAPPL_SOPTIONS_USB_PRINTER; ++ else if (!strcmp(valptr, "no-web-interface") || !strncmp(valptr, "no-web-interface,", 17)) ++ soptions &= (pappl_soptions_t)~PAPPL_SOPTIONS_WEB_INTERFACE; ++ else if (!strcmp(valptr, "web-log") || !strncmp(valptr, "web-log,", 8)) ++ soptions |= PAPPL_SOPTIONS_WEB_LOG; ++ else if (!strcmp(valptr, "web-network") || !strncmp(valptr, "web-network,", 12)) ++ soptions |= PAPPL_SOPTIONS_WEB_NETWORK; ++ else if (!strcmp(valptr, "web-remote") || !strncmp(valptr, "web-remote,", 11)) ++ soptions |= PAPPL_SOPTIONS_WEB_REMOTE; ++ else if (!strcmp(valptr, "web-security") || !strncmp(valptr, "web-security,", 13)) ++ soptions |= PAPPL_SOPTIONS_WEB_SECURITY; ++ else if (!strcmp(valptr, "no-tls") || !strncmp(valptr, "no-tls,", 7)) ++ soptions |= PAPPL_SOPTIONS_NO_TLS; ++ ++ if ((valptr = strchr(valptr, ',')) != NULL) ++ valptr ++; ++ } ++ } ++ ++ listenhost = cupsGetOption("listen-hostname", num_options, options); + hostname = cupsGetOption("server-hostname", num_options, options); ++ logfile = cupsGetOption("log-file", num_options, options); + system_name = cupsGetOption("system-name", num_options, options); + + if ((val = cupsGetOption("server-port", num_options, options)) != NULL) +@@ -4744,8 +4780,12 @@ _prSystemCB(int num_options, // I - Number of options + + global_data->system = system; + +- papplSystemAddListeners(system, NULL); ++ papplSystemAddListeners(system, listenhost); + papplSystemSetHostName(system, hostname); ++ ++ if ((val = cupsGetOption("admin-group", num_options, options)) != NULL) ++ papplSystemSetAdminGroup(system, val); ++ + _prSetup(global_data); + + // Extra setup steps for the system (like adding buttos/pages) +-- +2.45.2 + diff --git a/SOURCES/0001-pappl-retrofit-private.h-Add-include-cups-sidechanne.patch b/SOURCES/0001-pappl-retrofit-private.h-Add-include-cups-sidechanne.patch new file mode 100644 index 0000000..a1631bf --- /dev/null +++ b/SOURCES/0001-pappl-retrofit-private.h-Add-include-cups-sidechanne.patch @@ -0,0 +1,26 @@ +From 0317fae79cef0c2ed47850183bf64116004ad3c7 Mon Sep 17 00:00:00 2001 +From: Till Kamppeter +Date: Thu, 27 Apr 2023 20:18:48 +0200 +Subject: [PATCH] pappl-retrofit-private.h: Add "#include " + +Seems that some other *.h file, of CUPS or PAPPL most probably, +does not include cups/sidechannel.h any more. +--- + pappl-retrofit/pappl-retrofit-private.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/pappl-retrofit/pappl-retrofit-private.h b/pappl-retrofit/pappl-retrofit-private.h +index 86dd010..efa8311 100644 +--- a/pappl-retrofit/pappl-retrofit-private.h ++++ b/pappl-retrofit/pappl-retrofit-private.h +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +2.43.0 + diff --git a/SOURCES/legacy-printer-app.conf b/SOURCES/legacy-printer-app.conf new file mode 100644 index 0000000..b8de2ae --- /dev/null +++ b/SOURCES/legacy-printer-app.conf @@ -0,0 +1,14 @@ +# multi-queue - Support multiple print queues. +# web-interface - Web UI. +# raw-socket - Provide a raw ("JetDirect") socket for each printer on port 91xx. +# web-network - Enables the network settings web page. +# web-remote - Enables remote queue management. +# web-security - Enables the user/password settings web page. +# web-tls - Enables the TLS settings web page. +server-options=multi-queue,web-interface,raw-socket,web-network,web-security,web-tls + +# server-port - Listens for IPP connections on the specified port. +server-port=8001 + +# default log level - info, available levels: fatal, error, warn, info, debug +log-level=info diff --git a/SOURCES/pappl-retrofit-use-after-free.patch b/SOURCES/pappl-retrofit-use-after-free.patch new file mode 100644 index 0000000..9df8ba4 --- /dev/null +++ b/SOURCES/pappl-retrofit-use-after-free.patch @@ -0,0 +1,17 @@ +diff --git a/pappl-retrofit/cups-backends.c b/pappl-retrofit/cups-backends.c +index b5d1643..bbb80f4 100644 +--- a/pappl-retrofit/cups-backends.c ++++ b/pappl-retrofit/cups-backends.c +@@ -586,11 +586,11 @@ _prCUPSDevList(pappl_device_cb_t cb, + // Check whether we have a duplicate and if so, skip it + if (cupsArrayFind(devices, device)) + { +- free(device); + _prCUPSDevLog(&devlog_data, PAPPL_LOGLEVEL_DEBUG, + "Duplicate device from backend '%s' skipped: %s (URI: %s Device ID: %s)", + backends[i].name, info, device->device_uri, + device_id); ++ free(device); + } + else + { diff --git a/SPECS/pappl-retrofit.spec b/SPECS/pappl-retrofit.spec new file mode 100644 index 0000000..e5bb4b2 --- /dev/null +++ b/SPECS/pappl-retrofit.spec @@ -0,0 +1,189 @@ +# the original SPEC file was created by Brandon Nielsen in his COPR repo and this comment +# is to honor his great contribution - thank you for all you work, Brandon! + +%global serverbin /usr/lib/ + +%if 0%{?fedora} +%bcond_without mdns +%else +%bcond_with mdns +%endif + +Name: pappl-retrofit +Version: 1.0b2 +Release: 5%{?dist} +# 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 +Summary: Library for common functions used in retrofitting printer applications +URL: https://github.com/OpenPrinting/pappl-retrofit/ +Source0: %{URL}/releases/download/%{version}/pappl-retrofit-%{version}.tar.gz +Source1: legacy-printer-app.conf + +# Patches +# FTBFS +# https://github.com/OpenPrinting/pappl-retrofit/commit/0317fae79ce +Patch001: 0001-pappl-retrofit-private.h-Add-include-cups-sidechanne.patch +# add man page +# https://github.com/OpenPrinting/pappl-retrofit/commit/33be36f28 +Patch002: 0001-Added-man-page-for-the-Legacy-Printer-Application.patch +# fix use after free +# part of https://github.com/OpenPrinting/pappl-retrofit/commit/eebb36724a62 +Patch003: pappl-retrofit-use-after-free.patch +# https://github.com/OpenPrinting/pappl-retrofit/pull/27 +Patch004: 0001-Use-PAPPL-configuration-options-from-file.patch + + +# for autogen.sh - generating configure scripts +BuildRequires: autoconf +# for autogen.sh - generating Makefiles +BuildRequires: automake +# for autopoint +BuildRequires: gettext-devel +# compiled by gcc +BuildRequires: gcc +# for autosetup +BuildRequires: git-core +# uses make +BuildRequires: make +# uses libtool during build +BuildRequires: libtool +# supports PAM authentication +BuildRequires: pam-devel +# for pkg-config in configure and in SPEC file +BuildRequires: pkgconf-pkg-config +# CUPS API for arrays, IPP etc. +BuildRequires: pkgconfig(cups) >= 2.2.0 +# API for filter functions +BuildRequires: pkgconfig(libcupsfilters) >= 2.0b2 +# API for loading PPDs and its conversion to IPP +BuildRequires: pkgconfig(libppd) >= 2.0b2 +# printer application library for common objects +BuildRequires: pkgconfig(pappl) >= 1.1b2 +# used to fix unused shlib dependency error from rpmlint +BuildRequires: sed +# uses systemd macros in %%files +BuildRequires: systemd-rpm-macros + + +%description +This library together with PAPPL and cups-filters 2.x allows to convert classic +CUPS printer drivers into Printer Applications. This way the printer appears as +an emulated IPP printer and one can print on it from practically any operating +system, especially also mobile operating systems and IoT platforms, +without need any client-side driver. + +%package devel +Summary: Development environment for pappl-retrofit +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +This package provides the pappl-retrofit headers and development environment. + +%package -n legacy-printer-app +Summary: Legacy printer application + +# virtual provide for /usr/sbin -> /usr/bin link +# the original daemon is installed in /usr/sbin +Provides: /usr/bin/legacy-printer-app + +%if %{with mdns} +# Avahi has to run for mDNS support +Recommends: avahi +# if we go for mDNS, we need a resolver +Recommends: nss-mdns +%endif +# recommend CUPS, the daemon which usually picks up IPP services +Recommends: cups + +Requires: %{name}%{?_isa} = %{version}-%{release} +# for password-auth PAM module +Requires: authselect-libs +# it is needed for providing /usr/lib/cups as well +Requires: cups-filesystem + +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd + +%description -n legacy-printer-app +Legacy printer application provides support for classic printer drivers +which are not part of official Linux repositories - it enables possibility +to set your printer with proprietary printer drivers from manufacturers, +so such printer will be seen by CUPS. + + +%prep +%autosetup -S git + + +%build +%configure --enable-legacy-printer-app-as-daemon\ + --enable-shared\ + --disable-static\ + --disable-silent-rules + +sed -i -e 's! -shared ! -Wl,--as-needed\0!g' libtool + +%make_build + + +%install +%make_install + +# Remove license files from doc +rm -f %{buildroot}/%{_docdir}/%{name}/{LICENSE,NOTICE,COPYING} + +# remove symlink, we need it in /usr/lib +rm -f %{buildroot}/%{_libdir}/legacy-printer-app +ln -sf /usr/lib/cups %{buildroot}/%{serverbin}/legacy-printer-app + +install -p -D -m 0644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/legacy-printer-app.conf + + +%check +make check + + +%post -n legacy-printer-app +%systemd_post legacy-printer-app.service + +%preun -n legacy-printer-app +%systemd_preun legacy-printer-app.service + +%postun -n legacy-printer-app +%systemd_postun_with_restart legacy-printer-app.service + +%files +%license LICENSE NOTICE COPYING +%doc AUTHORS README.md +%{_libdir}/libpappl-retrofit.so.1 +%{_libdir}/libpappl-retrofit.so.1.0.0 + +%files devel +%{_docdir}/%{name}/CONTRIBUTING.md +%{_docdir}/%{name}/DEVELOPING.md +%{_includedir}/pappl-retrofit.h +%{_libdir}/libpappl-retrofit.so +%{_libdir}/pkgconfig/libpappl-retrofit.pc + +%files -n legacy-printer-app +%config(noreplace) %{_sysconfdir}/legacy-printer-app.conf +%{_sbindir}/legacy-printer-app +%{_unitdir}/legacy-printer-app.service +%dir %{_datadir}/legacy-printer-app +%{_datadir}/legacy-printer-app/testpage.ps +%{_datadir}/legacy-printer-app/testpage.pdf +# this symlink is required if the app should use CUPS backends/filters +# in /usr/lib/cups +%{serverbin}/legacy-printer-app +%{_mandir}/man1/legacy-printer-app.1.gz + +%changelog +* Fri Dec 20 2024 MSVSphere Packaging Team - 1.0b2-5 +- Rebuilt for MSVSphere 10 + +* Wed Dec 04 2024 Zdenek Dohnal - 1.0b2-5 +- Initial commit on c10s + Resolves: RHEL-25298