Merge ~jchittum/ubuntu/+source/cups:merge-lp2130070-resolute into ubuntu/+source/cups:debian/sid

Proposed by John Chittum
Status: Needs review
Proposed branch: ~jchittum/ubuntu/+source/cups:merge-lp2130070-resolute
Merge into: ubuntu/+source/cups:debian/sid
Diff against target: 2532 lines (+2291/-17)
8 files modified
debian/changelog (+748/-0)
debian/control (+5/-2)
debian/libcups2-dev.install (+1/-0)
debian/local/apparmor-profile (+7/-4)
debian/patches/9100-ppd-cache-add-auto-presets.patch (+1526/-0)
debian/patches/series (+1/-0)
debian/rules (+3/-4)
dev/null (+0/-7)
Reviewer Review Type Date Requested Status
Nick Rosbrook (community) Approve
Skia Pending
git-ubuntu import Pending
Review via email: mp+496994@code.launchpad.net
To post a comment you must log in.
Revision history for this message
John Chittum (jchittum) :
Revision history for this message
Nick Rosbrook (enr0n) wrote (last edit ):

Thanks for the work here. A couple of comments before it's ready.

(1) Rather than having a single commit for all of debian/rules, please split this into commits for each logical change. The same applies to debian/control.

For example, I don't think the "--enable-snapped-clients" delta and the "--enable-gnutls" delta in debian/rules are related. These should be separate logical commits.

On the other hand, the pkgconfig changes in debian/rules *is* tied to the debian/libcups2-dev.install and debian/cups.pc.in delta. Maybe that should represent one logical commit.

(2) I don't actually see a mention of the debian/rules delta in the changelog, so please add that.

(3) I think you are probably right that the "refresh patches" delta is unnecessary. Please try dropping that.

(4) One other note on the changelog - it deviates considerably from previous merge changelogs, but I don't think it necessarily adds context. In some cases, I think it removes information (like what's going on overall with the pkgconfig delta).

Please try not to remove too much of the long-standing entries for the delta. I think it's fine to add context in a way that doesn't considerably alter the existing text though.

One thing that might be helpful is using the --CL-- trick in the commit messages so that you can associate more context in the git commit, while not necessarily impacting the changelog itself.

review: Needs Fixing
f430ac3... by John Chittum

d/rules --with-tls=gnutls

    - In debian/rules updated "./configure" arguments from "--enable-gnutls" to
      "--with-tls=gnutls". Now libcups has support for all hash types again,
      especially can provide sha2-256 to PAPPL.

9bcd5a3... by John Chittum

d/rules --enable-snapped-clients

    - Added "--enable-snapped-clients" to the "./configure" options to use
      the correct Snap mediation mode for an unsnapped cupsd, like provided
      by this package.

2511a36... by John Chittum

pkgconfig file from upstream

    - Use pkgconfig file cups.pc from upstream and not Debian's own file
      of CUPS' pre-pkgconfig era. also use
      "--with-pkgconfpath=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig" in the
      "./configure" command line therefore.

c3557b2... by John Chittum

d/ch 2.4.16-1ubuntu1 cleanup

Revision history for this message
Nick Rosbrook (enr0n) wrote :

Thanks for the follow up on this. LGTM.

Note that "d/control updates" *should* still be broken into two commits (the additions are not related), but no big deal.

Uploading.

review: Approve

Unmerged commits

c3557b2... by John Chittum

d/ch 2.4.16-1ubuntu1 cleanup

d5c71a9... by John Chittum

reconstruct-changelog

374f29f... by John Chittum

merge-changelogs

f687caa... by Ryan Lee

