From 60a7373f31976afa757bd7a1250b49b392f7189a Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Fri, 16 Aug 2019 15:41:00 -0400 Subject: [PATCH] Fix a USB printing issue on macOS (rdar://31433931) --- CHANGES.md | 3 ++- backend/usb-darwin.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ffd236f90..aea4a00cf 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 d6ad5875d..8f37e1bd6 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) -- 2.39.2