Skip to content

Commit

Permalink
Import all of the bug fixes from the OpenPrinting CUPS repository.
Browse files Browse the repository at this point in the history
Import the improvements to ippeveprinter from OpenPrinting/ippsample.

Import the improvements to ippfind and ipptool from OpenPrinting/ippsample.
  • Loading branch information
michaelrsweet committed Apr 5, 2021
1 parent 6918883 commit 064e50f
Show file tree
Hide file tree
Showing 65 changed files with 5,201 additions and 1,196 deletions.
79 changes: 76 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,82 @@
CHANGES - 2.3.4 - 2020-04-24 (IN PROGRESS)
============================
Change History
==============


Changes in CUPS v2.3.5
----------------------

- The automated test suite can now be activated using `make test` for
consistency with other projects and CI environments - the old `make check`
continues to work as well, and the previous test server behavior can be
accessed by running `make testserver`.
- ippeveprinter now supports multiple icons and strings files.
- ippeveprinter now uses the system's FQDN with Avahi.
- ippeveprinter now supports Get-Printer-Attributes on "/".
- ippeveprinter now uses a deterministic "printer-uuid" value.
- ippeveprinter now uses system sounds on macOS for Identify-Printer.
- Updated ippfind to look for files in "~/Desktop" on Windows.
- Updated ippfind to honor `SKIP-XXX` directives with `PAUSE`.
- Updated IPP Everywhere support to work around printers that only advertise
color raster support but really also support grayscale (OpenPrinting #1)
- ipptool now supports DNS-SD URIs like `ipps://My%20Printer._ipps._tcp.local`
(OpenPrinting #5)
- ipptool now supports monitoring the printer state while submitting a job
with the `MONITOR-PRINTER-STATE` directive (OpenPrinting #153)
- ipptool now supports testing for unique values with the `WITH-DISTINCT-VALUES`
predicate (OpenPrinting #153)
- ipptool now supports retrying requests on a `server-error-busy` status code
(OpenPrinting #153)
- ipptool now supports `value-tag(MAX)` and `value-tag(MIN:MAX)` for the
`OF-TYPE` predicate (OpenPrinting #153)
- The scheduler now allows root backends to have world read permissions but not
world execute permissions (OpenPrinting #21)
- Failures to bind IPv6 listener sockets no longer cause errors if IPv6 is
disabled on the host (OpenPrinting #25)
- The SNMP backend now supports the HP and Ricoh vendor MIBs (OpenPrinting #28)
- The scheduler no longer includes a timestamp in files it writes (OpenPrinting #29)
- IPP Everywhere PPDs could have an "unknown" default InputSlot (OpenPrinting #44)
- The `httpAddrListen` function now uses a listen backlog of 128.
- The PPD functions now treat boolean values as case-insensitive (OpenPrinting #106)
- Temporary queue names no longer end with an underscore (OpenPrinting #110)
- Added USB quirks (Issue #5789, #5766, #5823, #5831, #5838, #5843, #5867)
- Fixed IPP Everywhere v1.1 conformance issues in ippeveprinter.
- Fixed DNS-SD name collision support in ippeveprinter.
- Fixed compiler and code analyzer warnings.
- Fixed TLS support on Windows.
- Fixed ippfind sub-type searches with Avahi.
- Fixed the default hostname used by ippeveprinter on macOS.
- Fixed resolution of local IPP-USB printers with Avahi.
- Fixed coverity issues (OpenPrinting #2)
- Fixed `httpAddrConnect` issues (OpenPrinting #3)
- Fixed web interface device URI issue (OpenPrinting #4)
- Fixed lp/lpr "printer/class not found" error reporting (OpenPrinting #6)
- Fixed a memory leak in the scheduler (OpenPrinting #12)
- Fixed a potential integer overflow in the PPD hashing code (OpenPrinting #13)
- Fixed output-bin and print-quality handling issues (OpenPrinting #18)
- Fixed PPD options getting mapped to odd IPP values like "tray---4" (OpenPrinting #23)
- Fixed remote access to the cupsd.conf and log files (OpenPrinting #24)
- Fixed a logging regression caused by a previous change for Issue #5604
(OpenPrinting #25)
- Fixed the "uri-security-supported" value from the scheduler (OpenPrinting #42)
- Fixed IPP backend crash bug with "printer-alert" values (OpenPrinting #43)
- Fixed default options that incorrectly use the "custom" prefix (OpenPrinting #48)
- Fixed a memory leak when resolving DNS-SD URIs (OpenPrinting #49)
- Fixed cupsManualCopies values in IPP Everywhere PPDs (Issue #5807)
- Fixed duplicate ColorModel entries for AirPrint printers (Issue 59)
- Fixed crash bug in `ppdOpen` (OpenPrinting #64, OpenPrinting #78)
- Fixed regression in `snprintf` emulation function (OpenPrinting #67)
- Fixed segfault in help.cgi when searching in man pages (OpenPrinting #81)
- Fixed a bug in ipptool that caused the reuse of request IDs when repeating a
test (OpenPrinting #153)
- Root certificates were incorrectly stored in "~/.cups/ssl".
- Fixed a PPD memory leak caused by emulator definitions (OpenPrinting #124)


Changes in CUPS v2.3.4
----------------------

- CVE-20XX-YYYY: TODO rdar://61415567 embargo
- CVE-2020-10001: Fixed a buffer (read) overflow in the `ippReadIO` function.


Changes in CUPS v2.3.3
----------------------
Expand All @@ -16,6 +88,7 @@ Changes in CUPS v2.3.3
field.
- Fixed WARNING_OPTIONS support for GCC 9.x


Changes in CUPS v2.3.2
----------------------

Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Top-level Makefile for CUPS.
#
# Copyright © 2007-2019 by Apple Inc.
# Copyright © 2007-2021 by Apple Inc.
# Copyright © 1997-2007 by Easy Software Products, all rights reserved.
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more
Expand Down Expand Up @@ -230,16 +230,16 @@ uninstall:
# Run the test suite...
#

test: all unittests
echo Running CUPS test suite...
testserver: all unittests
echo Running CUPS test server...
cd test; ./run-stp-tests.sh $(TESTOPTIONS)


check: all unittests
check test: all unittests
echo Running CUPS test suite with defaults...
cd test; ./run-stp-tests.sh 1 0 n n

debugcheck: all unittests
debugcheck debugtest: all unittests
echo Running CUPS test suite with debug printfs...
cd test; ./run-stp-tests.sh 1 0 n y

Expand Down
64 changes: 47 additions & 17 deletions backend/ipp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2240,7 +2240,8 @@ main(int argc, /* I - Number of command-line args */
else if (ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_AUTHORIZATION_FAILED)
fputs("JOBSTATE: account-authorization-failed\n", stderr);

if (job_canceled)
// job_canceled can be -1 which should not be treated as CUPS_BACKEND_OK
if (job_canceled > 0)
return (CUPS_BACKEND_OK);
else if (ipp_status == IPP_STATUS_ERROR_NOT_AUTHORIZED || ipp_status == IPP_STATUS_ERROR_FORBIDDEN || ipp_status == IPP_STATUS_ERROR_CUPS_AUTHENTICATION_CANCELED)
return (CUPS_BACKEND_AUTH_REQUIRED);
Expand Down Expand Up @@ -2825,7 +2826,21 @@ new_request(
*/

_httpDecodeURI(phone, keyword, sizeof(phone));
for (ptr = phone; *ptr;)
ptr = phone;

/*
* Weed out "Custom." in the beginning, this allows to put the
* "phone" option as custom string option into the PPD so that
* print dialogs not supporting fax display the option and
* allow entering the phone number. Print dialogs also send "None"
* if no phone number got entered, filter this, too.
*/
if (!_cups_strcasecmp(phone, "None"))
*ptr = '\0';
if (!_cups_strncasecmp(phone, "Custom.", 7))
_cups_strcpy(ptr, ptr + 7);

for (; *ptr;)
{
if (*ptr == ',')
*ptr = 'p';
Expand All @@ -2835,20 +2850,36 @@ new_request(
ptr ++;
}

httpAssembleURI(HTTP_URI_CODING_ALL, tel_uri, sizeof(tel_uri), "tel", NULL, NULL, 0, phone);
ippAddString(destination, IPP_TAG_JOB, IPP_TAG_URI, "destination-uri", NULL, tel_uri);

if ((keyword = cupsGetOption("faxPrefix", num_options,
options)) != NULL && *keyword)
if (strlen(phone) > 0)
{
char predial[1024]; /* Pre-dial string */
httpAssembleURI(HTTP_URI_CODING_ALL, tel_uri, sizeof(tel_uri), "tel", NULL, NULL, 0, phone);
ippAddString(destination, IPP_TAG_JOB, IPP_TAG_URI, "destination-uri", NULL, tel_uri);
fprintf(stderr, "DEBUG: Faxing to phone %s; destination-uri: %s\n", phone, tel_uri);

_httpDecodeURI(predial, keyword, sizeof(predial));
ippAddString(destination, IPP_TAG_JOB, IPP_TAG_TEXT, "pre-dial-string", NULL, predial);
}
if ((keyword = cupsGetOption("faxPrefix", num_options, options)) != NULL && *keyword)
{
char predial[1024]; /* Pre-dial string */

_httpDecodeURI(predial, keyword, sizeof(predial));
ptr = predial;
if (!_cups_strcasecmp(ptr, "None"))
*ptr = '\0';
if (!_cups_strncasecmp(ptr, "Custom.", 7))
ptr += 7;
if (strlen(ptr) > 0)
{
ippAddString(destination, IPP_TAG_JOB, IPP_TAG_TEXT, "pre-dial-string", NULL, ptr);
fprintf(stderr, "DEBUG: Pre-dialing %s; pre-dial-string: %s\n", ptr, ptr);
}
else
fprintf(stderr, "WARNING: Pre-dial number for fax not valid! Sending fax without pre-dial number.\n");
}

ippAddCollection(request, IPP_TAG_JOB, "destination-uris", destination);
ippDelete(destination);
ippAddCollection(request, IPP_TAG_JOB, "destination-uris", destination);
ippDelete(destination);
}
else
fprintf(stderr, "ERROR: Phone number for fax not valid! Fax cannot be sent.\n");
}
}
else
Expand Down Expand Up @@ -3075,7 +3106,7 @@ report_printer_state(ipp_t *ipp) /* I - IPP response */
* Report alerts and messages...
*/

if ((pa = ippFindAttribute(ipp, "printer-alert", IPP_TAG_TEXT)) != NULL)
if ((pa = ippFindAttribute(ipp, "printer-alert", IPP_TAG_STRING)) != NULL)
report_attr(pa);

if ((pam = ippFindAttribute(ipp, "printer-alert-message",
Expand Down Expand Up @@ -3116,11 +3147,10 @@ report_printer_state(ipp_t *ipp) /* I - IPP response */
if (*ptr < ' ' && *ptr > 0 && *ptr != '\t')
{
/*
* Substitute "<XX>" for the control character; sprintf is safe because
* we always leave 6 chars free at the end...
* Substitute "<XX>" for the control character...
*/

sprintf(valptr, "<%02X>", *ptr);
snprintf(valptr, sizeof(value) - (size_t)(valptr - value), "<%02X>", *ptr);
valptr += 4;
}
else
Expand Down
2 changes: 1 addition & 1 deletion backend/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ backendNetworkSideCB(
i < packet.object_value.string.num_bytes &&
dataptr < (data + sizeof(data) - 3);
i ++, dataptr += 2)
sprintf(dataptr, "%02X", packet.object_value.string.bytes[i]);
snprintf(dataptr, sizeof(data) - (size_t)(dataptr - data), "%02X", packet.object_value.string.bytes[i]);
datalen += (int)strlen(dataptr);
break;

Expand Down
69 changes: 42 additions & 27 deletions backend/org.cups.usb-quirks
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
# Canon, Inc. PIXMA iP6000D Printer (https://bugs.launchpad.net/bugs/1160638)
0x04a9 0x1095 unidir

# Canon, Inc. PIXMA iP4200 Printer (Issue #4155)
# Canon, Inc. PIXMA iP4200 Printer (Apple #4155)
0x04a9 0x10a2 unidir

# Canon, Inc. PIXMA iP4300 Printer (https://bugs.launchpad.net/bugs/1032385)
Expand All @@ -86,12 +86,15 @@
# Canon, Inc. MP540 Printer, https://bugzilla.redhat.com/967873
0x04a9 0x1730 unidir

# Canon, Inc. MP550 Printer (Issue #4155)
# Canon, Inc. MP550 Printer (Apple #4155)
0x04a9 0x173d unidir

# Canon, Inc. MP560 Printer (Issue #4155)
# Canon, Inc. MP560 Printer (Apple #4155)
0x04a9 0x173e unidir

# Canon, Inc. PIXMA G1501 Printer (Apple #5831)
0x04a9 0x1796 unidir

# Canon, Inc. MF4150 Printer (https://bugs.launchpad.net/bugs/1160638)
0x04a9 0x26a3 no-reattach

Expand Down Expand Up @@ -140,7 +143,7 @@
# Samsung ML-2160 Series (https://bugzilla.redhat.com/show_bug.cgi?id=873123)
0x04e8 0x330f unidir

# All Zebra devices (https://bugs.launchpad.net/bugs/1001028) (Issue #5395)
# All Zebra devices (https://bugs.launchpad.net/bugs/1001028) (Apple #5395)
0x0a5f unidir no-reattach

# Canon CP-10
Expand Down Expand Up @@ -230,75 +233,87 @@
# Lexmark E238 (<rdar://problem/14493054>)
0x043d 0x00d7 no-reattach

# Lexmark E238 (Issue #4448)
# Lexmark E238 (Apple #4448)
0x043d 0x009a no-reattach

# Canon MX310 (Issue #4482)
# Canon MX310 (Apple #4482)
0x04a9 0x1728 unidir

# Canon MX320 (Issue #4482)
# Canon MX320 (Apple #4482)
0x04A9 0x1736 unidir

# All Intermec devices (Issue #4553)
# All Intermec devices (Apple #4553)
0x067e no-reattach

# HP LaserJet 1015 (Issue #5617)
# HP LaserJet 1010 (Apple #5789)
0x03f0 0x0c17 delay-close

# HP LaserJet 1015 (Apple #5617)
0x03f0 0x0e17 delay-close

# HP LaserJet 1150 (Issue #4549)
# HP LaserJet 1150 (Apple #4549)
0x03f0 0x0f17 delay-close

# HP LaserJet 1300 (Issue #4549)
# HP LaserJet 1300 (Apple #4549)
0x03f0 0x1017 delay-close
0x03f0 0x1117 delay-close

# HP LaserJet 1320 (Issue #4549)
# HP LaserJet 1320 (Apple #4549)
0x03f0 0x1d17 delay-close

# Canon, Inc. MP530 Printer
0x04a9 0x1712 unidir

# Xerox WorkCentre 3220 (https://bugs.launchpad.net/bugs/1406203, Issue #4789)
# Xerox WorkCentre 3220 (https://bugs.launchpad.net/bugs/1406203, Apple #4789)
0x0924 0x4294 no-reattach

# Lexmark C540n (Issue #4778)
# Lexmark C540n (Apple #4778)
0x043d 0x0139 no-reattach

# Kyocera Ecosys P6026cdn (Issue #4900)
# Kyocera Ecosys P6026cdn (Apple #4900)
0x0482 0x063f no-reattach

# Kyocera Ecosys P6130cdn (Issue #5102)
# Kyocera Ecosys P6130cdn (Apple #5102)
0x0482 0x0677 no-reattach

# Lexmark E260dn (Issue #4994)
# Lexmark E260dn (Apple #4994)
0x043d 0x0123 no-reattach

# HP LaserJet 1160 (Issue #5121)
# HP LaserJet 1160 (Apple #5121)
0x03f0 0x1e17 delay-close

# Canon, Inc. MP280 series (Issue #5221)
# Canon, Inc. MP280 series (Apple #5221)
0x04a9 0x1746 unidir

# Star Micronics printers (Issue #5251)
# Star Micronics printers (Apple #5251)
0x0519 unidir

# Lexmark Optra E310 (Issue #5259)
# Lexmark Optra E310 (Apple #5259)
0x043d 0x000c no-reattach

# HP LaserJet P1102 (Issue #5310)
# HP LaserJet P1102 (Apple #5310)
0x03F0 0x002A no-reattach

# Lexmark MS317dn
0x043d 0x0226 no-reattach

# Star TSP743 (Issue #5443)
# Star TSP743 (Apple #5443)
0x0519 0x0001 delay-close

# Lexmark E120n (Issue #5478)
# Lexmark E120n (Apple #5478)
0x043d 0x00cc no-reattach

# All Xerox printers (Issue #5523)
# Lexmark E120n MT4506-100 (Apple #5766)
0x043d 0x00cd no-reattach

# All Xerox printers (Apple #5523)
0x0924 no-reattach

# Dymo 450 Turbo (Issue #5521)
0x0922 0x0021 unidir
# Citizen CT-S4000 (Apple #5823)
0x2730 0x2008 unidir delay-close

# All Arkscan label printers (Apple #5867)
0x2d84 unidir no-reattach

# HP DesignJet 130 (Apple #5838)
0x03f0 0x0314 no-reattach
Loading

0 comments on commit 064e50f

Please sign in to comment.