From: Michael R Sweet Date: Fri, 16 Aug 2019 19:41:00 +0000 (-0400) Subject: Fix a USB printing issue on macOS (rdar://31433931) X-Git-Tag: v2.3.0~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60a7373f31976afa757bd7a1250b49b392f7189a;p=thirdparty%2Fcups.git Fix a USB printing issue on macOS (rdar://31433931) --- diff --git a/CHANGES.md b/CHANGES.md index ffd236f90d..aea4a00cf6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -CHANGES - 2.3.0 - 2019-08-07 +CHANGES - 2.3.0 - 2019-08-16 ============================ @@ -29,6 +29,7 @@ Changes in CUPS v2.3.0 - Fixed some PPD parser issues (Issue #5623, Issue #5624) - The IPP parser no longer allows invalid member attributes in collections (Issue #5630) +- Fixed a USB printing issue on macOS (rdar://31433931) - Fixed IPP buffer overflow (rdar://50035411) - Fixed memory disclosure issue in the scheduler (rdar://51373853) - Fixed DoS issues in the scheduler (rdar://51373929) diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c index d6ad5875d6..8f37e1bd66 100644 --- a/backend/usb-darwin.c +++ b/backend/usb-darwin.c @@ -1279,6 +1279,9 @@ static Boolean find_device_cb(io_service_t obj, printer_interface_t printerIntf, (*printerIntf)->GetAlternateSetting(printerIntf, &intfAltSetting); (*printerIntf)->GetInterfaceNumber(printerIntf, &intfNumber); (*printerIntf)->GetLocationID(printerIntf, &intfLocation); + + if (intfProtocol == kUSBPrintingProtocolIPP) + return keepLooking; if (g.serial != NULL && CFStringGetLength(g.serial) > 0) { @@ -1287,12 +1290,9 @@ static Boolean find_device_cb(io_service_t obj, printer_interface_t printerIntf, g.interfaceProtocol = intfProtocol; g.location = intfLocation; g.alternateSetting = intfAltSetting; - if (intfProtocol != kUSBPrintingProtocolIPP) - { - g.printer_obj = obj; - IOObjectRetain(obj); - } - keepLooking = (intfProtocol == kUSBPrintingProtocolIPP); + g.printer_obj = obj; + IOObjectRetain(obj); + keepLooking = false; } } else @@ -1300,14 +1300,14 @@ static Boolean find_device_cb(io_service_t obj, printer_interface_t printerIntf, if (g.printer_obj != 0) IOObjectRelease(g.printer_obj); + if (g.location == 0 || g.location == intfLocation) + keepLooking = false; + g.location = intfLocation; g.alternateSetting = intfAltSetting; g.interfaceProtocol = intfProtocol; g.printer_obj = obj; IOObjectRetain(obj); - - if (g.location == 0 || g.location == intfLocation) - keepLooking = false; } if (!keepLooking)