debian/local/apparmor-profile: add rule for accessing /etc/paperspecs (LP: #2125520)

ca58374... by Ryan Lee

debian/local/apparmor-profile: update for new coreutil paths (LP: #2123870)

bf2e2e5... by John Chittum

d/control updates

- Build-depend on libapparmor-dev, libsnapd-glib-dev, needed for
  Snap mediation.

- In libcupsimage2 recommend libcupsfilters2 instead of libcupsfilters1.

8454ebf... by John Chittum

d/local/apparmor-profile

In the AppArmor profile allow CUPS to access (/var)/run/snapd.socket
to allow cupsd to determine which interfaces a snapped client
is plugging.

2511a36... by John Chittum

pkgconfig file from upstream

    - Use pkgconfig file cups.pc from upstream and not Debian's own file
      of CUPS' pre-pkgconfig era. also use
      "--with-pkgconfpath=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig" in the
      "./configure" command line therefore.

9bcd5a3... by John Chittum

d/rules --enable-snapped-clients

    - Added "--enable-snapped-clients" to the "./configure" options to use
      the correct Snap mediation mode for an unsnapped cupsd, like provided
      by this package.

f430ac3... by John Chittum

d/rules --with-tls=gnutls

    - In debian/rules updated "./configure" arguments from "--enable-gnutls" to
      "--with-tls=gnutls". Now libcups has support for all hash types again,
      especially can provide sha2-256 to PAPPL.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index a214a89..92f402b 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,45 @@
6+cups (2.4.16-1ubuntu1) resolute; urgency=medium
7+
8+ * Merge with Debian unstable. (LP: #2130070) Remaining changes:
9+ - d/p/9100-ppd-cache-add-auto-presets.patch
10+ Added fully automatic generation of PPD option setting presets to
11+ be applied depending on the settings of the job IPP attributes
12+ "print-color-mode", "print-quality", and "print-content-optimize".
13+ This allows easy control of any printer with only standard IPP
14+ attributes, as for example from a phone (functionality overtaken
15+ from cups-filters, not (yet) upstream in CUPS).
16+ - d/libcups2-dev.install, d/rules
17+ Use pkgconfig file cups.pc from upstream and not Debian's own file
18+ of CUPS' pre-pkgconfig era. also use
19+ "--with-pkgconfpath=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig" in the
20+ "./configure" command line therefore.
21+ - d/local/apparmor-profile
22+ + In the AppArmor profile allow CUPS to access (/var)/run/snapd.socket
23+ to allow cupsd to determine which interfaces a snapped client
24+ is plugging.
25+ + update for new coreutil paths (LP #2123870)
26+ + add rule for accessing /etc/paperspecs (LP #2125520)
27+ - d/control
28+ + Build-depend on libapparmor-dev, libsnapd-glib-dev, needed for
29+ Snap mediation.
30+ + In libcupsimage2 recommend libcupsfilters2 instead of libcupsfilters1.
31+ - d/rules
32+ + Added "--enable-snapped-clients" to the "./configure" options to use
33+ the correct Snap mediation mode for an unsnapped cupsd, like provided
34+ by this package.
35+ + In debian/rules updated ./configure arguments from --enable-gnutls to
36+ --with-tls=gnutls. Now libcups has support for all hash types again,
37+ especially can provide sha2-256 to PAPPL.
38+ * Dropped Changes
39+ - d/p/CVE-2025-58060.patch : patched in upstream version
40+ - d/p/CVE-2025-58364.patch : patched in upstream version
41+ - d/p/CVE-2025-61915.patch : patched in upstream version
42+ - d/rules
43+ + --with-system-groups='lpadmin root'. This was included in Debian 2.4.1op1-2
44+ as ='root lpadmin', somehow dropped and inverted in Ubuntu.
45+
46+ -- John Chittum <john.chittum@canonical.com> Fri, 05 Dec 2025 12:59:59 -0500
47+
48 cups (2.4.16-1) unstable; urgency=medium
49
50 * Update to new upstream version 2.4.16.
51@@ -27,6 +69,69 @@ cups (2.4.14-1) unstable; urgency=medium
52
53 -- Thorsten Alteholz <debian@alteholz.de> Sat, 04 Oct 2025 12:26:19 +0200
54
55+cups (2.4.12-0ubuntu4) resolute; urgency=medium
56+
57+ * SECURITY UPDATE: Local denial-of-service via cupsd.conf update and
58+ related issues
59+ - debian/patches/CVE-2025-61915.patch: fix various issues in cupsd in
60+ conf/cups-files.conf.in, config-scripts/cups-defaults.m4,
61+ config.h.in, configure, doc/help/man-cups-files.conf.html,
62+ man/cups-files.conf.5, scheduler/auth.c, scheduler/auth.h,
63+ scheduler/client.c, scheduler/conf.c, test/run-stp-tests.sh,
64+ vcnet/config.h, xcode/CUPS.xcodeproj/project.pbxproj, xcode/config.h.
65+ - CVE-2025-61915
66+
67+ -- Marc Deslauriers <marc.deslauriers@ubuntu.com> Mon, 01 Dec 2025 09:15:47 -0500
68+
69+cups (2.4.12-0ubuntu3) questing; urgency=medium
70+
71+ * debian/local/apparmor-profile:
72+ - Update for new coreutil paths (LP: #2123870)
73+ - Add rule for accessing /etc/paperspecs (LP: #2125520)
74+
75+ -- Ryan Lee <ryan.lee@canonical.com> Mon, 22 Sep 2025 16:44:55 -0700
76+
77+cups (2.4.12-0ubuntu2) questing; urgency=medium
78+
79+ * SECURITY UPDATE: authorization bypass
80+ - d/p/CVE-2025-58060.patch: only allow basic and kerberos authentication
81+ if it is enabled.
82+ - CVE-2025-58060
83+ * SECURITY UPDATE: remote DoS
84+ - d/p/CVE-2025-58364.patch: fix null dereference in ipp_read_io().
85+ - CVE-2025-58364
86+
87+ -- Eduardo Barretto <eduardo.barretto@canonical.com> Fri, 05 Sep 2025 17:13:12 +0200
88+
89+cups (2.4.12-0ubuntu1) plucky; urgency=medium
90+
91+ * New upstream bug fix release 2.4.12
92+ - Another half year worth of bug fixes ...
93+ - Last 2.4.x upstream release.
94+ * Refreshed patches.
95+
96+ -- Till Kamppeter <till.kamppeter@gmail.com> Tue, 08 Apr 2025 13:27:28 +0200
97+
98+cups (2.4.11-0ubuntu2) plucky; urgency=medium
99+
100+ * No-change rebuild for libpaper.
101+
102+ -- Sudip Mukherjee <sudipm.mukherjee@gmail.com> Sun, 22 Dec 2024 11:02:49 +0000
103+
104+cups (2.4.11-0ubuntu1) plucky; urgency=medium
105+
106+ * New upstream release 2.4.11
107+ - Includes fix for CVE-2024-47175
108+ - In both plucky and oracular the build test ("make check") fails
109+ for CUPS 2.4.10, cupsd instance on port 8631 not starting up, 2.4.11
110+ fixes this somehow, most probably this is upstream issue #989.
111+ * Drop 0014-CVE-2024-47175-and-further-hardening.patch, included
112+ upstream
113+ * Add the new /usr/lib/systemd/system/system-cups.slice file to
114+ cups-daemon.install
115+
116+ -- Till Kamppeter <till.kamppeter@gmail.com> Mon, 25 Nov 2024 20:34:33 +0100
117+
118 cups (2.4.10-4) unstable; urgency=medium
119
120 * CVE-2025-58060
121@@ -43,6 +148,37 @@ cups (2.4.10-3) unstable; urgency=medium
122
123 -- Thorsten Alteholz <debian@alteholz.de> Sun, 01 Jun 2025 13:45:05 +0200
124
125+cups (2.4.10-2ubuntu1) plucky; urgency=medium
126+
127+ * Merge with Debian unstable (LP: #2089041). Remaining changes:
128+ - Added "--enable-snapped-clients" to the "./configure" options to use
129+ the correct Snap mediation mode for an unsnapped cupsd, like provided
130+ by this package.
131+ - Use also "--with-system-groups='lpadmin root'" in "./configure" command
132+ line.
133+ - In the AppArmor profile allow CUPS to access (/var)/run/snapd.socket
134+ to allow cupsd to determine which interfaces a snapped client
135+ is plugging.
136+ - Build-depend on libapparmor-dev, libsnapd-glib-dev, needed for
137+ Snap mediation.
138+ - Added fully automatic generation of PPD option setting presets to
139+ be applied depending on the settings of the job IPP attributes
140+ "print-color-mode", "print-quality", and "print-content-optimize".
141+ This allows easy control of any printer with only standard IPP
142+ attributes, as for example from a phone (functionality overtaken
143+ from cups-filters, mot (yet) upstream in CUPS).
144+ - In debian/rules updated "./configure" arguments from "--enable-gnutls" to
145+ "--with-tls=gnutls". Now libcups has support for all hash types again,
146+ especially can provide sha2-256 to PAPPL.
147+ - Use pkgconfig file cups.pc from upstream and not Debian's own file
148+ of CUPS' pre-pkgconfig era. also use
149+ "--with-pkgconfpath=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig" in the
150+ "./configure" command line therefore.
151+ * In libcupsimage2 recommend libcupsfilters2 instead of libcupsfilters1.
152+ * CVE-2024-35235.patch: Removed, included upstream. (Closes: #1087849)
153+
154+ -- Alessandro Astone <alessandro.astone@canonical.com> Tue, 19 Nov 2024 16:20:03 +0100
155+
156 cups (2.4.10-2) unstable; urgency=medium
157
158 [ Helge Kreutzmann ]
159@@ -60,6 +196,59 @@ cups (2.4.10-2) unstable; urgency=medium
160
161 -- Thorsten Alteholz <debian@alteholz.de> Thu, 26 Sep 2024 23:45:05 +0200
162
163+cups (2.4.10-1ubuntu2) oracular; urgency=medium
164+
165+ * SECURITY UPDATE: PPD injection issues (LP: #2082335)
166+ - debian/patches/sec-202409-1.patch: validate URIs, attribute names,
167+ and capabilities in cups/ppd-cache.c, scheduler/ipp.c.
168+ - debian/patches/sec-202409-2.patch: sanitize make and model in
169+ cups/ppd-cache.c.
170+ - debian/patches/sec-202409-3.patch: PPDize preset and template names
171+ in cups/ppd-cache.c.
172+ - debian/patches/sec-202409-4.patch: quote PPD localized strings in
173+ cups/ppd-cache.c.
174+ - debian/patches/sec-202409-5.patch: fix warnings in cups/ppd-cache.c.
175+ - CVE-2024-47175
176+
177+ -- Marc Deslauriers <marc.deslauriers@ubuntu.com> Thu, 26 Sep 2024 07:14:15 -0400
178+
179+cups (2.4.10-1ubuntu1) oracular; urgency=low
180+
181+ * Merge from Debian unstable. Remaining changes:
182+ - Added "--enable-snapped-clients" to the "./configure" options to use
183+ the correct Snap mediation mode for an unsnapped cupsd, like provided
184+ by this package.
185+ - Use also "--with-system-groups='lpadmin root'" in "./configure" command
186+ line.
187+ - In the AppArmor profile allow CUPS to access (/var)/run/snapd.socket
188+ to allow cupsd to determine which interfaces a snapped client
189+ is plugging.
190+ - Build-depend on libapparmor-dev, libsnapd-glib-dev, needed for
191+ Snap mediation.
192+ - Added fully automatic generation of PPD option setting presets to
193+ be applied depending on the settings of the job IPP attributes
194+ "print-color-mode", "print-quality", and "print-content-optimize".
195+ This allows easy control of any printer with only standard IPP
196+ attributes, as for example from a phone (functionality overtaken
197+ from cups-filters, mot (yet) upstream in CUPS).
198+ - In debian/rules updated "./configure" arguments from "--enable-gnutls" to
199+ "--with-tls=gnutls". Now libcups has support for all hash types again,
200+ especially can provide sha2-256 to PAPPL.
201+ - Use pkgconfig file cups.pc from upstream and not Debian's own file
202+ of CUPS' pre-pkgconfig era. also use
203+ "--with-pkgconfpath=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig" in the
204+ "./configure" command line therefore.
205+ - In libcupsimage2 recommend libcupsfilters2 instead of libcupsfilters1.
206+ * 9100-ppd-cache-add-auto-presets.patch: Updated with quilt.
207+ * 9110-delay-creating-driverless-printer-until-ppd-generated.patch,
208+ 9120-longer-timeout-for-avahi-resolving-for-cupsgetdests.patch,
209+ 9130-fix-document-unprintable-error-handling.patch,
210+ CVE-2024-35235.patch,
211+ fix-scheduler-start-if-only-domain-socket-to-listen.patch: Removed,
212+ included upstream.
213+
214+ -- Till Kamppeter <till.kamppeter@gmail.com> Mon, 12 Aug 2024 15:49:30 +0200
215+
216 cups (2.4.10-1) unstable; urgency=medium
217
218 * Update to new upstream version 2.4.10.
219@@ -90,6 +279,144 @@ cups (2.4.7-2) unstable; urgency=medium
220
221 -- Thorsten Alteholz <debian@alteholz.de> Tue, 11 Jun 2024 22:16:49 +0200
222
223+cups (2.4.7-1.2ubuntu9) oracular; urgency=medium
224+
225+ * SECURITY REGRESSION: early exit on missing listen directive
226+ - d/p/fix-scheduler-start-if-only-domain-socket-to-listen.patch: don't
227+ exit if no valid Listen or Port found (LP: #2070315)
228+
229+ -- Sudhakar Verma <sudhakar.verma@canonical.com> Tue, 02 Jul 2024 17:37:44 +0530
230+
231+cups (2.4.7-1.2ubuntu8) oracular; urgency=medium
232+
233+ * SECURITY UPDATE: cupsd listen arbitrary chmod 0140777
234+ - debian/patches/CVE-2024-35235.patch: validate status of unlink and bind
235+ in cups/http-addr.c
236+ - CVE-2024-35235
237+
238+ -- Sudhakar Verma <sudhakar.verma@canonical.com> Fri, 21 Jun 2024 15:57:06 +0530
239+
240+cups (2.4.7-1.2ubuntu7) noble; urgency=low
241+
242+ * Another fix for crash caused by the fix of the background polling of
243+ printer capability information in ...ubuntu4. Added also commit 6aeb03b
244+ from 2.4.x GIT branch to the patch (LP: #2060692, Upstream issue #934,
245+ pull request #935).
246+
247+ -- Till Kamppeter <till.kamppeter@gmail.com> Fri, 12 Apr 2024 22:13:19 +0200
248+
249+cups (2.4.7-1.2ubuntu6) noble; urgency=low
250+
251+ * Fix crash caused by the fix of the background polling of printer
252+ capability information in ...ubuntu4. Added commit 2e65a35 from 2.4.x
253+ GIT branch to the patch (LP: #2060692, Upstream issue #934, pull
254+ request #937).
255+ * Backported upstream commits 939368f from 2.4.x GIT branch, to
256+ fix the auto-repeating of a job in Raster mode when failed printing
257+ in PDF mode, due to printer-internal bug/incompatibility (Upstream
258+ issue #391).
259+
260+ -- Till Kamppeter <till.kamppeter@gmail.com> Thu, 11 Apr 2024 23:23:19 +0200
261+
262+cups (2.4.7-1.2ubuntu5) noble; urgency=low
263+
264+ * Longer timeout for Avahi resolving for cupsGetDests() API function, used
265+ by "lpstat -l -e" (Upstream issues #47, #751, fix is already in place
266+ in the CUPS Snap).
267+
268+ -- Till Kamppeter <till.kamppeter@gmail.com> Sat, 6 Apr 2024 00:05:19 +0200
269+
270+cups (2.4.7-1.2ubuntu4) noble; urgency=low
271+
272+ * Backported upstream commits 6c6e1b0, ff16dab, and df3718b from 2.4.x GIT
273+ branch, to
274+ - Fix race condition due to removal of temporary queue while still accessing
275+ it. Now timeout clock is reset on every access, temporary queues not
276+ created if there is a permanent queue to the same printer, temporary queues
277+ expire after 5 min instead of 1 min (Upstream issue #871).
278+ - Fix temporary queue appearing as raw queue while CUPS is still polling
279+ the capability information from the printer. This breaks print dialogs and
280+ printing itself. Now queue creation is deleayed until the PPD is ready
281+ (Upstream issue #347).
282+
283+ -- Till Kamppeter <till.kamppeter@gmail.com> Fri, 5 Apr 2024 22:48:19 +0200
284+
285+cups (2.4.7-1.2ubuntu3) noble; urgency=medium
286+
287+ * No-change rebuild for CVE-2024-3094
288+
289+ -- Steve Langasek <steve.langasek@ubuntu.com> Sun, 31 Mar 2024 07:31:09 +0000
290+
291+cups (2.4.7-1.2ubuntu2) noble; urgency=low
292+
293+ * Remove Debian's own (broken) cups.pc file, CUPS has it upstreanm from
294+ 2.4.6 on (LP: #2059157).
295+
296+ -- Till Kamppeter <till.kamppeter@gmail.com> Tue, 26 Mar 2024 23:17:19 +0100
297+
298+cups (2.4.7-1.2ubuntu1) noble; urgency=low
299+
300+ * Merge from Debian unstable. Remaining changes:
301+ - Added "--enable-snapped-clients" to the "./configure" options to use
302+ the correct Snap mediation mode for an unsnapped cupsd, like provided
303+ by this package.
304+ - In the AppArmor profile allow CUPS to access (/var)/run/snapd.socket
305+ to allow cupsd to determine which interfaces a snapped client
306+ is plugging.
307+ - Build-depend on libapparmor-dev, libsnapd-glib-dev, needed for
308+ Snap mediation.
309+ - Added fully automatic generation of PPD option setting presets to
310+ be applied depending on the settings of the job IPP attributes
311+ "print-color-mode", "print-quality", and "print-content-optimize".
312+ This allows easy control of any printer with only standard IPP
313+ attributes, as for example from a phone (functionality overtaken
314+ from cups-filters, mot (yet) upstream in CUPS).
315+ - In debian/rules updated ./configure arguments from --enable-gnutls to
316+ --with-tls=gnutls. Now libcups has support for all hash types again,
317+ especially can provide sha2-256 to PAPPL.
318+ - In libcupsimage2 recommend libcupsfilters2 instead of libcupsfilters1.
319+
320+ -- Till Kamppeter <till.kamppeter@gmail.com> Tue, 19 Mar 2024 10:46:19 +0100
321+
322+cups (2.4.7-1.2) unstable; urgency=medium
323+
324+ * Non-maintainer upload.
325+ * Rename libraries for 64-bit time_t transition.
326+
327+ -- Michael Hudson-Doyle <mwhudson@debian.org> Wed, 28 Feb 2024 23:20:02 +0000
328+
329+cups (2.4.7-1ubuntu2) noble; urgency=medium
330+
331+ * No-change rebuild against libgnutls30t64
332+
333+ -- Steve Langasek <steve.langasek@ubuntu.com> Sun, 10 Mar 2024 02:03:25 +0000
334+
335+cups (2.4.7-1ubuntu1) noble; urgency=low
336+
337+ * Merge from Debian unstable. Remaining changes:
338+ - Added "--enable-snapped-clients" to the "./configure" options to use
339+ the correct Snap mediation mode for an unsnapped cupsd, like provided
340+ by this package.
341+ - In the AppArmor profile allow CUPS to access (/var)/run/snapd.socket
342+ to allow cupsd to determine which interfaces a snapped client
343+ is plugging.
344+ - Build-depend on libapparmor-dev, libsnapd-glib-dev, needed for
345+ Snap mediation.
346+ - Added fully automatic generation of PPD option setting presets to
347+ be applied depending on the settings of the job IPP attributes
348+ "print-color-mode", "print-quality", and "print-content-optimize".
349+ This allows easy control of any printer with only standard IPP
350+ attributes, as for example from a phone (functionality overtaken
351+ from cups-filters, mot (yet) upstream in CUPS).
352+ - In debian/rules updated ./configure arguments from --enable-gnutls to
353+ --with-tls=gnutls. Now libcups has support for all hash types again,
354+ especially can provide sha2-256 to PAPPL.
355+ - In libcupsimage2 recommend libcupsfilters2 instead of libcupsfilters1.
356+ * Removed patches included upstream:
357+ - CVE-2023-4504.patch
358+
359+ -- Till Kamppeter <till.kamppeter@gmail.com> Wed, 28 Feb 2024 20:07:19 +0100
360+
361 cups (2.4.7-1) unstable; urgency=medium
362
363 * Update to new upstream version 2.4.7.
364@@ -114,6 +441,78 @@ cups (2.4.7-1) unstable; urgency=medium
365
366 -- Thorsten Alteholz <debian@alteholz.de> Fri, 06 Oct 2023 20:16:49 +0200
367
368+cups (2.4.6-0ubuntu3) mantic; urgency=medium
369+
370+ * Let pkg-config data file cups.pc get installed into
371+ /usr/lib/<ARCH>/pkgconfig/
372+ * Include pkg-config data file cups.pc in libcups2-dev
373+
374+ -- Till Kamppeter <till.kamppeter@gmail.com> Tue, 26 Sep 2023 14:56:43 +0200
375+
376+cups (2.4.6-0ubuntu2) mantic; urgency=medium
377+
378+ * SECURITY UPDATE: Postscript parsing heap overflow
379+ - debian/patches/CVE-2023-4504.patch: properly check for end of buffer
380+ in cups/raster-interpret.c.
381+ - CVE-2023-4504
382+
383+ -- Marc Deslauriers <marc.deslauriers@ubuntu.com> Wed, 20 Sep 2023 12:42:21 -0400
384+
385+cups (2.4.6-0ubuntu1) mantic; urgency=medium
386+
387+ * Update to new upstream version 2.4.6.
388+ - Fix printing multiple files on specific printers (Upstream issue #643)
389+
390+ -- Till Kamppeter <till.kamppeter@gmail.com> Wed, 16 Aug 2023 21:53:43 +0200
391+
392+cups (2.4.5-0ubuntu2) mantic; urgency=medium
393+
394+ * SECURITY UPDATE: use-after-free in cupsdAcceptClient()
395+ - debian/patches/CVE-2023-34241.patch: log result of httpGetHostname
396+ BEFORE closing the connection in scheduler/client.c.
397+ - CVE-2023-34241
398+
399+ -- Marc Deslauriers <marc.deslauriers@ubuntu.com> Thu, 22 Jun 2023 12:06:19 -0400
400+
401+cups (2.4.5-0ubuntu1) mantic; urgency=medium
402+
403+ * Update to new upstream version 2.4.5.
404+ - Fixes color printing on printers with "CMYK" choice instead of "RGB"
405+ in "ColorModel" option of their PPD (Upstream issues #451 and #500,
406+ LP: 1971242).
407+ * Merge from Debian unstable. Remaining changes:
408+ - Added "--enable-snapped-clients" to the "./configure" options to use
409+ the correct Snap mediation mode for an unsnapped cupsd, like provided
410+ by this package.
411+ - In the AppArmor profile allow CUPS to access (/var)/run/snapd.socket
412+ to allow cupsd to determine which interfaces a snapped client
413+ is plugging.
414+ - Build-depend on libapparmor-dev, libsnapd-glib-dev, needed for
415+ Snap mediation.
416+ - Added fully automatic generation of PPD option setting presets to
417+ be applied depending on the settings of the job IPP attributes
418+ "print-color-mode", "print-quality", and "print-content-optimize".
419+ This allows easy control of any printer with only standard IPP
420+ attributes, as for example from a phone (functionality overtaken
421+ from cups-filters, mot (yet) upstream in CUPS).
422+ - In debian/rules updated ./configure arguments from --enable-gnutls to
423+ --with-tls=gnutls. Now libcups has support for all hash types again,
424+ especially can provide sha2-256 to PAPPL.
425+ - When polling capabilities of a driverless printer via
426+ get-printer-attributes IPP request, do a separate poll of the
427+ media-col-database attribute in case it did not get obtained by the
428+ first polls.
429+ - In libcupsimage2 recommend libcupsfilters2 instead of libcupsfilters1.
430+ * Manually refreshed patch 9100-ppd-cache-add-auto-presets.patch.
431+ * Removed patches included upstream:
432+ - 9110-create-local-printer-localhost-fix.patch
433+ - CVE-2022-26691-2.patch
434+ - snapd-glib-2.patch
435+ - poll-media-col-database-separately.patch
436+ - CVE-2023-32324.patch
437+
438+ -- Till Kamppeter <till.kamppeter@gmail.com> Wed, 14 Jun 2023 15:38:00 +0200
439+
440 cups (2.4.2-6) unstable; urgency=medium
441
442 * CVE-2023-4504
443@@ -138,6 +537,56 @@ cups (2.4.2-4) unstable; urgency=medium
444
445 -- Thorsten Alteholz <debian@alteholz.de> Wed, 31 May 2023 21:30:27 +0200
446
447+cups (2.4.2-3ubuntu3) mantic; urgency=medium
448+
449+ * SECURITY UPDATE: DoS via buffer overflow in format_log_line
450+ - debian/patches/CVE-2023-32324.patch: check _cups_strlcpy size in
451+ cups/string.c.
452+ - CVE-2023-32324
453+
454+ -- Marc Deslauriers <marc.deslauriers@ubuntu.com> Thu, 25 May 2023 08:37:20 -0400
455+
456+cups (2.4.2-3ubuntu2) lunar; urgency=low
457+
458+ * In libcupsimage2 recommend libcupsfilters2 instead of libcupsfilters1.
459+
460+ -- Till Kamppeter <till.kamppeter@gmail.com> Mon, 27 Mar 2023 23:12:00 +0200
461+
462+cups (2.4.2-3ubuntu1) lunar; urgency=low
463+
464+ * Merge from Debian unstable. Remaining changes:
465+ - Added "--enable-snapped-clients" to the "./configure" options to use
466+ the correct Snap mediation mode for an unsnapped cupsd, like provided
467+ by this package.
468+ - In the AppArmor profile allow CUPS to access (/var)/run/snapd.socket
469+ to allow cupsd to determine which interfaces a snapped client
470+ is plugging.
471+ - Build-depend on libapparmor-dev, libsnapd-glib-dev, needed for
472+ Snap mediation.
473+ - Added fully automatic generation of PPD option setting presets to
474+ be applied depending on the settings of the job IPP attributes
475+ "print-color-mode", "print-quality", and "print-content-optimize".
476+ This allows easy control of any printer with only standard IPP
477+ attributes, as for example from a phone (functionality overtaken
478+ from cups-filters, mot (yet) upstream in CUPS).
479+ - Fixed printing on temporary CUPS queues for local services, like
480+ IPP-over-USB or Printer Applications. Especially when printing from
481+ the GTK print dialog printing on such queues did not work (Upstream
482+ pull request #353, LP: #1965112).
483+ - Comment in CVE-2022-26691 patch fixed.
484+ - In debian/rules updated ./configure arguments from --enable-gnutls to
485+ --with-tls=gnutls. Now libcups has support for all hash types again,
486+ especially can provide sha2-256 to PAPPL.
487+ - When polling capabilities of a driverless printer via
488+ get-printer-attributes IPP request, do a separate poll of the
489+ media-col-database attribute in case it did not get obtained by the
490+ first polls.
491+ - Patch to build with snapd-glib-2
492+ * Refreshed patches 9100-ppd-cache-add-auto-presets.patch and
493+ 9110-create-local-printer-localhost-fix.patch with quilt.
494+
495+ -- Till Kamppeter <till.kamppeter@gmail.com> Sun, 26 Mar 2023 21:01:00 +0200
496+
497 cups (2.4.2-3) unstable; urgency=medium
498
499 [ Helge Kreutzmann ]
500@@ -165,6 +614,54 @@ cups (2.4.2-2) unstable; urgency=medium
501
502 -- Thorsten Alteholz <debian@alteholz.de> Sun, 26 Feb 2023 12:54:05 +0100
503
504+cups (2.4.2-1ubuntu4) lunar; urgency=medium
505+
506+ * In debian/rules updated ./configure arguments from --enable-gnutls to
507+ --with-tls=gnutls. Now libcups has support for all hash types again,
508+ especially can provide sha2-256 to PAPPL.
509+
510+ -- Till Kamppeter <till.kamppeter@gmail.com> Wed, 8 Feb 2023 00:07:31 +0100
511+
512+cups (2.4.2-1ubuntu3) kinetic; urgency=medium
513+
514+ * When polling capabilities of a driverless printer via
515+ get-printer-attributes IPP request, do a separate poll
516+ of the media-col-database attribute in case it did not
517+ get obtained by the first polls.
518+
519+ -- Till Kamppeter <till.kamppeter@gmail.com> Sat, 21 Jan 2023 14:27:31 -0300
520+
521+cups (2.4.2-1ubuntu2) kinetic; urgency=medium
522+
523+ * Add patch to build with snapd-glib-2
524+
525+ -- Jeremy Bicha <jbicha@ubuntu.com> Thu, 25 Aug 2022 21:54:33 -0400
526+
527+cups (2.4.2-1ubuntu1) kinetic; urgency=low
528+
529+ * Merge from Debian unstable. Remaining changes:
530+ - Added "--enable-snapped-clients" to the "./configure" options to use
531+ the correct Snap mediation mode for an unsnapped cupsd, like provided
532+ by this package.
533+ - In the AppArmor profile allow CUPS to access (/var)/run/snapd.socket
534+ to allow cupsd to determine which interfaces a snapped client
535+ is plugging.
536+ - Build-depend on libapparmor-dev, libsnapd-glib-dev, needed for
537+ Snap mediation.
538+ - Added fully automatic generation of PPD option setting presets to
539+ be applied depending on the settings of the job IPP attributes
540+ "print-color-mode", "print-quality", and "print-content-optimize".
541+ This allows easy control of any printer with only standard IPP
542+ attributes, as for example from a phone (functionality overtaken
543+ from cups-filters, mot (yet) upstream in CUPS).
544+ - Fixed printing on temporary CUPS queues for local services, like
545+ IPP-over-USB or Printer Applications. Especially when printing from
546+ the GTK print dialog printing on such queues did not work (Upstream
547+ pull request #353, LP: #1965112).
548+ - Comment in CVE-2022-26691 patch fixed.
549+
550+ -- Till Kamppeter <till.kamppeter@gmail.com> Mon, 06 Jun 2022 20:20:31 +0200
551+
552 cups (2.4.2-1) unstable; urgency=medium
553
554 * Update to new upstream version 2.4.2.
555@@ -183,6 +680,67 @@ cups (2.4.1op1-2) unstable; urgency=medium
556
557 -- Thorsten Alteholz <debian@alteholz.de> Mon, 07 Mar 2022 22:08:09 +0100
558
559+cups (2.4.1op1-1ubuntu5) kinetic; urgency=medium
560+
561+ * SECURITY UPDATE: Local authorization cert bypass
562+ - debian/patches/CVE-2022-26691-1.patch: fix string comparison in
563+ scheduler/cert.c.
564+ - debian/patches/CVE-2022-26691-2.patch: fix the comment in
565+ scheduler/cert.c.
566+ - CVE-2022-26691
567+
568+ -- Marc Deslauriers <marc.deslauriers@ubuntu.com> Fri, 27 May 2022 07:53:01 -0400
569+
570+cups (2.4.1op1-1ubuntu4) jammy; urgency=low
571+
572+ * Fixed PPD file auto-generation when a print queue is created with
573+ a DNS-SD-service-name-based URI and "-m everywhere" backporting the
574+ fix from upstream (Upstream issue #340, #343).
575+
576+ -- Till Kamppeter <till.kamppeter@gmail.com> Sat, 19 Mar 2022 00:07:00 +0100
577+
578+cups (2.4.1op1-1ubuntu3) jammy; urgency=low
579+
580+ * Fixed crasher in the patch for temporary queues for local services
581+ in the previous release. Updated the patch and the upstream pull
582+ request (LP: #1965112, Upstream pull request #353).
583+
584+ -- Till Kamppeter <till.kamppeter@gmail.com> Wed, 16 Mar 2022 18:24:08 +0100
585+
586+cups (2.4.1op1-1ubuntu2) jammy; urgency=low
587+
588+ * Fixed printing on temporary CUPS queues for local services, like
589+ IPP-over-USB or Printer Applications. Especially when printing from
590+ the GTK print dialog printing on such queues did not work (Upstream
591+ pull request #353).
592+
593+ -- Till Kamppeter <till.kamppeter@gmail.com> Mon, 14 Mar 2022 09:13:08 +0100
594+
595+cups (2.4.1op1-1ubuntu1) jammy; urgency=low
596+
597+ * Merge from Debian unstable. Remaining changes:
598+ - Added "--enable-snapped-clients" to the "./configure" options to use
599+ the correct Snap mediation mode for an unsnapped cupsd, like provided
600+ by this package.
601+ - Build CUPS with "SystemGroup lpadmin root" in cups-files.conf by
602+ default, as CUPS always worked this way but the new patch for
603+ supporting the "cups-control" interface of Snaps does not allow
604+ implicit permission to everything for root any more.
605+ - In the AppArmor profile allow CUPS to access (/var)/run/snapd.socket
606+ to allow cupsd to determine which interfaces a snapped client
607+ is plugging.
608+ - Build-depend on libapparmor-dev, libsnapd-glib-dev, needed for
609+ Snap mediation.
610+ - Added fully automatic generation of PPD option setting presets to
611+ be applied depending on the settings of the job IPP attributes
612+ "print-color-mode", "print-quality", and "print-content-optimize".
613+ This allows easy control of any printer with only standard IPP
614+ attributes, as for example from a phone (functionality overtaken
615+ from cups-filters, mot (yet) upstream in CUPS).
616+ * Updated 9100-ppd-cache-add-auto-presets.patch
617+
618+ -- Till Kamppeter <till.kamppeter@gmail.com> Tue, 22 Feb 2022 12:28:08 +0100
619+
620 cups (2.4.1op1-1) unstable; urgency=medium
621
622 * new upstream release
623@@ -196,6 +754,40 @@ cups (2.4.1op1-1) unstable; urgency=medium
624
625 -- Thorsten Alteholz <debian@alteholz.de> Sun, 20 Feb 2022 20:08:09 +0100
626
627+cups (2.3.3op2-7ubuntu2) impish; urgency=low
628+
629+ * Updated patch for auto-generation of PPD presets to patch proposed
630+ upstream (Upstream pull request #236) due to added PPD options taken into
631+ account.
632+
633+ -- Till Kamppeter <till.kamppeter@gmail.com> Fri, 10 Sep 2021 19:20:00 +0200
634+
635+cups (2.3.3op2-7ubuntu1) impish; urgency=low
636+
637+ * Merge from Debian unstable. Remaining changes:
638+ - Added extra checking when administrative requests (create queue,
639+ remove someone else's job, ...) reach cupsd. If the client is a Snap,
640+ it has to plug the cups-control interface to be allowed to do the
641+ task. Added libapparmor-dev and libsnapd-glib-dev to the build
642+ dependencies. Also added needed permissions to AppArmor profile.
643+ - Build CUPS with "SystemGroup lpadmin root" in cups-files.conf by
644+ default, as CUPS always worked this way but the new patch for
645+ supporting the "cups-control" interface of Snaps does not allow
646+ implicit permission to everything for root any more.
647+ - Added "--enable-snapped-clients"
648+ to the "./configure" options to use the correct checking mode for an
649+ unsnapped cupsd, like provided by this package.
650+ - Added fully automatic generation of PPD option setting presets to
651+ be applied depending on the settings of the job IPP attributes
652+ "print-color-mode", "print-quality", and "print-content-optimize".
653+ This allows easy control of any printer with only standard IPP
654+ attributes, as for example from a phone (functionality overtaken
655+ from cups-filters, mot (yet) upstream in CUPS).
656+ * Updated patch for auto-generation of PPD presets to patch proposed
657+ upstream (Upstream pull request #236).
658+
659+ -- Till Kamppeter <till.kamppeter@gmail.com> Mon, 06 Sep 2021 21:26:41 +0200
660+
661 cups (2.3.3op2-7) unstable; urgency=medium
662
663 [ Didier Raboud ]
664@@ -215,6 +807,30 @@ cups (2.3.3op2-6) unstable; urgency=medium
665
666 -- Didier Raboud <odyx@debian.org> Tue, 24 Aug 2021 15:38:05 +0200
667
668+cups (2.3.3op2-5ubuntu1) impish; urgency=low
669+
670+ * Merge from Debian unstable. Remaining changes:
671+ - Added extra checking when administrative requests (create queue,
672+ remove someone else's job, ...) reach cupsd. If the client is a Snap,
673+ it has to plug the cups-control interface to be allowed to do the
674+ task. Added libapparmor-dev and libsnapd-glib-dev to the build
675+ dependencies. Also added needed permissions to AppArmor profile.
676+ - Build CUPS with "SystemGroup lpadmin root" in cups-files.conf by
677+ default, as CUPS always worked this way but the new patch for
678+ supporting the "cups-control" interface of Snaps does not allow
679+ implicit permission to everything for root any more.
680+ - Added "--enable-snapped-clients"
681+ to the "./configure" options to use the correct checking mode for an
682+ unsnapped cupsd, like provided by this package.
683+ * Added fully automatic generation of PPD option setting presets to
684+ be applied depending on the settings of the job IPP attributes
685+ "print-color-mode", "print-quality", and "print-content-optimize".
686+ This allows easy control of any printer with only standard IPP
687+ attributes, as for example from a phone (functionality overtaken
688+ from cups-filters, mot (yet) upstream in CUPS).
689+
690+ -- Till Kamppeter <till.kamppeter@gmail.com> Tue, 17 Aug 2021 23:47:41 +0200
691+
692 cups (2.3.3op2-5) experimental; urgency=low
693
694 * Backport 2 upstream USB backend fixes:
695@@ -244,6 +860,45 @@ cups (2.3.3op2-3+deb11u1) unstable; urgency=medium
696
697 -- Didier Raboud <odyx@debian.org> Thu, 27 May 2021 08:49:36 +0200
698
699+cups (2.3.3op2-3ubuntu3) hirsute; urgency=low
700+
701+ * Updated AppArmor profile entries for CUPS accessing snapd to
702+ check whether a client is a Snap and which interfaces it plugs to.
703+
704+ -- Till Kamppeter <till.kamppeter@gmail.com> Fri, 19 Mar 2021 18:26:41 +0100
705+
706+cups (2.3.3op2-3ubuntu2) hirsute; urgency=low
707+
708+ * Replaced patch for extra checking of admin requests from snapped
709+ clients by the current upstream code. Added "--enable-snapped-clients"
710+ to the "./configure" options to use the correct checking mode for an
711+ unsnapped cupsd, like provided by this package.
712+
713+ -- Till Kamppeter <till.kamppeter@gmail.com> Fri, 19 Mar 2021 16:32:41 +0100
714+
715+cups (2.3.3op2-3ubuntu1) hirsute; urgency=low
716+
717+ * Merge from Debian unstable. Remaining changes:
718+ - Added extra checking when administrative requests (create queue,
719+ remove someone else's job, ...) reach cupsd. If the client is a Snap,
720+ it has to plug the cups-control interface to be allowed to do the
721+ task. Added libapparmor-dev and libsnapd-glib-dev to the build
722+ dependencies. Also added needed permissions to AppArmor profile.
723+ - Build CUPS with "SystemGroup lpadmin root" in cups-files.conf by
724+ default, as CUPS always worked this way but the new patch for
725+ supporting the "cups-control" interface of Snaps does not allow
726+ implicit permission to everything for root any more.
727+ * Clean up "Build-Depends:" to be in sync with Debian (delta overlooked
728+ for near a decade when cups-filters was introduced in 2012), removing
729+ the unneeded entries: ghostscript, libavahi-compat-libdnssd-dev,
730+ libfontconfig1-dev, libfreetype6-dev, libijs-dev, libjpeg-dev,
731+ libldap2-dev, libpng-dev, libtiff-dev, poppler-utils, sharutils
732+ * Removed the changes on the machine-generated "configure" file in the
733+ patch for checking snapped clients, the changes easily mis-match on
734+ updates and we run "autoconf" in debian/rules anyway.
735+
736+ -- Till Kamppeter <till.kamppeter@gmail.com> Fri, 12 Feb 2021 20:44:41 +0100
737+
738 cups (2.3.3op2-3) unstable; urgency=medium
739
740 [ Helge Kreutzmann ]
741@@ -290,6 +945,23 @@ cups (2.3.3op1-6) unstable; urgency=medium
742
743 -- Didier Raboud <odyx@debian.org> Mon, 11 Jan 2021 08:31:58 +0100
744
745+cups (2.3.3op1-5ubuntu1) hirsute; urgency=low
746+
747+ * Merge from Debian unstable. Remaining changes:
748+ - Added extra checking when administrative requests (create queue,
749+ remove someone else's job, ...) reach cupsd. If the client is a Snap,
750+ it has to plug the cups-control interface to be allowed to do the
751+ task. Added libapparmor-dev and libsnapd-glib-dev to the build
752+ dependencies. Also added needed permissions to AppArmor profile.
753+ - Build CUPS with "SystemGroup lpadmin root" in cups-files.conf by
754+ default, as CUPS always worked this way but the new patch for
755+ supporting the "cups-control" interface of Snaps does not allow
756+ implicit permission to everything for root any more.
757+ * In the AppArmor profile allow cupsd to write to /run/systemd/notify
758+ to notify that it is up and running (systemd service type "notify").
759+
760+ -- Till Kamppeter <till.kamppeter@gmail.com> Fri, 08 Jan 2021 19:07:00 +0100
761+
762 cups (2.3.3op1-5) unstable; urgency=medium
763
764 * Update Homepage and Source fields to point
765@@ -305,6 +977,21 @@ cups (2.3.3op1-4) unstable; urgency=medium
766
767 -- Didier Raboud <odyx@debian.org> Wed, 23 Dec 2020 14:53:09 +0100
768
769+cups (2.3.3op1-3ubuntu1) hirsute; urgency=low
770+
771+ * Merge from Debian unstable. Remaining changes:
772+ - Added extra checking when administrative requests (create queue,
773+ remove someone else's job, ...) rach cupsd. If the client is a Snap,
774+ it has to plug the cups-control interface to be allowed to do the
775+ task. Added libapparmor-dev and libsnapd-glib-dev to the build
776+ dependencies. Also added needed permissions to AppArmor profile.
777+ - Build CUPS with "SystemGroup lpadmin root" in cups-files.conf by
778+ default, as CUPS always worked this way but the new patch for
779+ supporting the "cups-control" interface of Snaps does not allow
780+ implicit permission to everything for root any more.
781+
782+ -- Till Kamppeter <till.kamppeter@gmail.com> Fri, 14 Dec 2020 12:47:34 +0100
783+
784 cups (2.3.3op1-3) unstable; urgency=medium
785
786 [ Helge Kreutzmann ]
787@@ -359,6 +1046,21 @@ cups (2.3.3-4) unstable; urgency=medium
788
789 -- Didier Raboud <odyx@debian.org> Tue, 24 Nov 2020 08:49:46 +0100
790
791+cups (2.3.3-3ubuntu1) groovy; urgency=medium
792+
793+ * Merged with Debian unstable. Remaining changes:
794+ - Added extra checking when administrative requests (create queue,
795+ remove someone else's job, ...) rach cupsd. If the client is a Snap,
796+ it has to plug the cups-control interface to be allowed to do the
797+ task. Added libapparmor-dev and libsnapd-glib-dev to the build
798+ dependencies. Also added needed permissions to AppArmor profile.
799+ * Build CUPS with "SystemGroup lpadmin root" in cups-files.conf by
800+ defualt, as CUPS always worked this way but the new patch for
801+ supporting the "cups-control" interface of Snaps does not allow
802+ implicit permission to everything for root any more.
803+
804+ -- Till Kamppeter <till.kamppeter@gmail.com> Fri, 4 Sep 2020 19:00:00 +0200
805+
806 cups (2.3.3-3) unstable; urgency=medium
807
808 [ Didier Raboud ]
809@@ -379,6 +1081,51 @@ cups (2.3.3-3) unstable; urgency=medium
810
811 -- Didier Raboud <odyx@debian.org> Thu, 03 Sep 2020 09:27:04 +0200
812
813+cups (2.3.3-2ubuntu5) groovy; urgency=medium
814+
815+ * In all autopkgtests modify set "LogLevel debug2" in cupsd.conf and
816+ "SystemGroup lpadmin root" in cups-files.conf and restart cupsd,
817+ the former change to more easily find out what failed and the latter
818+ as the default configuration did not allow root to create queues,
819+ making all tests fail.
820+
821+ -- Till Kamppeter <till.kamppeter@gmail.com> Thu, 27 Aug 2020 23:18:00 +0200
822+
823+cups (2.3.3-2ubuntu4) groovy; urgency=medium
824+
825+ * Let the rastertopwg filter check rounding errors when calculating the
826+ page geometry.
827+
828+ -- Till Kamppeter <till.kamppeter@gmail.com> Wed, 27 Aug 2020 10:22:00 +0200
829+
830+cups (2.3.3-2ubuntu3) groovy; urgency=medium
831+
832+ * Do not choke if the GTK dialog sends "None" as phone number or pre-dial
833+ prefix.
834+
835+ -- Till Kamppeter <till.kamppeter@gmail.com> Wed, 26 Aug 2020 22:33:00 +0200
836+
837+cups (2.3.3-2ubuntu2) groovy; urgency=medium
838+
839+ * Fix fax numbers supplied via GTK print dialog, removing a "Custom."
840+ prefix.
841+
842+ -- Till Kamppeter <till.kamppeter@gmail.com> Wed, 26 Aug 2020 13:03:00 +0200
843+
844+cups (2.3.3-2ubuntu1) groovy; urgency=medium
845+
846+ * Added extra checking when administrative requests (create queue,
847+ remove someone else's job, ...) rach cupsd. If the client is a Snap,
848+ it has to plug the cups-control interface to be allowed to do the
849+ task. Added libapparmor-dev and libsnapd-glib-dev to the build
850+ dependencies. Also added needed permissions to AppArmor profile.
851+ * Resolve DNS-SD-service-name-based URIs correctly also if they are from
852+ a service from localhost (like IPP-over-USB, Printer Application, ...)
853+ * Make lpoptions list a printer's options correctly also when CUPS is
854+ running on an alternative port.
855+
856+ -- Till Kamppeter <till.kamppeter@gmail.com> Tue, 25 Aug 2020 21:34:00 +0200
857+
858 cups (2.3.3-2) unstable; urgency=medium
859
860 * Add missing dh-strip-nondeterminism B-D
861@@ -8932,3 +9679,4 @@ cupsys (1.0.1-1) unstable; urgency=low
862 * Initial Release.
863
864 -- Jeff Licquia <licquia@debian.org> Sat, 06 Nov 1999 20:58:02 -0500
865+
866diff --git a/debian/control b/debian/control
867index 1c295cb..27ce386 100644
868--- a/debian/control
869+++ b/debian/control
870@@ -1,5 +1,6 @@
871 Source: cups
872-Maintainer: Debian Printing Team <debian-printing@lists.debian.org>
873+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
874+XSBC-Original-Maintainer: Debian Printing Team <debian-printing@lists.debian.org>
875 Uploaders:
876 Till Kamppeter <till.kamppeter@gmail.com>,
877 Thorsten Alteholz <debian@alteholz.de>,
878@@ -26,6 +27,8 @@ Build-Depends: dpkg-dev (>= 1.22.5),
879 po-debconf,
880 po4a,
881 zlib1g-dev,
882+ libapparmor-dev,
883+ libsnapd-glib-dev (>= 1.61),
884 Build-Depends-Arch: dpkg-dev (>= 1.22.5),
885 dh-apparmor,
886 # libgmp-dev is not GPL-2 compatible before it's 6 release, which makes it also GPL-2+
887@@ -322,7 +325,7 @@ Depends:
888 ${misc:Depends},
889 ${shlibs:Depends},
890 Recommends:
891- libcupsfilters1,
892+ libcupsfilters2,
893 Pre-Depends:
894 ${misc:Pre-Depends},
895 Description: Common UNIX Printing System(tm) - Raster image library
896diff --git a/debian/cups.pc.in b/debian/cups.pc.in
897deleted file mode 100644
898index 4fa0733..0000000
899--- a/debian/cups.pc.in
900+++ /dev/null
901@@ -1,7 +0,0 @@
902-Name: cups
903-Description: cups application integration library
904-URL: https://www.cups.org/
905-Version: @DEB_VERSION_UPSTREAM@
906-Cflags:
907-Libs: -lcups
908-Libs.private:
909diff --git a/debian/libcups2-dev.install b/debian/libcups2-dev.install
910index 4499457..5a27b61 100644
911--- a/debian/libcups2-dev.install
912+++ b/debian/libcups2-dev.install
913@@ -17,3 +17,4 @@ usr/include/cups/transcode.h
914 usr/include/cups/versioning.h
915 usr/lib/*/libcups.a
916 usr/lib/*/libcups.so
917+usr/lib/*/pkgconfig/cups.pc
918diff --git a/debian/local/apparmor-profile b/debian/local/apparmor-profile
919index 947cbd8..7698725 100644
920--- a/debian/local/apparmor-profile
921+++ b/debian/local/apparmor-profile
922@@ -47,6 +47,10 @@
923 network econet dgram,
924 network ash dgram,
925
926+ # To allow cupsd to determine which interfaces a snapped client
927+ # is plugging
928+ /{,var/}run/snapd.socket rw,
929+
930 # CUPS is of systemd service type "notify" now, meaning that cupsd notifies
931 # systemd when it is up and running, give CUPS access to systemd's
932 # notification socket
933@@ -81,9 +85,7 @@
934 @{PROC}/*/auxv r,
935 @{PROC}/sys/crypto/** r,
936 /sys/** r,
937- /usr/bin/* ixr,
938- /usr/sbin/* ixr,
939- /{usr/,}bin/* ixr,
940+ @{coreutil_dirs}* ixr,
941 /{usr/,}sbin/* ixr,
942 /usr/lib/** rm,
943
944@@ -202,8 +204,9 @@
945
946 /{usr/,}bin/dash ixr,
947 /{usr/,}bin/bash ixr,
948- /{usr/,}bin/cp ixr,
949+ @{coreutil_dirs}cp ixr,
950 /etc/papersize r,
951+ /etc/paperspecs r,
952 /etc/cups/cups-pdf.conf r,
953 /etc/cups/ppd/*.ppd r,
954 /usr/bin/gs ixr,
955diff --git a/debian/patches/9100-ppd-cache-add-auto-presets.patch b/debian/patches/9100-ppd-cache-add-auto-presets.patch
956new file mode 100644
957index 0000000..6c150ff
958--- /dev/null
959+++ b/debian/patches/9100-ppd-cache-add-auto-presets.patch
960@@ -0,0 +1,1526 @@
961+--- a/cups/ppd-cache.c
962++++ b/cups/ppd-cache.c
963+@@ -505,6 +505,8 @@
964+ _pwg_print_color_mode_t print_color_mode;
965+ /* Print color mode for preset */
966+ _pwg_print_quality_t print_quality; /* Print quality for preset */
967++ _pwg_print_content_optimize_t print_content_optimize;
968++ /* Content optimize for preset */
969+
970+
971+ DEBUG_printf(("_ppdCacheCreateWithFile(filename=\"%s\")", filename));
972+@@ -930,6 +932,28 @@
973+ cupsParseOptions(valueptr, 0,
974+ pc->presets[print_color_mode] + print_quality);
975+ }
976++ else if (!_cups_strcasecmp(line, "OptimizePreset"))
977++ {
978++ /*
979++ * Preset print_content_optimize name=value ...
980++ */
981++
982++ print_content_optimize = (_pwg_print_content_optimize_t)strtol(value, &valueptr, 10);
983++
984++ if (print_content_optimize < _PWG_PRINT_CONTENT_OPTIMIZE_AUTO ||
985++ print_content_optimize >= _PWG_PRINT_CONTENT_OPTIMIZE_MAX ||
986++ valueptr == value || !*valueptr)
987++ {
988++ DEBUG_printf(("ppdCacheCreateWithFile: Bad Optimize Preset on line %d.",
989++ linenum));
990++ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
991++ goto create_error;
992++ }
993++
994++ pc->num_optimize_presets[print_content_optimize] =
995++ cupsParseOptions(valueptr, 0,
996++ pc->optimize_presets + print_content_optimize);
997++ }
998+ else if (!_cups_strcasecmp(line, "SidesOption"))
999+ pc->sides_option = strdup(value);
1000+ else if (!_cups_strcasecmp(line, "Sides1Sided"))
1001+@@ -1057,6 +1081,7 @@
1002+ *ppd_option; /* Other PPD option */
1003+ ppd_choice_t *choice; /* Current InputSlot/MediaType */
1004+ pwg_map_t *map; /* Current source/type map */
1005++ int preset_added = 0; /* Preset definition found in PPD? */
1006+ ppd_attr_t *ppd_attr; /* Current PPD preset attribute */
1007+ int num_options; /* Number of preset options and props */
1008+ cups_option_t *options; /* Preset options and properties */
1009+@@ -1534,6 +1559,10 @@
1010+ if ((ppd_attr = ppdFindAttr(ppd, "APPrinterPreset", NULL)) != NULL)
1011+ {
1012+ /*
1013++ * "Classic" Mac OS approach
1014++ */
1015++
1016++ /*
1017+ * Copy and convert APPrinterPreset (output-mode + print-quality) data...
1018+ */
1019+
1020+@@ -1633,114 +1662,133 @@
1021+ _ppdParseOptions(ppd_attr->value, 0,
1022+ pc->presets[pwg_print_color_mode] +
1023+ pwg_print_quality, _PPD_PARSE_OPTIONS);
1024++ preset_added = 1;
1025+ }
1026+
1027+ cupsFreeOptions(num_options, options);
1028+ }
1029+ while ((ppd_attr = ppdFindNextAttr(ppd, "APPrinterPreset", NULL)) != NULL);
1030+- }
1031+
1032+- if (!pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][_PWG_PRINT_QUALITY_DRAFT] &&
1033+- !pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][_PWG_PRINT_QUALITY_NORMAL] &&
1034+- !pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][_PWG_PRINT_QUALITY_HIGH])
1035+- {
1036+- /*
1037+- * Try adding some common color options to create grayscale presets. These
1038+- * are listed in order of popularity...
1039+- */
1040+-
1041+- const char *color_option = NULL, /* Color control option */
1042+- *gray_choice = NULL; /* Choice to select grayscale */
1043+-
1044+- if ((color_model = ppdFindOption(ppd, "ColorModel")) != NULL &&
1045+- ppdFindChoice(color_model, "Gray"))
1046+- {
1047+- color_option = "ColorModel";
1048+- gray_choice = "Gray";
1049+- }
1050+- else if ((color_model = ppdFindOption(ppd, "HPColorMode")) != NULL &&
1051+- ppdFindChoice(color_model, "grayscale"))
1052+- {
1053+- color_option = "HPColorMode";
1054+- gray_choice = "grayscale";
1055+- }
1056+- else if ((color_model = ppdFindOption(ppd, "BRMonoColor")) != NULL &&
1057+- ppdFindChoice(color_model, "Mono"))
1058+- {
1059+- color_option = "BRMonoColor";
1060+- gray_choice = "Mono";
1061+- }
1062+- else if ((color_model = ppdFindOption(ppd, "CNIJSGrayScale")) != NULL &&
1063+- ppdFindChoice(color_model, "1"))
1064+- {
1065+- color_option = "CNIJSGrayScale";
1066+- gray_choice = "1";
1067+- }
1068+- else if ((color_model = ppdFindOption(ppd, "HPColorAsGray")) != NULL &&
1069+- ppdFindChoice(color_model, "True"))
1070+- {
1071+- color_option = "HPColorAsGray";
1072+- gray_choice = "True";
1073+- }
1074+-
1075+- if (color_option && gray_choice)
1076++ if (preset_added &&
1077++ !pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][_PWG_PRINT_QUALITY_DRAFT] &&
1078++ !pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][_PWG_PRINT_QUALITY_NORMAL] &&
1079++ !pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][_PWG_PRINT_QUALITY_HIGH])
1080+ {
1081+ /*
1082+- * Copy and convert ColorModel (output-mode) data...
1083++ * Try adding some common color options to create grayscale presets. These
1084++ * are listed in order of popularity...
1085+ */
1086+
1087+- cups_option_t *coption, /* Color option */
1088+- *moption; /* Monochrome option */
1089++ const char *color_option = NULL, /* Color control option */
1090++ *gray_choice = NULL; /* Choice to select grayscale */
1091+
1092+- for (pwg_print_quality = _PWG_PRINT_QUALITY_DRAFT;
1093+- pwg_print_quality < _PWG_PRINT_QUALITY_MAX;
1094+- pwg_print_quality ++)
1095++ if ((color_model = ppdFindOption(ppd, "ColorModel")) != NULL &&
1096++ ppdFindChoice(color_model, "Gray"))
1097+ {
1098+- if (pc->num_presets[_PWG_PRINT_COLOR_MODE_COLOR][pwg_print_quality])
1099+- {
1100+- /*
1101+- * Copy the color options...
1102+- */
1103++ color_option = "ColorModel";
1104++ gray_choice = "Gray";
1105++ }
1106++ else if ((color_model = ppdFindOption(ppd, "HPColorMode")) != NULL &&
1107++ ppdFindChoice(color_model, "grayscale"))
1108++ {
1109++ color_option = "HPColorMode";
1110++ gray_choice = "grayscale";
1111++ }
1112++ else if ((color_model = ppdFindOption(ppd, "BRMonoColor")) != NULL &&
1113++ ppdFindChoice(color_model, "Mono"))
1114++ {
1115++ color_option = "BRMonoColor";
1116++ gray_choice = "Mono";
1117++ }
1118++ else if ((color_model = ppdFindOption(ppd, "CNIJSGrayScale")) != NULL &&
1119++ ppdFindChoice(color_model, "1"))
1120++ {
1121++ color_option = "CNIJSGrayScale";
1122++ gray_choice = "1";
1123++ }
1124++ else if ((color_model = ppdFindOption(ppd, "HPColorAsGray")) != NULL &&
1125++ ppdFindChoice(color_model, "True"))
1126++ {
1127++ color_option = "HPColorAsGray";
1128++ gray_choice = "True";
1129++ }
1130++
1131++ if (color_option && gray_choice)
1132++ {
1133++ /*
1134++ * Copy and convert ColorModel (output-mode) data...
1135++ */
1136++
1137++ cups_option_t *coption, /* Color option */
1138++ *moption; /* Monochrome option */
1139++
1140++ for (pwg_print_quality = _PWG_PRINT_QUALITY_DRAFT;
1141++ pwg_print_quality < _PWG_PRINT_QUALITY_MAX;
1142++ pwg_print_quality ++)
1143++ {
1144++ if (pc->num_presets[_PWG_PRINT_COLOR_MODE_COLOR][pwg_print_quality])
1145++ {
1146++ /*
1147++ * Copy the color options...
1148++ */
1149++
1150++ num_options = pc->num_presets[_PWG_PRINT_COLOR_MODE_COLOR]
1151++ [pwg_print_quality];
1152++ options = calloc(sizeof(cups_option_t), (size_t)num_options);
1153+
1154+- num_options = pc->num_presets[_PWG_PRINT_COLOR_MODE_COLOR]
1155+- [pwg_print_quality];
1156+- options = calloc((size_t)num_options, sizeof(cups_option_t));
1157+-
1158+- if (options)
1159+- {
1160+- for (i = num_options, moption = options,
1161+- coption = pc->presets[_PWG_PRINT_COLOR_MODE_COLOR]
1162+- [pwg_print_quality];
1163+- i > 0;
1164+- i --, moption ++, coption ++)
1165++ if (options)
1166+ {
1167+- moption->name = _cupsStrRetain(coption->name);
1168+- moption->value = _cupsStrRetain(coption->value);
1169+- }
1170++ for (i = num_options, moption = options,
1171++ coption = pc->presets[_PWG_PRINT_COLOR_MODE_COLOR]
1172++ [pwg_print_quality];
1173++ i > 0;
1174++ i --, moption ++, coption ++)
1175++ {
1176++ moption->name = _cupsStrRetain(coption->name);
1177++ moption->value = _cupsStrRetain(coption->value);
1178++ }
1179+
1180+- pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][pwg_print_quality] =
1181++ pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][pwg_print_quality] =
1182+ num_options;
1183+- pc->presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][pwg_print_quality] =
1184++ pc->presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][pwg_print_quality] =
1185+ options;
1186++ }
1187+ }
1188+- }
1189+- else if (pwg_print_quality != _PWG_PRINT_QUALITY_NORMAL)
1190+- continue;
1191+-
1192+- /*
1193+- * Add the grayscale option to the preset...
1194+- */
1195++ else if (pwg_print_quality != _PWG_PRINT_QUALITY_NORMAL)
1196++ continue;
1197+
1198+- pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][pwg_print_quality] =
1199+- cupsAddOption(color_option, gray_choice,
1200+- pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME]
1201+- [pwg_print_quality],
1202+- pc->presets[_PWG_PRINT_COLOR_MODE_MONOCHROME] +
1203++ /*
1204++ * Add the grayscale option to the preset...
1205++ */
1206++
1207++ pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME][pwg_print_quality] =
1208++ cupsAddOption(color_option, gray_choice,
1209++ pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME]
1210++ [pwg_print_quality],
1211++ pc->presets[_PWG_PRINT_COLOR_MODE_MONOCHROME] +
1212+ pwg_print_quality);
1213++ }
1214+ }
1215+ }
1216+ }
1217+
1218++ if (!preset_added)
1219++ {
1220++ /*
1221++ * Auto-association of PPD file option settings with the IPP job attributes
1222++ * print-color-mode, print-quality, and print-content-optimize
1223++ *
1224++ * This is used to retro-fit PPD files and classic CUPS drivers into
1225++ * Printer Applications, which are IPP printers for the clients and so
1226++ * should get controlled by standard IPP attributes as far as possible
1227++ *
1228++ * Note that settings assigned to print-content-optimize are only used
1229++ * when printing with "high" print-quality
1230++ */
1231++
1232++ _ppdCacheAssignPresets(ppd, pc);
1233++ }
1234++
1235+ /*
1236+ * Copy and convert Duplex (sides) data...
1237+ */
1238+@@ -2074,13 +2122,996 @@
1239+
1240+
1241+ /*
1242++ * '_ppdCacheAssignPresets()' - Go through all the options and choices in
1243++ * the PPD to find out which influence
1244++ * color/bw, print quality, and content
1245++ * optimizations to assign them to the prsets
1246++ * so that jobs can easily be controlled with
1247++ * standard IPP attributes
1248++ */
1249++
1250++void
1251++_ppdCacheAssignPresets(ppd_file_t *ppd,
1252++ _ppd_cache_t *pc)
1253++{
1254++ /* properties and scores for each choice of the option under evaluation */
1255++ typedef struct choice_properties_s
1256++ {
1257++ int sets_mono, /* Does this choice switch to monochrome printing? */
1258++ sets_color, /* ... to color printing? */
1259++ sets_draft, /* ... to draft/lower quality? */
1260++ sets_normal, /* ... to standard/normal quality? */
1261++ sets_high, /* ... to high/better quality? */
1262++ for_photo, /* Does this choice improve photo printing? */
1263++ for_graphics, /* ... graphics printing? */
1264++ for_text, /* ... text printing? */
1265++ for_tg, /* ... text & graphics printing? */
1266++ is_default; /* Is this choice the PPD default? */
1267++ unsigned int res_x,/* Does this choice set resolution (0 if not)? */
1268++ res_y;
1269++ } choice_properties_t;
1270++ int i, j, k, l;
1271++ unsigned int m; /* Ratio for lowering or improving
1272++ resolution */
1273++ int pass; /* Passes to go through to find best
1274++ choice */
1275++ ppd_group_t *group; /* PPD option group */
1276++ ppd_option_t *option; /* PPD option */
1277++ int is_color; /* Is this PPD for a color printer */
1278++ unsigned int base_res_x = 0, /* Base resolution of the pPD file */
1279++ base_res_y = 0;
1280++ cups_page_header2_t header, /* CUPS Raster header to investigate
1281++ embedded code in PPD */
1282++ optheader; /* CUPS Raster header to investigate
1283++ embedded code in one PPD option */
1284++ int preferred_bits; /* for _cupsRasterExecPS() function
1285++ call */
1286++ ppd_attr_t *ppd_attr; /* PPD attribute */
1287++ int res_factor = 1; /* Weights of the scores for the */
1288++ int name_factor = 10; /* print quality */
1289++ int color_factor = 1000;
1290++
1291++ /* Do we have a color printer ? */
1292++ is_color = (ppd->color_device ? 1 : 0);
1293++
1294++ /* what is the base/default resolution for this PPD? */
1295++ ppdMarkDefaults(ppd);
1296++ cupsRasterInterpretPPD(&header, ppd, 0, NULL, NULL);
1297++ if (header.HWResolution[0] != 100 || header.HWResolution[1] != 100)
1298++ {
1299++ base_res_x = header.HWResolution[0];
1300++ base_res_y = header.HWResolution[1];
1301++ }
1302++ else if ((ppd_attr = ppdFindAttr(ppd, "DefaultResolution", NULL)) != NULL)
1303++ {
1304++ /* Use the PPD-defined default resolution... */
1305++ if (sscanf(ppd_attr->value, "%dx%d", &base_res_x, &base_res_y) == 1)
1306++ base_res_y = base_res_x;
1307++ }
1308++
1309++ /* Go through all options of the PPD file */
1310++ for (i = ppd->num_groups, group = ppd->groups;
1311++ i > 0;
1312++ i --, group ++)
1313++ {
1314++ /* Skip the "Installable Options" group */
1315++ if (_cups_strncasecmp(group->name, "Installable", 11) == 0)
1316++ continue;
1317++
1318++ for (j = group->num_options, option = group->options;
1319++ j > 0;
1320++ j --, option ++)
1321++ {
1322++ int sets_color_mode = 0, /* Scores for current choice */
1323++ sets_quality = 0,
1324++ sets_optimization = 0;
1325++ int best_mono_draft = 0, /* Best score for each preset for this
1326++ option */
1327++ best_mono_normal = 0,
1328++ best_mono_high = 0,
1329++ best_color_draft = 0,
1330++ best_color_normal = 0,
1331++ best_color_high = 0,
1332++ best_photo = 0,
1333++ best_graphics = 0,
1334++ best_text = 0,
1335++ best_tg = 0;
1336++ int default_ch = -1, /* Index of default choice */
1337++ best_mono_draft_ch = -1, /* Index of choice with best score */
1338++ best_mono_normal_ch = -1,
1339++ best_mono_high_ch = -1,
1340++ best_color_draft_ch = -1,
1341++ best_color_normal_ch = -1,
1342++ best_color_high_ch = -1,
1343++ best_photo_ch = -1,
1344++ best_graphics_ch = -1,
1345++ best_text_ch = -1,
1346++ best_tg_ch = -1;
1347++ cups_array_t *choice_properties; /* Array of properties of all choices
1348++ of this option */
1349++ choice_properties_t *properties; /* Properties of current choice */
1350++ char *o, /* Name of current option */
1351++ *c, /* Name of current choice */
1352++ *p; /* Pointer into string */
1353++ int score; /* Temp variable for score
1354++ calculations */
1355++
1356++ o = option->keyword;
1357++
1358++ /* Skip options which do not change color mode and quality or
1359++ generally do not make sense in presets */
1360++ if (_cups_strcasecmp(o, "PageSize") == 0 ||
1361++ _cups_strcasecmp(o, "PageRegion") == 0 ||
1362++ _cups_strcasecmp(o, "InputSlot") == 0 ||
1363++ _cups_strcasecmp(o, "MediaSource") == 0 ||
1364++ _cups_strcasecmp(o, "MediaType") == 0 ||
1365++ _cups_strcasecmp(o, "OutputBin") == 0 ||
1366++ _cups_strcasecmp(o, "Duplex") == 0 ||
1367++ _cups_strcasecmp(o, "JCLDuplex") == 0 ||
1368++ _cups_strcasecmp(o, "EFDuplex") == 0 ||
1369++ _cups_strcasecmp(o, "EFDuplexing") == 0 ||
1370++ _cups_strcasecmp(o, "ARDuplex") == 0 ||
1371++ _cups_strcasecmp(o, "KD03Duplex") == 0 ||
1372++ _cups_strcasecmp(o, "Collate") == 0)
1373++ continue;
1374++
1375++ /* Set members options of composite options in Foomatic to stay
1376++ controlled by the composite option */
1377++
1378++ /* Composite options in Foomatic are options which set a number
1379++ of other options, so each choice of them is the same as a
1380++ preset in CUPS. In addition, some PPDs in Foomatic have a
1381++ composite option named "PrintoutMode" with 6 choices, exactly
1382++ the 6 of the grid of CUPS presets, color/mono in draft,
1383++ mediaum, and high quality. The composite options are created
1384++ by hand, so they surely do for what they are intended for and
1385++ so they are safer as this preset auto-generation
1386++ algorithm. Therefore we only let the composite option be set
1387++ in our presets and set the member options to leave the
1388++ control at the composite option */
1389++
1390++ if (strstr(ppd->nickname, "Foomatic") &&
1391++ !strncmp(option->choices[0].choice, "From", 4) &&
1392++ ppdFindOption(ppd, option->choices[0].choice + 4))
1393++ {
1394++ for (k = 0; k < 2; k ++)
1395++ for (l = 0; l < 3; l ++)
1396++ if (cupsGetOption(option->choices[0].choice + 4,
1397++ pc->num_presets[k][l], pc->presets[k][l]))
1398++ pc->num_presets[k][l] =
1399++ cupsAddOption(o, option->choices[0].choice,
1400++ pc->num_presets[k][l], &(pc->presets[k][l]));
1401++ for (k = 0; k < 5; k ++)
1402++ if (cupsGetOption(option->choices[0].choice + 4,
1403++ pc->num_optimize_presets[k],
1404++ pc->optimize_presets[k]))
1405++ pc->num_optimize_presets[k] =
1406++ cupsAddOption(o, option->choices[0].choice,
1407++ pc->num_optimize_presets[k],
1408++ &(pc->optimize_presets[k]));
1409++ continue;
1410++ }
1411++
1412++ /* Array for properties of the choices */
1413++ choice_properties = cupsArrayNew(NULL, NULL);
1414++
1415++ /*
1416++ * Gather the data for each choice
1417++ */
1418++
1419++ for (k = 0; k < option->num_choices; k ++)
1420++ {
1421++ properties =
1422++ (choice_properties_t *)calloc(1, sizeof(choice_properties_t));
1423++
1424++ c = option->choices[k].choice;
1425++
1426++ /* Is this the default choice? (preferred for "normal" quality,
1427++ used for color if no choice name suggests being color */
1428++ if (strcmp(c, option->defchoice) == 0)
1429++ {
1430++ properties->is_default = 1;
1431++ default_ch = k;
1432++ }
1433++
1434++ /*
1435++ * Color/Gray - print-color-mode
1436++ */
1437++
1438++ /* If we have a color device, check whether this option sets mono or
1439++ color printing */
1440++ if (is_color)
1441++ {
1442++ if (_cups_strcasecmp(o, "CNIJSGrayScale") == 0)
1443++ {
1444++ if (_cups_strcasecmp(c, "1") == 0)
1445++ properties->sets_mono = 2;
1446++ else
1447++ properties->sets_color = 1;
1448++ }
1449++ else if (_cups_strcasecmp(o, "HPColorAsGray") == 0 || /* HP PostScript */
1450++ _cups_strcasecmp(o, "HPPJLColorAsGray") == 0) /* HP PostScript */
1451++ {
1452++ if (_cups_strcasecmp(c, "True") == 0 ||
1453++ _cups_strcasecmp(c, "yes") == 0)
1454++ properties->sets_mono = 2;
1455++ else
1456++ properties->sets_color = 1;
1457++ }
1458++ else if (_cups_strcasecmp(o, "ColorModel") == 0 ||
1459++ _cups_strcasecmp(o, "ColorMode") == 0 ||
1460++ _cups_strcasecmp(o, "OutputMode") == 0 ||
1461++ _cups_strcasecmp(o, "PrintoutMode") == 0 ||
1462++ _cups_strcasecmp(o, "ARCMode") == 0 || /* Sharp */
1463++ _cups_strcasestr(o, "ColorMode") ||
1464++ _cups_strcasecmp(o, "ColorResType") == 0 || /* Toshiba */
1465++ _cups_strcasestr(o, "MonoColor")) /* Brother */
1466++ {
1467++ /* Monochrome/grayscale printing */
1468++ if (_cups_strcasestr(c, "Mono") ||
1469++ _cups_strcasecmp(c, "Black") == 0 ||
1470++ ((p = _cups_strcasestr(c, "Black")) && _cups_strcasestr(p, "White")) ||
1471++ (_cups_strncasecmp(c, "BW", 2) == 0 && !isalpha(c[2])))
1472++ properties->sets_mono = 2;
1473++ else if (_cups_strcasestr(c, "Gray") ||
1474++ _cups_strcasestr(c, "Grey") ||
1475++ _cups_strcasecmp(c, "BlackOnly") == 0) /* Lexmark */
1476++ properties->sets_mono = 3;
1477++
1478++ /* Color printing */
1479++ if (((p = _cups_strcasestr(c, "CMY")) && !_cups_strcasestr(p, "Gray")) ||
1480++ _cups_strcasecmp(c, "ColorOnly") == 0 || /* Lexmark */
1481++ ((p = _cups_strcasestr(c, "Adobe")) && _cups_strcasestr(p, "RGB")))
1482++ properties->sets_color = 2;
1483++ else if (_cups_strcasestr(c, "sRGB"))
1484++ properties->sets_color = 4;
1485++ else if (_cups_strcasestr(c, "RGB") ||
1486++ _cups_strcasestr(c, "Color"))
1487++ properties->sets_color = 3;
1488++ }
1489++
1490++ /* This option actually sets color mode */
1491++ if (properties->sets_mono || properties->sets_color)
1492++ sets_color_mode = 1;
1493++ }
1494++
1495++ /*
1496++ * Output Quality - print-quality
1497++ */
1498++
1499++ /* check whether this option affects print quality or content
1500++ optimization */
1501++
1502++ /* Determine influence of the options and choices on the print
1503++ quality by their names */
1504++
1505++ /* Vendor-specific option and choice names */
1506++ if (_cups_strcasecmp(o, "ARCPPriority") == 0) /* Sharp */
1507++ {
1508++ if (_cups_strcasecmp(c, "Quality") == 0)
1509++ properties->sets_high = 10;
1510++ else if (_cups_strcasecmp(c, "Speed") == 0)
1511++ properties->sets_draft = 10;
1512++ }
1513++ else if (_cups_strcasecmp(o, "BRJpeg") == 0) /* Brother */
1514++ {
1515++ if (_cups_strcasecmp(c, "QualityPrior") == 0)
1516++ properties->sets_high = 10;
1517++ else if (_cups_strcasecmp(c, "SpeedPrior") == 0)
1518++ properties->sets_draft = 10;
1519++ }
1520++ else if (_cups_strcasecmp(o, "RIPrintMode") == 0) /* Ricoh & OEM */
1521++ {
1522++ if (_cups_strcasecmp(c, "1rhit") == 0)
1523++ properties->sets_high = 7;
1524++ else if (_cups_strcasecmp(c, "6rhit") == 0)
1525++ properties->sets_high = 10;
1526++ else if (_cups_strcasecmp(c, "3rhit") == 0 ||
1527++ _cups_strcasecmp(c, "4rhit") == 0 ||
1528++ _cups_strcasecmp(c, "5rhit") == 0)
1529++ properties->sets_draft = 10;
1530++ else if (_cups_strcasecmp(c, "0rhit") == 0)
1531++ properties->sets_normal = 10;
1532++ }
1533++ else if (_cups_strcasecmp(o, "EconoMode") == 0 || /* Foomatic */
1534++ _cups_strcasecmp(o, "EconoFast") == 0) /* Foomatic (HP PPA) */
1535++ {
1536++ if (_cups_strcasecmp(c, "Off") == 0 ||
1537++ _cups_strcasecmp(c, "False") == 0)
1538++ properties->sets_high = 1;
1539++ else if (_cups_strcasecmp(c, "On") == 0 ||
1540++ _cups_strcasecmp(c, "True") == 0 ||
1541++ _cups_strcasecmp(c, "Low") == 0)
1542++ properties->sets_draft = 10;
1543++ else if (_cups_strcasecmp(c, "High") == 0)
1544++ properties->sets_draft = 11;
1545++ }
1546++ else if (_cups_strcasestr(o, "ColorPrecision")) /* Gutenprint */
1547++ {
1548++ if (_cups_strcasecmp(c, "best") == 0)
1549++ properties->sets_high = 10;
1550++ }
1551++ /* Generic boolean options which enhance quality if true */
1552++ else if (((p = _cups_strcasestr(o, "slow")) && _cups_strcasestr(p, "dry")) ||
1553++ ((p = _cups_strcasestr(o, "color")) && _cups_strcasestr(p, "enhance")) ||
1554++ ((p = _cups_strcasestr(o, "resolution")) &&
1555++ !_cups_strcasestr(p, "enhance")) ||
1556++ _cups_strcasecmp(o, "RET") == 0 ||
1557++ _cups_strcasecmp(o, "Smoothing") == 0 || /* HPLIP */
1558++ ((p = _cups_strcasestr(o, "uni")) && _cups_strcasestr(p, "direction")))
1559++ {
1560++ if (_cups_strcasecmp(c, "True") == 0 ||
1561++ _cups_strcasecmp(c, "On") == 0 ||
1562++ _cups_strcasecmp(c, "Yes") == 0 ||
1563++ _cups_strcasecmp(c, "1") == 0 ||
1564++ _cups_strcasecmp(c, "Medium") == 0) /* Resolution Enhancement/RET (HP)*/
1565++ properties->sets_high = 3;
1566++ else if (_cups_strcasecmp(c, "False") == 0 ||
1567++ _cups_strcasecmp(c, "Off") == 0 ||
1568++ _cups_strcasecmp(c, "No") == 0 ||
1569++ _cups_strcasecmp(c, "0") == 0)
1570++ properties->sets_draft = 3;
1571++ }
1572++ /* Generic boolean options which reduce quality if true */
1573++ else if (_cups_strcasestr(o, "draft") ||
1574++ _cups_strcasestr(o, "economy") ||
1575++ ((p = _cups_strcasestr(o, "eco")) && _cups_strcasestr(p, "mode")) ||
1576++ ((p = _cups_strcasestr(o, "toner")) && _cups_strcasestr(p, "sav")) ||
1577++ ((p = _cups_strcasestr(o, "bi")) && _cups_strcasestr(p, "direction")) ||
1578++ _cups_strcasecmp(o, "EcoBlack") == 0 || /* Foomatic (Alps) */
1579++ _cups_strcasecmp(o, "bidi") == 0 ||
1580++ _cups_strcasecmp(o, "bi-di") == 0)
1581++ {
1582++ if (_cups_strcasecmp(c, "True") == 0 ||
1583++ _cups_strcasecmp(c, "On") == 0 ||
1584++ _cups_strcasecmp(c, "Yes") == 0 ||
1585++ _cups_strcasecmp(c, "1") == 0 ||
1586++ _cups_strcasecmp(c, "Medium") == 0) /* EconomyMode (Brother) */
1587++ properties->sets_draft = 3;
1588++ else if (_cups_strcasecmp(c, "False") == 0 ||
1589++ _cups_strcasecmp(c, "Off") == 0 ||
1590++ _cups_strcasecmp(c, "No") == 0 ||
1591++ _cups_strcasecmp(c, "0") == 0)
1592++ properties->sets_high = 3;
1593++ }
1594++ /* Generic enumerated choice option and choice names */
1595++ else if (_cups_strcasecmp(o, "ColorModel") == 0 ||
1596++ _cups_strcasecmp(o, "ColorMode") == 0 ||
1597++ _cups_strcasecmp(o, "OutputMode") == 0 || /* HPLIP hpcups */
1598++ _cups_strcasecmp(o, "PrintoutMode") == 0 || /* Foomatic */
1599++ _cups_strcasecmp(o, "PrintQuality") == 0 ||
1600++ _cups_strcasecmp(o, "PrintMode") == 0 ||
1601++ _cups_strcasestr(o, "ColorMode") ||
1602++ _cups_strcasestr(o, "HalfTone") || /* HPLIP */
1603++ _cups_strcasecmp(o, "ColorResType") == 0 || /* Toshiba */
1604++ _cups_strcasestr(o, "MonoColor") || /* Brother */
1605++ _cups_strcasestr(o, "Quality") ||
1606++ _cups_strcasestr(o, "Resolution") ||
1607++ _cups_strcasestr(o, "Precision") || /* ex. stpColorPrecision
1608++ in Gutenprint */
1609++ _cups_strcasestr(o, "PrintingDirection")) /* Gutenprint */
1610++ {
1611++ /* High quality */
1612++ if (_cups_strcasecmp(c, "Quality") == 0 ||
1613++ _cups_strcasecmp(c, "5") == 0)
1614++ properties->sets_high = 1;
1615++ else if (_cups_strcasestr(c, "Photo") ||
1616++ _cups_strcasestr(c, "Enhance") ||
1617++ _cups_strcasestr(c, "slow") ||
1618++ _cups_strncasecmp(c, "ProRes", 6) == 0 || /* HPLIP */
1619++ _cups_strncasecmp(c, "ImageREt", 8) == 0 || /* HPLIP */
1620++ ((p = _cups_strcasestr(c, "low")) && _cups_strcasestr(p, "speed")))
1621++ properties->sets_high = 2;
1622++ else if (_cups_strcasestr(c, "fine") ||
1623++ _cups_strcasestr(c, "deep") ||
1624++ ((p = _cups_strcasestr(c, "high")) && !_cups_strcasestr(p, "speed")) ||
1625++ _cups_strcasestr(c, "HQ") ||
1626++ _cups_strcasecmp(c, "ProRes600") == 0 || /* HPLIP */
1627++ _cups_strcasecmp(c, "ImageREt1200") == 0 || /* HPLIP */
1628++ _cups_strcasecmp(c, "Enhanced") == 0)
1629++ properties->sets_high = 3;
1630++ else if (_cups_strcasestr(c, "best") ||
1631++ _cups_strcasecmp(c, "high") == 0 ||
1632++ _cups_strcasecmp(c, "fine") == 0 ||
1633++ _cups_strcasecmp(c, "HQ") == 0 ||
1634++ _cups_strcasecmp(c, "CMYGray") == 0 || /* HPLIP */
1635++ _cups_strcasecmp(c, "ProRes1200") == 0 || /* HPLIP */
1636++ _cups_strcasecmp(c, "ImageREt2400") == 0 || /* HPLIP */
1637++ _cups_strcasestr(c, "unidir"))
1638++ properties->sets_high = 4;
1639++ else if (_cups_strcasecmp(c, "best") == 0 ||
1640++ _cups_strcasecmp(c, "ProRes2400") == 0 || /* HPLIP */
1641++ _cups_strcasecmp(c, "monolowdetail") == 0) /* Toshiba */
1642++ properties->sets_high = 5;
1643++
1644++ /* Low/Draft quality */
1645++ if (_cups_strcasecmp(c, "monolowdetail") == 0 || /* Toshiba */
1646++ _cups_strcasecmp(c, "3") == 0)
1647++ properties->sets_draft = 1;
1648++ else if (((p = _cups_strcasestr(c, "fast")) && _cups_strcasestr(p, "draft")) ||
1649++ ((p = _cups_strcasestr(c, "high")) && _cups_strcasestr(p, "speed")) ||
1650++ (_cups_strcasestr(c, "speed") && !_cups_strcasestr(c, "low")))
1651++ properties->sets_draft = 2;
1652++ else if (_cups_strcasestr(c, "quick") ||
1653++ (_cups_strcasestr(c, "fast") &&
1654++ !(_cups_strncasecmp(c, "FastRes", 7) == 0 && isdigit(*(c + 7)))))
1655++ /* HPLIP has FastRes600, FastRes1200, ... which are not draft */
1656++ properties->sets_draft = 3;
1657++ else if (_cups_strcasecmp(c, "quick") == 0 ||
1658++ _cups_strcasecmp(c, "fast") == 0 ||
1659++ _cups_strcasestr(c, "draft") ||
1660++ (_cups_strcasestr(c, "low") && !_cups_strcasestr(c, "slow")) ||
1661++ _cups_strcasestr(c, "coarse"))
1662++ properties->sets_draft = 4;
1663++ else if (_cups_strcasecmp(c, "draft") == 0 ||
1664++ _cups_strcasecmp(c, "low") == 0 ||
1665++ _cups_strcasecmp(c, "coarse") == 0 ||
1666++ _cups_strcasestr(c, "bidir"))
1667++ properties->sets_draft = 5;
1668++
1669++ /* Use high or low quality but not the extremes */
1670++ if (_cups_strcasestr(c, "ultra") ||
1671++ _cups_strcasestr(c, "very") ||
1672++ _cups_strcasestr(c, "super"))
1673++ {
1674++ if (properties->sets_high > 1)
1675++ properties->sets_high --;
1676++ if (properties->sets_draft > 1)
1677++ properties->sets_draft --;
1678++ }
1679++
1680++ /* Normal quality */
1681++ if (_cups_strcasestr(c, "automatic") ||
1682++ _cups_strcasecmp(c, "none") == 0 ||
1683++ _cups_strcasecmp(c, "4") == 0 ||
1684++ _cups_strcasecmp(c, "FastRes1200") == 0) /* HPLIP */
1685++ properties->sets_normal = 1;
1686++ else if (_cups_strcasestr(c, "normal") ||
1687++ _cups_strcasestr(c, "standard") ||
1688++ _cups_strcasestr(c, "default") ||
1689++ _cups_strcasecmp(c, "FastRes600") == 0) /* HPLIP */
1690++ properties->sets_normal = 2;
1691++ else if (_cups_strcasecmp(c, "normal") == 0 ||
1692++ _cups_strcasecmp(c, "standard") == 0 ||
1693++ _cups_strcasecmp(c, "default") == 0)
1694++ properties->sets_normal = 4;
1695++ }
1696++
1697++ /* Apply the weight factor for option/choice-name-related scores */
1698++ properties->sets_high *= name_factor;
1699++ properties->sets_draft *= name_factor;
1700++ properties->sets_normal *= name_factor;
1701++
1702++ /* Determine influence of the options and choices on the print
1703++ quality by how they change the output resolution compared to
1704++ the base/default resolution */
1705++ if (base_res_x && base_res_y)
1706++ {
1707++ /* First, analyse the code snippet (PostScript, PJL) assigned
1708++ to each choice of the option whether it sets resolution */
1709++ if (option->choices[k].code && option->choices[k].code[0])
1710++ {
1711++ /* Assume code to be PostScript (also used for CUPS Raster) */
1712++ preferred_bits = 0;
1713++ optheader = header;
1714++ if (_cupsRasterExecPS(&optheader, &preferred_bits,
1715++ option->choices[k].code) == 0)
1716++ {
1717++ properties->res_x = optheader.HWResolution[0];
1718++ properties->res_y = optheader.HWResolution[1];
1719++ }
1720++ else
1721++ properties->res_x = properties->res_y = 0; /* invalid */
1722++ if (properties->res_x == 0 || properties->res_y == 0)
1723++ {
1724++ /* Now try PJL */
1725++ if ((p = strstr(option->choices[k].code, "SET")) &&
1726++ isspace(*(p + 3)) && (p = strstr(p + 4, "RESOLUTION=")))
1727++ {
1728++ p += 11;
1729++ if (sscanf(p, "%dX%d",
1730++ &(properties->res_x), &(properties->res_y)) == 1)
1731++ properties->res_y = properties->res_x;
1732++ }
1733++ }
1734++ if (properties->res_x == 100 && properties->res_y == 100)
1735++ properties->res_x = properties->res_y = 0; /* Code does not
1736++ set resolution */
1737++ }
1738++ else
1739++ properties->res_x = properties->res_y = 0; /* invalid */
1740++
1741++ /* Then parse the choice name whether it contains a
1742++ resolution value (Must have "dpi", as otherwise can be
1743++ something else, like a page size */
1744++ if ((properties->res_x == 0 || properties->res_y == 0) &&
1745++ (p = _cups_strcasestr(c, "dpi")) != NULL)
1746++ {
1747++ if (p > c)
1748++ {
1749++ p --;
1750++ while (p > c && isspace(*p))
1751++ p --;
1752++ if (p > c && isdigit(*p))
1753++ {
1754++ char x;
1755++ while (p > c && isdigit(*p))
1756++ p --;
1757++ if (p > c && (*p == 'x' || *p == 'X'))
1758++ p --;
1759++ while (p > c && isdigit(*p))
1760++ p --;
1761++ while (!isdigit(*p))
1762++ p ++;
1763++ if (sscanf(p, "%d%c%d",
1764++ &(properties->res_x), &x, &(properties->res_y)) == 2)
1765++ properties->res_y = properties->res_x;
1766++ }
1767++ }
1768++ }
1769++
1770++ if (properties->res_x != 0 && properties->res_y != 0)
1771++ {
1772++ /* Choice suggests to set the resolution */
1773++ /* Raising resolution compared to default? */
1774++ m = (properties->res_x * properties->res_y) /
1775++ (base_res_x * base_res_y);
1776++ /* No or small change -> Normal quality */
1777++ if (m == 1)
1778++ properties->sets_normal += res_factor * 4;
1779++ /* At least double the pixels -> High quality */
1780++ else if (m == 2)
1781++ properties->sets_high += res_factor * 3;
1782++ else if (m > 2 && m <= 8)
1783++ properties->sets_high += res_factor * 4;
1784++ else if (m > 8 && m <= 32)
1785++ properties->sets_high += res_factor * 2;
1786++ else if (m > 32)
1787++ properties->sets_high += res_factor * 1;
1788++ else if (m < 1)
1789++ {
1790++ /* Reducing resolution compared to default? */
1791++ m = (base_res_x * base_res_y) /
1792++ (properties->res_x * properties->res_y);
1793++ /* No or small change -> Normal quality */
1794++ if (m == 1)
1795++ properties->sets_normal += res_factor * 1;
1796++ /* At most half the pixels -> Draft quality */
1797++ else if (m == 2)
1798++ properties->sets_draft += res_factor * 3;
1799++ else if (m > 2 && m < 8)
1800++ properties->sets_draft += res_factor * 4;
1801++ else if (m >= 8 && m < 32)
1802++ properties->sets_draft += res_factor * 2;
1803++ else if (m >= 32)
1804++ properties->sets_draft += res_factor * 1;
1805++ }
1806++ }
1807++ }
1808++
1809++ /* This option actually sets print quality */
1810++ if (properties->sets_draft || properties->sets_high)
1811++ sets_quality = 1;
1812++
1813++ /* Add the properties of this choice */
1814++ cupsArrayAdd(choice_properties, properties);
1815++ }
1816++
1817++ /*
1818++ * Find the best choice for each field of the color/quality preset
1819++ * grid
1820++ */
1821++
1822++ for (pass = 0; pass < 3; pass ++)
1823++ {
1824++ for (k = 0; k < option->num_choices; k ++)
1825++ {
1826++ properties = cupsArrayIndex(choice_properties, k);
1827++
1828++ /* presets[0][0]: Mono/Draft */
1829++ if (best_mono_draft >= 0 &&
1830++ !properties->sets_color &&
1831++ (!properties->sets_high || pass > 0))
1832++ {
1833++ score = color_factor * properties->sets_mono +
1834++ properties->sets_draft;
1835++ if (score > best_mono_draft)
1836++ {
1837++ best_mono_draft = score;
1838++ best_mono_draft_ch = k;
1839++ }
1840++ }
1841++
1842++ /* presets[0][1]: Mono/Normal */
1843++ if (best_mono_normal >= 0 &&
1844++ !properties->sets_color &&
1845++ (!properties->sets_draft || pass > 1) &&
1846++ (!properties->sets_high || pass > 0))
1847++ {
1848++ score = color_factor * properties->sets_mono +
1849++ properties->sets_normal;
1850++ if (score > best_mono_normal)
1851++ {
1852++ best_mono_normal = score;
1853++ best_mono_normal_ch = k;
1854++ }
1855++ }
1856++
1857++ /* presets[0][2]: Mono/High */
1858++ if (best_mono_high >= 0 &&
1859++ !properties->sets_color &&
1860++ (!properties->sets_draft || pass > 0))
1861++ {
1862++ score = color_factor * properties->sets_mono +
1863++ properties->sets_high;
1864++ if (score > best_mono_high)
1865++ {
1866++ best_mono_high = score;
1867++ best_mono_high_ch = k;
1868++ }
1869++ }
1870++
1871++ /* presets[1][0]: Color/Draft */
1872++ if (best_color_draft >= 0 &&
1873++ !properties->sets_mono &&
1874++ (!properties->sets_high || pass > 0))
1875++ {
1876++ score = color_factor * properties->sets_color +
1877++ properties->sets_draft;
1878++ if (score > best_color_draft)
1879++ {
1880++ best_color_draft = score;
1881++ best_color_draft_ch = k;
1882++ }
1883++ }
1884++
1885++ /* presets[1][1]: Color/Normal */
1886++ if (best_color_normal >= 0 &&
1887++ !properties->sets_mono &&
1888++ (!properties->sets_draft || pass > 1) &&
1889++ (!properties->sets_high || pass > 0))
1890++ {
1891++ score = color_factor * properties->sets_color +
1892++ properties->sets_normal;
1893++ if (score > best_color_normal)
1894++ {
1895++ best_color_normal = score;
1896++ best_color_normal_ch = k;
1897++ }
1898++ }
1899++
1900++ /* presets[1][2]: Color/High */
1901++ if (best_color_high >= 0 &&
1902++ !properties->sets_mono &&
1903++ (!properties->sets_draft || pass > 0))
1904++ {
1905++ score = color_factor * properties->sets_color +
1906++ properties->sets_high;
1907++ if (score > best_color_high)
1908++ {
1909++ best_color_high = score;
1910++ best_color_high_ch = k;
1911++ }
1912++ }
1913++ }
1914++ /* Block next passes for the presets where we are done */
1915++ if (best_mono_draft_ch >= 0)
1916++ best_mono_draft = -1;
1917++ if (best_mono_normal_ch >= 0)
1918++ best_mono_normal = -1;
1919++ if (best_mono_high_ch >= 0)
1920++ best_mono_high = -1;
1921++ if (best_color_draft_ch >= 0)
1922++ best_color_draft = -1;
1923++ if (best_color_normal_ch >= 0)
1924++ best_color_normal = -1;
1925++ if (best_color_high_ch >= 0)
1926++ best_color_high = -1;
1927++ }
1928++
1929++ /*
1930++ * Content Optimization - print-content-optimize
1931++ */
1932++
1933++ for (k = 0; k < option->num_choices; k ++)
1934++ {
1935++ properties = cupsArrayIndex(choice_properties, k);
1936++ c = option->choices[k].choice;
1937++
1938++ /* Vendor-specific options */
1939++ if (_cups_strcasecmp(o, "ARCOType") == 0) /* Sharp */
1940++ {
1941++ if (_cups_strcasecmp(c, "COTDrawing") == 0)
1942++ {
1943++ properties->for_text = 3;
1944++ properties->for_graphics = 2;
1945++ properties->for_tg = 2;
1946++ }
1947++ else if (_cups_strcasecmp(c, "COTGraphics") == 0)
1948++ {
1949++ properties->for_graphics = 3;
1950++ properties->for_tg = 3;
1951++ }
1952++ else if (_cups_strcasecmp(c, "COTPhoto") == 0)
1953++ properties->for_photo = 3;
1954++ }
1955++ else if (_cups_strcasecmp(o, "HPRGBEmulation") == 0) /* HP */
1956++ {
1957++ if (_cups_strcasecmp(c, "DefaultSRGB") == 0)
1958++ properties->for_text = 3;
1959++ else if (_cups_strcasecmp(c, "VividSRGB") == 0)
1960++ {
1961++ properties->for_graphics = 3;
1962++ properties->for_tg = 3;
1963++ }
1964++ else if (_cups_strcasecmp(c, "PhotoSRGB") == 0)
1965++ properties->for_photo = 3;
1966++ }
1967++ else
1968++ /* Generic choice names */
1969++ {
1970++ if (_cups_strcasestr(c, "photo"))
1971++ properties->for_photo = 6;
1972++ else if (_cups_strcasecmp(c, "photo") == 0)
1973++ properties->for_photo = 7;
1974++
1975++ if (_cups_strcasestr(c, "graphic"))
1976++ properties->for_graphics = 6;
1977++ else if (_cups_strcasecmp(c, "graphic") == 0 ||
1978++ _cups_strcasecmp(c, "graphics") == 0)
1979++ properties->for_graphics = 7;
1980++
1981++ if (_cups_strcasestr(c, "text"))
1982++ {
1983++ if (_cups_strcasestr(c, "graphic"))
1984++ properties->for_tg = 7;
1985++ else
1986++ properties->for_text = 6;
1987++ }
1988++ else if (_cups_strcasecmp(c, "text") == 0)
1989++ properties->for_text = 7;
1990++
1991++ if (_cups_strcasestr(c, "presentation"))
1992++ {
1993++ properties->for_text = 4;
1994++ properties->for_graphics = 4;
1995++ properties->for_tg = 4;
1996++ }
1997++ else if (_cups_strcasecmp(c, "presentation") == 0)
1998++ {
1999++ properties->for_text = 5;
2000++ properties->for_graphics = 5;
2001++ properties->for_tg = 5;
2002++ }
2003++
2004++ if (_cups_strcasestr(c, "lineart"))
2005++ {
2006++ properties->for_graphics = 2;
2007++ properties->for_tg = 2;
2008++ }
2009++ else if (_cups_strcasecmp(c, "lineart") == 0)
2010++ {
2011++ properties->for_graphics = 3;
2012++ properties->for_tg = 3;
2013++ }
2014++
2015++ if (_cups_strcasestr(c, "drawing"))
2016++ {
2017++ properties->for_graphics = 4;
2018++ properties->for_tg = 4;
2019++ }
2020++ else if (_cups_strcasecmp(c, "drawing") == 0)
2021++ {
2022++ properties->for_graphics = 5;
2023++ properties->for_tg = 5;
2024++ }
2025++
2026++ if (_cups_strcasestr(c, "natural"))
2027++ properties->for_photo = 2;
2028++ else if (_cups_strcasecmp(c, "natural") == 0)
2029++ properties->for_photo = 3;
2030++
2031++ if (_cups_strcasestr(c, "vivid"))
2032++ {
2033++ properties->for_text = 2;
2034++ properties->for_graphics = 2;
2035++ properties->for_tg = 2;
2036++ }
2037++ else if (_cups_strcasecmp(c, "vivid") == 0)
2038++ {
2039++ properties->for_text = 3;
2040++ properties->for_graphics = 3;
2041++ properties->for_tg = 3;
2042++ }
2043++ }
2044++
2045++ /* We apply these optimizations only in high quality mode
2046++ therefore we prefer settings for high quality */
2047++ if (properties->sets_high && !properties->sets_draft)
2048++ {
2049++ if (properties->for_photo)
2050++ properties->for_photo += 10;
2051++ if (properties->for_graphics)
2052++ properties->for_graphics += 10;
2053++ if (properties->for_text)
2054++ properties->for_text += 10;
2055++ if (properties->for_tg)
2056++ properties->for_tg += 10;
2057++ }
2058++
2059++ /*
2060++ * Find the best choice for each field of the content optimize presets
2061++ */
2062++
2063++ /* Find best choice for each task */
2064++ /* optimize_presets[1]: Photo */
2065++ if (properties->for_photo > best_photo)
2066++ {
2067++ best_photo = properties->for_photo;
2068++ best_photo_ch = k;
2069++ }
2070++ /* optimize_presets[2]: Graphics */
2071++ if (properties->for_graphics > best_graphics)
2072++ {
2073++ best_graphics = properties->for_graphics;
2074++ best_graphics_ch = k;
2075++ }
2076++ /* optimize_presets[3]: Text */
2077++ if (properties->for_text > best_text)
2078++ {
2079++ best_text = properties->for_text;
2080++ best_text_ch = k;
2081++ }
2082++ /* optimize_presets[4]: Text and Graphics */
2083++ if (properties->for_tg > best_tg)
2084++ {
2085++ best_tg = properties->for_tg;
2086++ best_tg_ch = k;
2087++ }
2088++
2089++ /* This option actually does content optimization */
2090++ if (properties->for_text || properties->for_graphics ||
2091++ properties->for_tg || properties->for_photo)
2092++ sets_optimization = 1;
2093++ }
2094++
2095++ /*
2096++ * Fill in the presets
2097++ */
2098++
2099++ if (sets_color_mode || sets_quality)
2100++ {
2101++ /* presets[0][0]: Mono/Draft */
2102++ if (best_mono_draft_ch < 0)
2103++ best_mono_draft_ch = default_ch;
2104++ if (best_mono_draft_ch >= 0)
2105++ pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME]
2106++ [_PWG_PRINT_QUALITY_DRAFT] =
2107++ cupsAddOption(o, option->choices[best_mono_draft_ch].choice,
2108++ pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME]
2109++ [_PWG_PRINT_QUALITY_DRAFT],
2110++ &(pc->presets[_PWG_PRINT_COLOR_MODE_MONOCHROME]
2111++ [_PWG_PRINT_QUALITY_DRAFT]));
2112++
2113++ /* presets[0][1]: Mono/Normal */
2114++ if (best_mono_normal_ch < 0)
2115++ best_mono_normal_ch = default_ch;
2116++ if (best_mono_normal_ch >= 0)
2117++ pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME]
2118++ [_PWG_PRINT_QUALITY_NORMAL] =
2119++ cupsAddOption(o, option->choices[best_mono_normal_ch].choice,
2120++ pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME]
2121++ [_PWG_PRINT_QUALITY_NORMAL],
2122++ &(pc->presets[_PWG_PRINT_COLOR_MODE_MONOCHROME]
2123++ [_PWG_PRINT_QUALITY_NORMAL]));
2124++
2125++ /* presets[0][2]: Mono/High */
2126++ if (best_mono_high_ch < 0)
2127++ best_mono_high_ch = default_ch;
2128++ if (best_mono_high_ch >= 0)
2129++ pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME]
2130++ [_PWG_PRINT_QUALITY_HIGH] =
2131++ cupsAddOption(o, option->choices[best_mono_high_ch].choice,
2132++ pc->num_presets[_PWG_PRINT_COLOR_MODE_MONOCHROME]
2133++ [_PWG_PRINT_QUALITY_HIGH],
2134++ &(pc->presets[_PWG_PRINT_COLOR_MODE_MONOCHROME]
2135++ [_PWG_PRINT_QUALITY_HIGH]));
2136++
2137++ /* presets[1][0]: Color/Draft */
2138++ if (best_color_draft_ch < 0)
2139++ best_color_draft_ch = default_ch;
2140++ if (best_color_draft_ch >= 0)
2141++ pc->num_presets[_PWG_PRINT_COLOR_MODE_COLOR]
2142++ [_PWG_PRINT_QUALITY_DRAFT] =
2143++ cupsAddOption(o, option->choices[best_color_draft_ch].choice,
2144++ pc->num_presets[_PWG_PRINT_COLOR_MODE_COLOR]
2145++ [_PWG_PRINT_QUALITY_DRAFT],
2146++ &(pc->presets[_PWG_PRINT_COLOR_MODE_COLOR]
2147++ [_PWG_PRINT_QUALITY_DRAFT]));
2148++
2149++ /* presets[1][1]: Color/Normal */
2150++ if (best_color_normal_ch < 0)
2151++ best_color_normal_ch = default_ch;
2152++ if (best_color_normal_ch >= 0)
2153++ pc->num_presets[_PWG_PRINT_COLOR_MODE_COLOR]
2154++ [_PWG_PRINT_QUALITY_NORMAL] =
2155++ cupsAddOption(o, option->choices[best_color_normal_ch].choice,
2156++ pc->num_presets[_PWG_PRINT_COLOR_MODE_COLOR]
2157++ [_PWG_PRINT_QUALITY_NORMAL],
2158++ &(pc->presets[_PWG_PRINT_COLOR_MODE_COLOR]
2159++ [_PWG_PRINT_QUALITY_NORMAL]));
2160++
2161++ /* presets[1][2]: Color/High */
2162++ if (best_color_high_ch < 0)
2163++ best_color_high_ch = default_ch;
2164++ if (best_color_high_ch >= 0)
2165++ pc->num_presets[_PWG_PRINT_COLOR_MODE_COLOR]
2166++ [_PWG_PRINT_QUALITY_HIGH] =
2167++ cupsAddOption(o, option->choices[best_color_high_ch].choice,
2168++ pc->num_presets[_PWG_PRINT_COLOR_MODE_COLOR]
2169++ [_PWG_PRINT_QUALITY_HIGH],
2170++ &(pc->presets[_PWG_PRINT_COLOR_MODE_COLOR]
2171++ [_PWG_PRINT_QUALITY_HIGH]));
2172++
2173++ }
2174++
2175++ if (sets_optimization)
2176++ {
2177++
2178++ /* optimize_presets[1]: Photo */
2179++ if (best_photo_ch >= 0)
2180++ pc->num_optimize_presets[_PWG_PRINT_CONTENT_OPTIMIZE_PHOTO] =
2181++ cupsAddOption
2182++ (o, option->choices[best_photo_ch].choice,
2183++ pc->num_optimize_presets[_PWG_PRINT_CONTENT_OPTIMIZE_PHOTO],
2184++ &(pc->optimize_presets[_PWG_PRINT_CONTENT_OPTIMIZE_PHOTO]));
2185++
2186++ /* optimize_presets[2]: Graphics */
2187++ if (best_graphics_ch >= 0)
2188++ pc->num_optimize_presets[_PWG_PRINT_CONTENT_OPTIMIZE_GRAPHICS] =
2189++ cupsAddOption
2190++ (o, option->choices[best_graphics_ch].choice,
2191++ pc->num_optimize_presets
2192++ [_PWG_PRINT_CONTENT_OPTIMIZE_GRAPHICS],
2193++ &(pc->optimize_presets
2194++ [_PWG_PRINT_CONTENT_OPTIMIZE_GRAPHICS]));
2195++
2196++ /* optimize_presets[1]: Text */
2197++ if (best_text_ch >= 0)
2198++ pc->num_optimize_presets[_PWG_PRINT_CONTENT_OPTIMIZE_TEXT] =
2199++ cupsAddOption
2200++ (o, option->choices[best_text_ch].choice,
2201++ pc->num_optimize_presets[_PWG_PRINT_CONTENT_OPTIMIZE_TEXT],
2202++ &(pc->optimize_presets[_PWG_PRINT_CONTENT_OPTIMIZE_TEXT]));
2203++
2204++ /* optimize_presets[1]: Text and Graphics */
2205++ if (best_tg_ch >= 0)
2206++ pc->num_optimize_presets
2207++ [_PWG_PRINT_CONTENT_OPTIMIZE_TEXT_AND_GRAPHICS] =
2208++ cupsAddOption
2209++ (o, option->choices[best_tg_ch].choice,
2210++ pc->num_optimize_presets
2211++ [_PWG_PRINT_CONTENT_OPTIMIZE_TEXT_AND_GRAPHICS],
2212++ &(pc->optimize_presets
2213++ [_PWG_PRINT_CONTENT_OPTIMIZE_TEXT_AND_GRAPHICS]));
2214++
2215++ }
2216++
2217++ for (k = 0; k < option->num_choices; k ++)
2218++ free(cupsArrayIndex(choice_properties, k));
2219++ cupsArrayDelete(choice_properties);
2220++ }
2221++ }
2222++}
2223++
2224++/*
2225+ * '_ppdCacheDestroy()' - Free all memory used for PWG mapping data.
2226+ */
2227+
2228+ void
2229+ _ppdCacheDestroy(_ppd_cache_t *pc) /* I - PPD cache and mapping data */
2230+ {
2231+- int i; /* Looping var */
2232++ int i, j; /* Looping vars */
2233+ pwg_map_t *map; /* Current map */
2234+ pwg_size_t *size; /* Current size */
2235+
2236+@@ -2159,6 +3190,15 @@
2237+
2238+ cupsArrayDelete(pc->strings);
2239+
2240++ for (i = _PWG_PRINT_COLOR_MODE_MONOCHROME; i < _PWG_PRINT_COLOR_MODE_MAX; i ++)
2241++ for (j = _PWG_PRINT_QUALITY_DRAFT; j < _PWG_PRINT_QUALITY_MAX; j ++)
2242++ if (pc->num_presets[i][j])
2243++ cupsFreeOptions(pc->num_presets[i][j], pc->presets[i][j]);
2244++
2245++ for (i = _PWG_PRINT_CONTENT_OPTIMIZE_AUTO; i < _PWG_PRINT_CONTENT_OPTIMIZE_MAX; i ++)
2246++ if (pc->num_optimize_presets[i])
2247++ cupsFreeOptions(pc->num_optimize_presets[i], pc->optimize_presets[i]);
2248++
2249+ free(pc);
2250+ }
2251+
2252+@@ -3047,6 +4087,21 @@
2253+ }
2254+
2255+ /*
2256++ * Optimization Presets...
2257++ */
2258++
2259++ for (i = _PWG_PRINT_CONTENT_OPTIMIZE_AUTO; i < _PWG_PRINT_CONTENT_OPTIMIZE_MAX; i ++)
2260++ if (pc->num_optimize_presets[i])
2261++ {
2262++ cupsFilePrintf(fp, "OptimizePreset %d", i);
2263++ for (k = pc->num_optimize_presets[i], option = pc->optimize_presets[i];
2264++ k > 0;
2265++ k --, option ++)
2266++ cupsFilePrintf(fp, " %s=%s", option->name, option->value);
2267++ cupsFilePutChar(fp, '\n');
2268++ }
2269++
2270++ /*
2271+ * Duplex/sides...
2272+ */
2273+
2274+--- a/cups/ppd-private.h
2275++++ b/cups/ppd-private.h
2276+@@ -36,7 +36,7 @@
2277+ * Constants...
2278+ */
2279+
2280+-# define _PPD_CACHE_VERSION 11 /* Version number in cache file */
2281++# define _PPD_CACHE_VERSION 12 /* Version number in cache file */
2282+
2283+
2284+ /*
2285+@@ -101,6 +101,16 @@
2286+ _PWG_PRINT_QUALITY_MAX
2287+ } _pwg_print_quality_t;
2288+
2289++typedef enum _pwg_print_content_optimize_e /** PWG print-content-optimize **/
2290++{
2291++ _PWG_PRINT_CONTENT_OPTIMIZE_AUTO = 0, /* print-content-optimize=auto */
2292++ _PWG_PRINT_CONTENT_OPTIMIZE_PHOTO, /* print-content-optimize=photo */
2293++ _PWG_PRINT_CONTENT_OPTIMIZE_GRAPHICS, /* print-content-optimize=graphics */
2294++ _PWG_PRINT_CONTENT_OPTIMIZE_TEXT, /* print-content-optimize=text */
2295++ _PWG_PRINT_CONTENT_OPTIMIZE_TEXT_AND_GRAPHICS, /* ...=text-and-graphics */
2296++ _PWG_PRINT_CONTENT_OPTIMIZE_MAX
2297++} _pwg_print_content_optimize_t;
2298++
2299+ typedef struct _pwg_finishings_s /**** PWG finishings mapping data ****/
2300+ {
2301+ ipp_finishings_t value; /* finishings value */
2302+@@ -131,6 +141,11 @@
2303+ /* Number of print-color-mode/print-quality options */
2304+ cups_option_t *presets[_PWG_PRINT_COLOR_MODE_MAX][_PWG_PRINT_QUALITY_MAX];
2305+ /* print-color-mode/print-quality options */
2306++ int num_optimize_presets[_PWG_PRINT_CONTENT_OPTIMIZE_MAX];
2307++ /* Number of print-content-optimize
2308++ options */
2309++ cups_option_t *optimize_presets[_PWG_PRINT_CONTENT_OPTIMIZE_MAX];
2310++ /* print-content-optimize options */
2311+ char *sides_option, /* PPD option for sides */
2312+ *sides_1sided, /* Choice for one-sided */
2313+ *sides_2sided_long, /* Choice for two-sided-long-edge */
2314+@@ -214,6 +229,8 @@
2315+ extern const char *_pwgPageSizeForMedia(pwg_media_t *media,
2316+ char *name, size_t namesize) _CUPS_PRIVATE;
2317+
2318++extern void _ppdCacheAssignPresets(ppd_file_t *ppd, _ppd_cache_t *pc) _CUPS_PRIVATE;
2319++
2320+
2321+ /*
2322+ * C++ magic...
2323+--- a/cups/string-private.h
2324++++ b/cups/string-private.h
2325+@@ -151,6 +151,8 @@
2326+
2327+ extern int _cups_strncasecmp(const char *, const char *, size_t n) _CUPS_PRIVATE;
2328+
2329++extern char *_cups_strcasestr(const char *, const char *) _CUPS_PRIVATE;
2330++
2331+ # ifndef HAVE_STRLCAT
2332+ extern size_t _cups_strlcat(char *, const char *, size_t) _CUPS_PRIVATE;
2333+ # define strlcat _cups_strlcat
2334+--- a/cups/string.c
2335++++ b/cups/string.c
2336+@@ -671,6 +671,36 @@
2337+ return (-1);
2338+ }
2339+
2340++/*
2341++ * '_cups_strcasestr()' - Do a case-insensitive search for a sub-string.
2342++ */
2343++
2344++char * /* O - Pointer to found sub-string or
2345++ NULL if not found */
2346++_cups_strcasestr(const char *haystack, /* I - String in which to searh */
2347++ const char *needle) /* I - Sub-string */
2348++{
2349++ char cn, /* Character in needle */
2350++ ch; /* Character in haystack */
2351++ size_t len; /* Length of needle */
2352++
2353++ if ((cn = *needle++) != 0)
2354++ {
2355++ cn = _cups_tolower(cn);
2356++ len = strlen(needle);
2357++ do
2358++ {
2359++ do
2360++ {
2361++ if ((ch = *haystack++) == 0)
2362++ return (NULL);
2363++ } while (_cups_tolower(ch) != cn);
2364++ } while (_cups_strncasecmp(haystack, needle, len) != 0);
2365++ haystack --;
2366++ }
2367++ return ((char *)haystack);
2368++}
2369++
2370+
2371+ #ifndef HAVE_STRLCAT
2372+ /*
2373+--- a/scheduler/job.c
2374++++ b/scheduler/job.c
2375+@@ -3669,9 +3669,13 @@
2376+ cups_option_t *pwgppds, /* PWG->PPD options */
2377+ *pwgppd, /* Current PWG->PPD option */
2378+ *preset; /* Current preset option */
2379+- int print_color_mode,
2380++ int print_color_mode = _PWG_PRINT_COLOR_MODE_COLOR,
2381+ /* Output mode (if any) */
2382+- print_quality; /* Print quality (if any) */
2383++ print_quality = _PWG_PRINT_QUALITY_NORMAL,
2384++ /* Print quality (if any) */
2385++ print_content_optimize =
2386++ _PWG_PRINT_CONTENT_OPTIMIZE_AUTO;
2387++ /* Print content type (if any)*/
2388+ const char *ppd; /* PPD option choice */
2389+ int exact; /* Did we get an exact match? */
2390+ static char *options = NULL;/* Full list of options */
2391+@@ -3693,7 +3697,7 @@
2392+ if (pc &&
2393+ !ippFindAttribute(job->attrs, "com.apple.print.DocumentTicket.PMSpoolFormat", IPP_TAG_ZERO) &&
2394+ !ippFindAttribute(job->attrs, "APPrinterPreset", IPP_TAG_ZERO) &&
2395+- (ippFindAttribute(job->attrs, "print-color-mode", IPP_TAG_ZERO) || ippFindAttribute(job->attrs, "print-quality", IPP_TAG_ZERO) || ippFindAttribute(job->attrs, "cupsPrintQuality", IPP_TAG_ZERO)))
2396++ (ippFindAttribute(job->attrs, "print-color-mode", IPP_TAG_ZERO) || ippFindAttribute(job->attrs, "print-quality", IPP_TAG_ZERO) || ippFindAttribute(job->attrs, "print-content-optimize", IPP_TAG_ZERO) || ippFindAttribute(job->attrs, "cupsPrintQuality", IPP_TAG_ZERO)))
2397+ {
2398+ /*
2399+ * Map print-color-mode and print-quality to a preset...
2400+@@ -3755,6 +3759,12 @@
2401+ }
2402+ }
2403+
2404++ cupsdLogJob(job, CUPSD_LOG_DEBUG,
2405++ "print-color-mode=%s, print-quality=%s",
2406++ print_color_mode == _PWG_PRINT_COLOR_MODE_MONOCHROME ?
2407++ "gray" : "color",
2408++ print_quality == _PWG_PRINT_QUALITY_DRAFT ? "draft" :
2409++ (print_quality == _PWG_PRINT_QUALITY_HIGH ? "high" : "normal"));
2410+ if (pc->num_presets[print_color_mode][print_quality] > 0)
2411+ {
2412+ /*
2413+@@ -3769,7 +3779,72 @@
2414+ {
2415+ if (!ippFindAttribute(job->attrs, preset->name, IPP_TAG_ZERO))
2416+ {
2417+- cupsdLogJob(job, CUPSD_LOG_DEBUG2, "Adding preset option %s=%s", preset->name, preset->value);
2418++ cupsdLogJob(job, CUPSD_LOG_DEBUG, "Adding preset option %s=%s", preset->name, preset->value);
2419++
2420++ num_pwgppds = cupsAddOption(preset->name, preset->value, num_pwgppds, &pwgppds);
2421++ }
2422++ }
2423++ }
2424++ }
2425++
2426++ if (pc &&
2427++ ippFindAttribute(job->attrs, "print-content-optimize", IPP_TAG_ZERO))
2428++ {
2429++ /*
2430++ * Map print-content-optimize to a preset...
2431++ */
2432++
2433++ if ((attr = ippFindAttribute(job->attrs, "print-content-optimize",
2434++ IPP_TAG_KEYWORD)) != NULL)
2435++ {
2436++ if (!strcmp(attr->values[0].string.text, "auto"))
2437++ print_content_optimize = _PWG_PRINT_CONTENT_OPTIMIZE_AUTO;
2438++ else if (!strcmp(attr->values[0].string.text, "photo"))
2439++ print_content_optimize = _PWG_PRINT_CONTENT_OPTIMIZE_PHOTO;
2440++ else if (!strcmp(attr->values[0].string.text, "graphics") ||
2441++ !strcmp(attr->values[0].string.text, "graphic"))
2442++ print_content_optimize = _PWG_PRINT_CONTENT_OPTIMIZE_GRAPHICS;
2443++ else if (!strcmp(attr->values[0].string.text, "text"))
2444++ print_content_optimize = _PWG_PRINT_CONTENT_OPTIMIZE_TEXT;
2445++ else if (!strcmp(attr->values[0].string.text, "text-and-graphics") ||
2446++ !strcmp(attr->values[0].string.text, "text-and-graphic"))
2447++ print_content_optimize = _PWG_PRINT_CONTENT_OPTIMIZE_TEXT_AND_GRAPHICS;
2448++ else
2449++ print_content_optimize = _PWG_PRINT_CONTENT_OPTIMIZE_AUTO;
2450++ }
2451++ else
2452++ print_content_optimize = _PWG_PRINT_CONTENT_OPTIMIZE_AUTO;
2453++
2454++ cupsdLogJob(job, CUPSD_LOG_DEBUG,
2455++ "print-content-optimize=%s",
2456++ (print_content_optimize == _PWG_PRINT_CONTENT_OPTIMIZE_AUTO ?
2457++ "automatic" :
2458++ (print_content_optimize == _PWG_PRINT_CONTENT_OPTIMIZE_PHOTO ?
2459++ "photo" :
2460++ (print_content_optimize == _PWG_PRINT_CONTENT_OPTIMIZE_GRAPHICS ?
2461++ "graphics" :
2462++ (print_content_optimize == _PWG_PRINT_CONTENT_OPTIMIZE_TEXT ?
2463++ "text" :
2464++ "text and graphics")))));
2465++ if (pc->num_optimize_presets[print_content_optimize] > 0)
2466++ {
2467++ /*
2468++ * Copy the preset options as long as the corresponding names are not
2469++ * already defined in the IPP request and also if it does not change
2470++ * the print quality preset (as long as we do not print in high quality)
2471++ * ...
2472++ */
2473++
2474++ for (i = pc->num_optimize_presets[print_content_optimize],
2475++ preset = pc->optimize_presets[print_content_optimize];
2476++ i > 0;
2477++ i --, preset ++)
2478++ {
2479++ if (!ippFindAttribute(job->attrs, preset->name, IPP_TAG_ZERO) &&
2480++ (print_quality == _PWG_PRINT_QUALITY_HIGH ||
2481++ cupsGetOption(preset->name, num_pwgppds, pwgppds) == NULL))
2482++ {
2483++ cupsdLogJob(job, CUPSD_LOG_DEBUG, "Adding content optimization preset option %s=%s", preset->name, preset->value);
2484+
2485+ num_pwgppds = cupsAddOption(preset->name, preset->value, num_pwgppds, &pwgppds);
2486+ }
2487diff --git a/debian/patches/series b/debian/patches/series
2488index 1e7b54a..ae5868f 100644
2489--- a/debian/patches/series
2490+++ b/debian/patches/series
2491@@ -9,5 +9,6 @@
2492 0014-Debian-Reproducibility-httpAddrGetHostname-test-fail.patch
2493 0015-Debian-Reproducibility-Do-not-run-stp-tests-as-root.patch
2494 0016-Debian-po4a-infrastructure-and-translations-for-manp.patch
2495+9100-ppd-cache-add-auto-presets.patch
2496 0012-add-pt.patch
2497 0013-let-WARNING-test-always-pass.patch
2498diff --git a/debian/rules b/debian/rules
2499index f751073..4e16f02 100755
2500--- a/debian/rules
2501+++ b/debian/rules
2502@@ -48,10 +48,11 @@ override_dh_auto_configure:
2503 dh_auto_configure -- \
2504 $(CUPS_CONFIGURE_DISTRO_OPTIONS) \
2505 --with-docdir=/usr/share/cups/doc-root \
2506+ --with-pkgconfpath=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \
2507 --localedir=/usr/share/cups/locale \
2508 --enable-libpaper \
2509 --enable-ssl \
2510- --enable-gnutls \
2511+ --with-tls=gnutls \
2512 --enable-threads \
2513 --enable-static \
2514 --enable-debug \
2515@@ -70,6 +71,7 @@ override_dh_auto_configure:
2516 --with-error-policy=retry-job \
2517 --enable-sync-on-close \
2518 --with-max-log-size=0 \
2519+ --enable-snapped-clients \
2520 $(CONFIG_LIBUSB)
2521
2522 override_dh_auto_install:
2523@@ -222,9 +224,6 @@ endif
2524 ifneq (,$(filter libcups2-dev,$(shell dh_listpackages)))
2525 # debian/libcups2-dev.install entry cannot rename files on-the-fly
2526 cp cups/language-private.h debian/libcups2-dev/usr/include/cups/i18n.h
2527- # debian/libcups2-dev.install cannot interpolate before compat 13
2528- sed -e 's/@DEB_VERSION_UPSTREAM@/${DEB_VERSION_UPSTREAM}/' < debian/cups.pc.in > debian/cups.pc
2529- install -D -m 644 debian/cups.pc debian/libcups2-dev/usr/lib/${DEB_HOST_GNU_TYPE}/pkgconfig/cups.pc
2530 endif
2531
2532 ifneq (,$(filter cups-daemon,$(shell dh_listpackages)))

Subscribers

People subscribed via source and target branches