Skip to content

Commit

Permalink
Merge changes from CUPS 1.6svn-r10390.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh:https://src.apple.com/svn/cups/easysw/current@3755 a1ca3aef-8c08-0410-bb20-df032aa958be
  • Loading branch information
msweet committed Mar 30, 2012
1 parent 3e7fe0c commit 82cc1f9
Show file tree
Hide file tree
Showing 91 changed files with 7,386 additions and 3,070 deletions.
12 changes: 12 additions & 0 deletions CHANGES-1.5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ CHANGES-1.5.txt

CHANGES IN CUPS V1.5.3

- Fixed compile problem with old versions of OpenSSL (STR #4036)
- The network backends did not check SNMP supply levels regularly
(STR #4040)
- The online help always included the "help on help" text (STR #4042)
- Fixed a SSL handshake issue on OS X (STR #4045)
- The scheduler could crash if a PPD file contained an invalid paper
size (STR #4049)
- The CUPS polling daemon did not reinitialize its connection to the
remote server on errors in all cases (STR #4031)
- PostScript auto-configuration was slow and unreliable with some
printers (STR #4028)
- Missing localizations caused empty output (STR #4033)
- The cups-driverd program could temporarily "forget" a PPD file if it
was updated in place.
- The dnssd backend now prefers IPPS over IPP.
Expand Down
13 changes: 12 additions & 1 deletion CHANGES-IPPTOOL.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
CHANGES-IPPTOOL.txt - 2012-02-06
CHANGES-IPPTOOL.txt - 2012-02-28
--------------------------------

This file provides a list of changes to the ipptool binary distribution posted
on cups.org.


2012-02-28

- Changed behavior of WITH-VALUES "/regex/" to not require all values to
match.
- Added WITH-ALL-VALUES directive for EXPECT predicates that require all
values to match.
- Updated test files to use WITH-ALL-VALUES where necessary.
- Updated test files to use new ABNF for media names from PWG Media
Names 2.0.


2012-02-06

- Fixed the packaging of ipptool on Windows (removed unnecessary DLLs)
Expand Down
14 changes: 13 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
CHANGES.txt - 1.6b1 - 2012-02-15
CHANGES.txt - 1.6b1 - 2012-03-16
--------------------------------

CHANGES IN CUPS V1.6b1

- Documentation updates (STR #3927, STR #3980, STR #4010)
- The PreserveJobFiles and PreserveJobHistory directives now support
specification of a time interval (STR #3143)
- PPD files can now be archived in (gzip'd) tar files to further reduce
the disk space used by PPD files (STR #3772)
- The network backends now deal with printers that report their levels
in percent but do not specify a maximum capacity of 100 (STR #3551)
- The network backends now report full/almost-full waste bins in
printers along with end-of-life for cleaning pads (STR #4017)
- Added a configure option to set the permissions of the installed
cupsd (STR #3459)
- Added a new WITH-ALL-VALUES directive to ipptool EXPECT predicates
(STR #3949)
- CUPS now supports a User directive in client.conf and the CUPS_USER
environment variable for overriding the default username (STR #3114)
- Now set the PJL USERNAME variable as needed (STR #3100)
Expand Down
2 changes: 2 additions & 0 deletions Makedefs.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ SHELL = /bin/sh

INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
INSTALL_CONFIG = $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
INSTALL_COMPDATA = $(INSTALL) -c -m 444 @INSTALL_GZIP@
INSTALL_DATA = $(INSTALL) -c -m 444
INSTALL_DIR = $(INSTALL) -d
INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
Expand All @@ -62,6 +63,7 @@ CUPS_PRIMARY_SYSTEM_GROUP = @CUPS_PRIMARY_SYSTEM_GROUP@
#

CUPS_CONFIG_FILE_PERM = @CUPS_CONFIG_FILE_PERM@
CUPS_CUPSD_FILE_PERM = @CUPS_CUPSD_FILE_PERM@
CUPS_LOG_FILE_PERM = @CUPS_LOG_FILE_PERM@

#
Expand Down
16 changes: 15 additions & 1 deletion backend/backend-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Backend support definitions for CUPS.
*
* Copyright 2007-2011 by Apple Inc.
* Copyright 2007-2012 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
Expand Down Expand Up @@ -259,6 +259,20 @@ extern "C" {
#define CUPS_TC_inserts 33
#define CUPS_TC_covers 34

#define CUPS_TC_tenThousandthsOfInches 3
#define CUPS_TC_micrometers 4
#define CUPS_TC_impressions 7
#define CUPS_TC_sheets 8
#define CUPS_TC_hours 11
#define CUPS_TC_thousandthsOfOunces 12
#define CUPS_TC_tenthsOfGrams 13
#define CUPS_TC_hundrethsOfFluidOunces 14
#define CUPS_TC_tenthsOfMilliliters 15
#define CUPS_TC_feet 16
#define CUPS_TC_meters 17
#define CUPS_TC_items 18
#define CUPS_TC_percent 19

/* These come from RFC 3808 to define character sets we support */
/* Also see http:https://www.iana.org/assignments/character-sets */
#define CUPS_TC_csASCII 3
Expand Down
15 changes: 10 additions & 5 deletions backend/dnssd.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,31 +84,36 @@ static void browse_callback(DNSServiceRef sdRef,
DNSServiceErrorType errorCode,
const char *serviceName,
const char *regtype,
const char *replyDomain, void *context);
const char *replyDomain, void *context)
__attribute__((nonnull(1,5,6,7,8)));
static void browse_local_callback(DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
DNSServiceErrorType errorCode,
const char *serviceName,
const char *regtype,
const char *replyDomain,
void *context);
void *context)
__attribute__((nonnull(1,5,6,7,8)));
static int compare_devices(cups_device_t *a, cups_device_t *b);
static void exec_backend(char **argv);
static cups_device_t *get_device(cups_array_t *devices,
const char *serviceName,
const char *regtype,
const char *replyDomain);
const char *replyDomain)
__attribute__((nonnull(1,2,3,4)));
static void query_callback(DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
DNSServiceErrorType errorCode,
const char *fullName, uint16_t rrtype,
uint16_t rrclass, uint16_t rdlen,
const void *rdata, uint32_t ttl,
void *context);
void *context)
__attribute__((nonnull(1,5,9,11)));
static void sigterm_handler(int sig);
static void unquote(char *dst, const char *src, size_t dstsize);
static void unquote(char *dst, const char *src, size_t dstsize)
__attribute__((nonnull(1,2)));


/*
Expand Down
72 changes: 57 additions & 15 deletions backend/ipp.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@
# define kPMPrintUIToolAgent "com.apple.printuitool.agent"
# define kPMStartJob 100
# define kPMWaitForJob 101
# ifdef HAVE_XPC_PRIVATE_H
# include <xpc/private.h>
# else
extern void xpc_connection_set_target_uid(xpc_connection_t connection,
uid_t uid);
# endif /* HAVE_XPC_PRIVATE_H */
#endif /* HAVE_GSSAPI && HAVE_XPC */


Expand Down Expand Up @@ -1139,12 +1143,7 @@ main(int argc, /* I - Number of command-line args */
copies = atoi(argv[4]);

if (copies_sup || argc < 7)
{
copies_remaining = 1;

if (argc < 7 && !_cups_strncasecmp(final_content_type, "image/", 6))
copies = 1;
}
else
copies_remaining = copies;

Expand Down Expand Up @@ -1179,7 +1178,8 @@ main(int argc, /* I - Number of command-line args */
if (format_sup != NULL)
{
for (i = 0; i < format_sup->num_values; i ++)
if (!_cups_strcasecmp(final_content_type, format_sup->values[i].string.text))
if (!_cups_strcasecmp(final_content_type,
format_sup->values[i].string.text))
{
document_format = final_content_type;
break;
Expand All @@ -1189,14 +1189,17 @@ main(int argc, /* I - Number of command-line args */
{
for (i = 0; i < format_sup->num_values; i ++)
if (!_cups_strcasecmp("application/octet-stream",
format_sup->values[i].string.text))
format_sup->values[i].string.text))
{
document_format = "application/octet-stream";
break;
}
}
}

fprintf(stderr, "DEBUG: final_content_type=\"%s\", document_format=\"%s\"\n",
final_content_type, document_format ? document_format : "(null)");

/*
* If the printer does not support HTTP/1.1 (which IPP requires), copy stdin
* to a temporary file so that we can do a HTTP/1.0 submission...
Expand Down Expand Up @@ -1552,8 +1555,9 @@ main(int argc, /* I - Number of command-line args */
if ((i + 1) >= num_files)
ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", 1);

ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
"document-format", NULL, document_format);
if (document_format)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
"document-format", NULL, document_format);

fprintf(stderr, "DEBUG: Sending file %d using chunking...\n", i + 1);
http_status = cupsSendRequest(http, request, resource, 0);
Expand All @@ -1578,10 +1582,11 @@ main(int argc, /* I - Number of command-line args */

if (fd >= 0)
{
while (!job_canceled &&
while (!job_canceled && http_status == HTTP_CONTINUE &&
(bytes = read(fd, buffer, sizeof(buffer))) > 0)
{
if (cupsWriteRequestData(http, buffer, bytes) != HTTP_CONTINUE)
if ((http_status = cupsWriteRequestData(http, buffer, bytes))
!= HTTP_CONTINUE)
break;
else
{
Expand Down Expand Up @@ -2446,9 +2451,46 @@ new_request(
NULL, "two-sided-short-edge");
}

if (doc_handling_sup &&
(!format || _cups_strncasecmp(format, "image/", 6)) &&
(keyword = cupsGetOption("collate", num_options, options)) != NULL)
if ((keyword = cupsGetOption("multiple-document-handling",
num_options, options)) != NULL)
{
if (strstr(keyword, "uncollated"))
keyword = "false";
else
keyword = "true";
}
else if ((keyword = cupsGetOption("collate", num_options,
options)) == NULL)
keyword = "true";

if (format)
{
if (!_cups_strcasecmp(format, "image/gif") ||
!_cups_strcasecmp(format, "image/jp2") ||
!_cups_strcasecmp(format, "image/jpeg") ||
!_cups_strcasecmp(format, "image/png") ||
!_cups_strcasecmp(format, "image/tiff") ||
!_cups_strncasecmp(format, "image/x-", 8))
{
/*
* Collation makes no sense for single page image formats...
*/

keyword = "false";
}
else if (!_cups_strncasecmp(format, "image/", 6) ||
!_cups_strcasecmp(format, "application/vnd.cups-raster"))
{
/*
* Multi-page image formats will have copies applied by the upstream
* filters...
*/

copies = 1;
}
}

if (doc_handling_sup)
{
if (!_cups_strcasecmp(keyword, "true"))
collate_str = "separate-documents-collated-copies";
Expand Down Expand Up @@ -2513,7 +2555,7 @@ new_request(
cupsEncodeOptions(request, num_options, options);
}

if (copies > 1 && copies <= pc->max_copies)
if (copies > 1 && (!pc || copies <= pc->max_copies))
ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_INTEGER, "copies", copies);
}

Expand Down
32 changes: 29 additions & 3 deletions backend/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ backendNetworkSideCB(
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
else if (backendDrainOutput(print_fd, device_fd))
status = CUPS_SC_STATUS_IO_ERROR;
else
else
status = CUPS_SC_STATUS_OK;

datalen = 0;
Expand All @@ -119,8 +119,35 @@ backendNetworkSideCB(

if (snmp_fd >= 0)
{
char *dataptr; /* Pointer into data */
cups_snmp_t packet; /* Packet from printer */
const char *snmp_value; /* CUPS_SNMP_VALUE env var */

if ((snmp_value = getenv("CUPS_SNMP_VALUE")) != NULL)
{
const char *snmp_count; /* CUPS_SNMP_COUNT env var */
int count; /* Repetition count */

if ((snmp_count = getenv("CUPS_SNMP_COUNT")) != NULL)
{
if ((count = atoi(snmp_count)) <= 0)
count = 1;
}
else
count = 1;

for (dataptr = data + strlen(data) + 1;
count > 0 && dataptr < (data + sizeof(data) - 1);
count --, dataptr += strlen(dataptr))
strlcpy(dataptr, snmp_value, sizeof(data) - (dataptr - data));

fprintf(stderr, "DEBUG: Returning %s %s\n", data,
data + strlen(data) + 1);

status = CUPS_SC_STATUS_OK;
datalen = dataptr - data;
break;
}

if (!_cupsSNMPStringToOID(data, packet.object_name, CUPS_SNMP_MAX_OID))
{
Expand All @@ -141,7 +168,6 @@ backendNetworkSideCB(
{
if (_cupsSNMPRead(snmp_fd, &packet, 1.0))
{
char *dataptr; /* Pointer into data */
int i; /* Looping var */


Expand Down Expand Up @@ -172,7 +198,7 @@ backendNetworkSideCB(
case CUPS_ASN1_OCTET_STRING :
if (packet.object_value.string.num_bytes < 0)
i = 0;
else if (packet.object_value.string.num_bytes <
else if (packet.object_value.string.num_bytes <
(sizeof(data) - (dataptr - data)))
i = packet.object_value.string.num_bytes;
else
Expand Down

0 comments on commit 82cc1f9

Please sign in to comment.