Skip to content

Commit

Permalink
Import CUPS v2.1rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Sweet committed Mar 15, 2016
1 parent c8d724e commit be91b84
Show file tree
Hide file tree
Showing 53 changed files with 1,455 additions and 952 deletions.
14 changes: 14 additions & 0 deletions CHANGES-2.0.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
CHANGES-2.0.txt
---------------

CHANGES IN CUPS V2.0.4

- Fixed a bug in cupsRasterWritePixels (STR #4650)
- Fixed redirection in the web interface (STR #4538)
- The IPP backend did not respond to side-channel requests (STR #4645)
- The scheduler did not start all pending jobs at once (STR #4646)
- The web search incorrectly searched time-at-xxx values (STR #4652)
- Fixed an RPM spec file issue (STR #4657)
- The scheduler incorrectly started jobs while canceling multiple jobs
(STR #4648)
- Fixed processing of server overrides without port numbers (STR #4675)
- Documentation changes (STR #4651, STR #4674)


CHANGES IN CUPS V2.0.3

- Security: Fixed CERT VU #810572 exploiting the dynamic linker
Expand Down
18 changes: 16 additions & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
CHANGES.txt - 2.1b1 - 2015-06-03
--------------------------------
CHANGES.txt - 2.1rc1 - 2015-07-31
---------------------------------

CHANGES IN CUPS V2.1rc1

- Added support for 3D printers (basic types only, no built-in filters)
based on PWG white paper.
- Fixed bugs in the new journald support (STR #4655, STR #4658,
STR #4661)
- Fixed domain socket support on Linux (STR #4679)
- Fixed signal handlers in the dnssd and usb backends (STR #4671)
- <Limit All> in <Policy> sections now applies to all operations when
used by itself (STR #4659)
- Configure script changes for systemd support (STR #4669)
- Updated autoconf sources to use newer form of AC_INIT (STR #4664)


CHANGES IN CUPS V2.1b1

Expand Down
4 changes: 2 additions & 2 deletions INSTALL.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
INSTALL - CUPS v2.1b1 - 2015-06-08
----------------------------------
INSTALL - CUPS v2.1rc1 - 2015-07-31
-----------------------------------

This file describes how to compile and install CUPS from source code. For more
information on CUPS see the file called "README.txt". A complete change log can
Expand Down
4 changes: 2 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
README - CUPS v2.1b1 - 2015-06-08
---------------------------------
README - CUPS v2.1rc1 - 2015-07-31
----------------------------------

Looking for compile instructions? Read the file "INSTALL.txt" instead...

Expand Down
6 changes: 3 additions & 3 deletions backend/dnssd.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* "$Id: dnssd.c 12659 2015-05-22 19:06:41Z msweet $"
* "$Id: dnssd.c 12818 2015-07-31 13:29:25Z msweet $"
*
* DNS-SD discovery backend for CUPS.
*
Expand Down Expand Up @@ -1289,7 +1289,7 @@ sigterm_handler(int sig) /* I - Signal number (unused) */
(void)sig;

if (job_canceled)
exit(CUPS_BACKEND_OK);
_exit(CUPS_BACKEND_OK);
else
job_canceled = 1;
}
Expand Down Expand Up @@ -1330,5 +1330,5 @@ unquote(char *dst, /* I - Destination buffer */


/*
* End of "$Id: dnssd.c 12659 2015-05-22 19:06:41Z msweet $".
* End of "$Id: dnssd.c 12818 2015-07-31 13:29:25Z msweet $".
*/
5 changes: 3 additions & 2 deletions backend/ipp.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* "$Id: ipp.c 12676 2015-05-28 01:19:14Z msweet $"
* "$Id: ipp.c 12757 2015-06-24 19:55:31Z msweet $"
*
* IPP backend for CUPS.
*
Expand Down Expand Up @@ -1571,6 +1571,7 @@ main(int argc, /* I - Number of command-line args */
FD_ZERO(&input);
FD_SET(fd, &input);
FD_SET(snmp_fd, &input);
FD_SET(CUPS_SC_FD, &input);

while (select(fd > snmp_fd ? fd + 1 : snmp_fd + 1, &input, NULL, NULL,
NULL) <= 0 && !job_canceled);
Expand Down Expand Up @@ -3483,5 +3484,5 @@ update_reasons(ipp_attribute_t *attr, /* I - printer-state-reasons or NULL */
}

/*
* End of "$Id: ipp.c 12676 2015-05-28 01:19:14Z msweet $".
* End of "$Id: ipp.c 12757 2015-06-24 19:55:31Z msweet $".
*/
93 changes: 58 additions & 35 deletions backend/usb-darwin.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* "$Id: usb-darwin.c 12672 2015-05-28 00:10:27Z msweet $"
* "$Id: usb-darwin.c 12818 2015-07-31 13:29:25Z msweet $"
*
* Copyright 2005-2014 Apple Inc. All rights reserved.
* Copyright 2005-2015 Apple Inc. All rights reserved.
*
* IMPORTANT: This Apple software is supplied to you by Apple Computer,
* Inc. ("Apple") in consideration of your agreement to the following
Expand Down Expand Up @@ -95,7 +95,7 @@ extern char **environ;
#define WAIT_SIDE_DELAY 3
#define DEFAULT_TIMEOUT 5000L

#define USB_INTERFACE_KIND CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID190)
#define USB_INTERFACE_KIND CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID245)
#define kUSBLanguageEnglish 0x409

#define PRINTER_POLLING_INTERVAL 5 /* seconds */
Expand Down Expand Up @@ -140,7 +140,7 @@ struct crashreporter_annotations_t gCRAnnotations
#define kUSBPrintingProtocolBidirectional 2
#define kUSBPrintingProtocolIPP 4

typedef IOUSBInterfaceInterface190 **printer_interface_t;
typedef IOUSBInterfaceInterface245 **printer_interface_t;

typedef struct iodevice_request_s /**** Device request ****/
{
Expand Down Expand Up @@ -241,6 +241,7 @@ typedef struct globals_s
ssize_t debug_bytes; /* Current bytes to read */
#endif /* DEBUG_WRITES */

Boolean use_generic_class_driver;
Boolean wait_eof;
int drain_output; /* Drain all pending output */
int bidi_flag; /* 0=unidirectional, 1=bidirectional */
Expand Down Expand Up @@ -300,10 +301,10 @@ static const char *next_line (const char *buffer);
static void parse_pserror (char *sockBuffer, int len);
#endif /* PARSE_PS_ERRORS */

static IOUSBInterfaceInterface220 **usb_interface220_for_service(io_service_t usbClass);
static printer_interface_t usb_printer_interface_interface(io_service_t usbClass);
static IOUSBDeviceInterface **usb_device_interface_for_device(io_service_t usbDevice);
static CFStringRef copy_printer_interface_deviceid(IOUSBInterfaceInterface220 **printer, UInt8 alternateSetting);
static CFStringRef copy_printer_interface_indexed_description(IOUSBInterfaceInterface220 ** printer, UInt8 index, UInt16 language);
static CFStringRef copy_printer_interface_deviceid(printer_interface_t printer, UInt8 alternateSetting);
static CFStringRef copy_printer_interface_indexed_description(printer_interface_t printer, UInt8 index, UInt16 language);
static CFStringRef deviceIDCopyManufacturer(CFStringRef deviceID);
static CFStringRef deviceIDCopyModel(CFStringRef deviceID);
static CFStringRef deviceIDCopySerialNumber(CFStringRef deviceID);
Expand Down Expand Up @@ -957,6 +958,27 @@ static void *read_thread(void *reference)

} while (g.wait_eof || !g.read_thread_stop); /* Abort from main thread tests error here */

/* Workaround for usb race condition. <rdar://problem/21882551> */
if (!g.wait_eof && g.use_generic_class_driver)
{
const char *pdl = getenv("FINAL_CONTENT_TYPE");
if (pdl && strcmp(pdl, "application/vnd.cups-postscript") == 0)
{
while (readstatus == kIOReturnSuccess && ((rbytes > 0 && readbuffer[rbytes-1] != 0x4) || rbytes == 0))
{
start = mach_absolute_time();

rbytes = sizeof(readbuffer);
readstatus = (*g.classdriver)->ReadPipe(g.classdriver, readbuffer, &rbytes);
if (readstatus == kIOReturnSuccess && rbytes > 0 && readbuffer[rbytes-1] == 0x4)
break;

/* Make sure this loop executes no more than once every 250 miliseconds... */
mach_wait_until(start + delay);
}
}
}

/*
* Let the main thread know that we have completed the read thread...
*/
Expand Down Expand Up @@ -1163,19 +1185,19 @@ static void device_added(void *userdata, io_iterator_t iterator)

while (reference->keepRunning && (intf = IOIteratorNext(intfIterator)))
{
IOUSBInterfaceInterface220 **intf220 = usb_interface220_for_service(intf);
if (intf220 != NULL)
printer_interface_t printerIntf = usb_printer_interface_interface(intf);
if (printerIntf != NULL)
{
UInt8 intfClass = 0, intfSubclass = 0, intfProtocol = 0, intfNumber = 0;

(*intf220)->GetInterfaceClass(intf220, &intfClass);
(*intf220)->GetInterfaceSubClass(intf220, &intfSubclass);
(*intf220)->GetInterfaceProtocol(intf220, &intfProtocol);
(*intf220)->GetInterfaceNumber(intf220, &intfNumber);
(*printerIntf)->GetInterfaceClass(printerIntf, &intfClass);
(*printerIntf)->GetInterfaceSubClass(printerIntf, &intfSubclass);
(*printerIntf)->GetInterfaceProtocol(printerIntf, &intfProtocol);
(*printerIntf)->GetInterfaceNumber(printerIntf, &intfNumber);

if (IsPrintingInterface(intfClass, intfSubclass, intfProtocol))
{
CFStringRef deviceIDString = copy_printer_interface_deviceid(intf220, 0);
CFStringRef deviceIDString = copy_printer_interface_deviceid(printerIntf, 0);
if (deviceIDString != NULL)
{
reference->keepRunning = reference->callback(userdata, intf, deviceIDString, locationID, intfNumber, 0);
Expand All @@ -1184,23 +1206,23 @@ static void device_added(void *userdata, io_iterator_t iterator)
}

IOUSBInterfaceDescriptor *intfDesc = NULL;
while (reference->keepRunning && (intfDesc = (IOUSBInterfaceDescriptor *)(*intf220)->FindNextAssociatedDescriptor(intf220, intfDesc, kUSBInterfaceDesc)))
while (reference->keepRunning && (intfDesc = (IOUSBInterfaceDescriptor *)(*printerIntf)->FindNextAssociatedDescriptor(printerIntf, intfDesc, kUSBInterfaceDesc)))
{
intfClass = intfDesc->bInterfaceClass;
intfSubclass = intfDesc->bInterfaceSubClass;
intfProtocol = intfDesc->bInterfaceProtocol;

if ((IsPrintingInterface(intfClass, intfSubclass, intfProtocol)))
{
CFStringRef deviceIDString = copy_printer_interface_deviceid(intf220, intfDesc->bAlternateSetting);
CFStringRef deviceIDString = copy_printer_interface_deviceid(printerIntf, intfDesc->bAlternateSetting);
if (deviceIDString != NULL)
{
reference->keepRunning = reference->callback(userdata, intf, deviceIDString, locationID, intfNumber, intfDesc->bAlternateSetting);
CFRelease(deviceIDString);
}
}
}
(*intf220)->Release(intf220);
(*printerIntf)->Release(printerIntf);
}
IOObjectRelease(intf);
}
Expand Down Expand Up @@ -1262,7 +1284,7 @@ static Boolean list_device_cb(void *refcon, io_service_t obj, CFStringRef device

cupsBackendReport("direct", uristr, make_modelstr, make_modelstr, idstr,
NULL);

if (make != NULL) CFRelease(make);
if (model != NULL) CFRelease(model);
if (serial != NULL) CFRelease(serial);
Expand Down Expand Up @@ -1519,6 +1541,7 @@ static kern_return_t load_printerdriver(CFStringRef *driverBundlePath)
{
*driverBundlePath = IORegistryEntryCreateCFProperty(g.printer_obj, kUSBClassDriverProperty, NULL, kNilOptions);

g.use_generic_class_driver = (*driverBundlePath == NULL || (CFStringCompare(*driverBundlePath, kUSBGenericTOPrinterClassDriver, 0x0) == kCFCompareEqualTo));
kr = load_classdriver(*driverBundlePath, interface, &g.classdriver);

if (kr != kIOReturnSuccess)
Expand All @@ -1529,15 +1552,15 @@ static kern_return_t load_printerdriver(CFStringRef *driverBundlePath)
return kr;
}

static IOUSBInterfaceInterface220 **usb_interface220_for_service(io_service_t usbClass)
static printer_interface_t usb_printer_interface_interface(io_service_t usbClass)
{
IOUSBInterfaceInterface220 ** intf = NULL;
printer_interface_t intf = NULL;
IOCFPlugInInterface **plugin = NULL;
SInt32 score;
int kr = IOCreatePlugInInterfaceForService(usbClass, kIOUSBInterfaceUserClientTypeID, kIOCFPlugInInterfaceID, &plugin, &score);
if (kr == kIOReturnSuccess)
{
(*plugin)->QueryInterface(plugin, CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID220), (LPVOID *)&intf);
(*plugin)->QueryInterface(plugin, USB_INTERFACE_KIND, (LPVOID *)&intf);
IODestroyPlugInInterface(plugin);
}

Expand All @@ -1561,7 +1584,7 @@ static IOUSBDeviceInterface **usb_device_interface_for_device(io_service_t usbDe
}


static CFStringRef copy_printer_interface_deviceid(IOUSBInterfaceInterface220 **printer, UInt8 alternateSetting)
static CFStringRef copy_printer_interface_deviceid(printer_interface_t printer, UInt8 alternateSetting)
{
// I have tried to make this function as neat as I can, but the possibility of needing to resend
// a request to get the entire string makes it hideous...
Expand Down Expand Up @@ -1722,10 +1745,10 @@ static CFStringRef copy_printer_interface_deviceid(IOUSBInterfaceInterface220 **

if (manufacturer != NULL)
CFRelease(manufacturer);

if (model != NULL)
CFRelease(model);

if (serial != NULL)
CFRelease(serial);

Expand All @@ -1734,11 +1757,11 @@ static CFStringRef copy_printer_interface_deviceid(IOUSBInterfaceInterface220 **
CFRelease(ret);
return NULL;
}

return ret;
}

static CFStringRef copy_printer_interface_indexed_description(IOUSBInterfaceInterface220 ** printer, UInt8 index, UInt16 language)
static CFStringRef copy_printer_interface_indexed_description(printer_interface_t printer, UInt8 index, UInt16 language)
{
IOReturn err;
UInt8 description[256]; // Max possible descriptor length
Expand Down Expand Up @@ -2262,13 +2285,13 @@ sigterm_handler(int sig) /* I - Signal */
while (waitpid(child_pid, &status, 0) < 0 && errno == EINTR);

if (WIFEXITED(status))
exit(WEXITSTATUS(status));
_exit(WEXITSTATUS(status));
else if (status == SIGTERM || status == SIGKILL)
exit(0);
_exit(0);
else
{
fprintf(stderr, "DEBUG: Child crashed on signal %d\n", status);
exit(CUPS_BACKEND_STOP);
write(2, "DEBUG: Child crashed.\n", 22);
_exit(CUPS_BACKEND_STOP);
}
}
#endif /* __i386__ || __x86_64__ */
Expand Down Expand Up @@ -2460,11 +2483,11 @@ static void get_device_id(cups_sc_status_t *status,

if (g.printer_obj != IO_OBJECT_NULL)
{
IOUSBInterfaceInterface220 **intf220 = usb_interface220_for_service(g.printer_obj);
if (intf220)
printer_interface_t printerIntf = usb_printer_interface_interface(g.printer_obj);
if (printerIntf)
{
deviceIDString = copy_printer_interface_deviceid(intf220, g.alternateSetting);
(*intf220)->Release(intf220);
deviceIDString = copy_printer_interface_deviceid(printerIntf, g.alternateSetting);
(*printerIntf)->Release(printerIntf);
}
}

Expand Down Expand Up @@ -2514,5 +2537,5 @@ log_usb_class_driver(int is_64bit) /* I - Is the USB class driver 64-bit? */


/*
* End of "$Id: usb-darwin.c 12672 2015-05-28 00:10:27Z msweet $".
* End of "$Id: usb-darwin.c 12818 2015-07-31 13:29:25Z msweet $".
*/
7 changes: 5 additions & 2 deletions cgi-bin/ipp-var.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* "$Id: ipp-var.c 12700 2015-06-08 18:32:35Z msweet $"
* "$Id: ipp-var.c 12768 2015-06-30 16:13:38Z msweet $"
*
* CGI <-> IPP variable routines for CUPS.
*
Expand Down Expand Up @@ -222,6 +222,9 @@ cgiGetIPPObjects(ipp_t *response, /* I - IPP response */
break;

case IPP_TAG_INTEGER :
if (!strncmp(ippGetName(attr), "time-at-", 8))
break; /* Ignore time-at-xxx */

for (i = 0; !add && i < attr->num_values; i ++)
{
char buf[255]; /* Number buffer */
Expand Down Expand Up @@ -1547,5 +1550,5 @@ cgiText(const char *message) /* I - Message */


/*
* End of "$Id: ipp-var.c 12700 2015-06-08 18:32:35Z msweet $".
* End of "$Id: ipp-var.c 12768 2015-06-30 16:13:38Z msweet $".
*/
9 changes: 8 additions & 1 deletion conf/mime.types
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# VERSIONS OF CUPS. Instead, create a "local.types" file that
# reflects your local configuration changes.
#
# Copyright 2007-2014 by Apple Inc.
# Copyright 2007-2015 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products.
#
# These coded instructions, statements, and computer programs are the
Expand Down Expand Up @@ -81,6 +81,13 @@ application/postscript ai eps ps string(0,%!) string(0,<04>%!) \
(contains(0,4096,<0a>%!) + \
!contains(0,4096,"ENTER LANGUAGE")))

application/g-code gcode
application/sla stl string(0,"solid ") + contains(0,4096,"facet") + contains(0,4096,"vertex")
application/vnd.makerbot-s3g x3g
model/amf amf
model/vnd.collada+xml dae


########################################################################
#
# Image files...
Expand Down
Loading

0 comments on commit be91b84

Please sign in to comment.